diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-10-21 22:05:51 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-10-21 22:05:51 +0000 |
commit | 881b3dc0fdbb11ef9893e60ff68f57970c056eda (patch) | |
tree | d402ae037dc4665391514485e3a31553a647061b | |
parent | 9874b7bf2454643a9a288d6d6fc36ef543004fc3 (diff) | |
download | portage-881b3dc0fdbb11ef9893e60ff68f57970c056eda.tar.gz portage-881b3dc0fdbb11ef9893e60ff68f57970c056eda.tar.bz2 portage-881b3dc0fdbb11ef9893e60ff68f57970c056eda.zip |
Split dep validation out of doebuild() and skip it when called by emerge since
there's no need to do this every time emerge executes a phase.
svn path=/main/trunk/; revision=11714
-rw-r--r-- | pym/portage/__init__.py | 91 |
1 files changed, 51 insertions, 40 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index ffa542a51..d55054e47 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5379,46 +5379,13 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, droppriv=droppriv) # Validate dependency metadata here to ensure that ebuilds with invalid - # data are never installed (even via the ebuild command). - invalid_dep_exempt_phases = \ - set(["clean", "cleanrm", "help", "prerm", "postrm"]) - mycpv = mysettings["CATEGORY"] + "/" + mysettings["PF"] - dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] - misc_keys = ["LICENSE", "PROPERTIES", "PROVIDE", "RESTRICT", "SRC_URI"] - other_keys = ["SLOT"] - all_keys = dep_keys + misc_keys + other_keys - metadata = dict(izip(all_keys, mydbapi.aux_get(mycpv, all_keys))) - class FakeTree(object): - def __init__(self, mydb): - self.dbapi = mydb - dep_check_trees = {myroot:{}} - dep_check_trees[myroot]["porttree"] = \ - FakeTree(fakedbapi(settings=mysettings)) - for dep_type in dep_keys: - mycheck = dep_check(metadata[dep_type], None, mysettings, - myuse="all", myroot=myroot, trees=dep_check_trees) - if not mycheck[0]: - writemsg("%s: %s\n%s\n" % ( - dep_type, metadata[dep_type], mycheck[1]), noiselevel=-1) - if mydo not in invalid_dep_exempt_phases: - return 1 - del dep_type, mycheck - for k in misc_keys: - try: - portage.dep.use_reduce( - portage.dep.paren_reduce(metadata[k]), matchall=True) - except portage.exception.InvalidDependString, e: - writemsg("%s: %s\n%s\n" % ( - k, metadata[k], str(e)), noiselevel=-1) - del e - if mydo not in invalid_dep_exempt_phases: - return 1 - del k - if not metadata["SLOT"]: - writemsg("SLOT is undefined\n", noiselevel=-1) - if mydo not in invalid_dep_exempt_phases: - return 1 - del mycpv, dep_keys, metadata, misc_keys, FakeTree, dep_check_trees + # data are never installed via the ebuild command. Don't bother when + # returnpid == True since there's no need to do this every time emerge + # executes a phase. + if not returnpid: + rval = _validate_deps(mysettings, myroot, mydo, mydbapi) + if rval != os.EX_OK: + return rval if "PORTAGE_TMPDIR" not in mysettings or \ not os.path.isdir(mysettings["PORTAGE_TMPDIR"]): @@ -5831,6 +5798,50 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, # and the exemption is no longer needed. _doebuild_manifest_exempt_depend -= 1 +def _validate_deps(mysettings, myroot, mydo, mydbapi): + + invalid_dep_exempt_phases = \ + set(["clean", "cleanrm", "help", "prerm", "postrm"]) + dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] + misc_keys = ["LICENSE", "PROPERTIES", "PROVIDE", "RESTRICT", "SRC_URI"] + other_keys = ["SLOT"] + all_keys = dep_keys + misc_keys + other_keys + metadata = dict(izip(all_keys, + mydbapi.aux_get(mysettings.mycpv, all_keys))) + + class FakeTree(object): + def __init__(self, mydb): + self.dbapi = mydb + dep_check_trees = {myroot:{}} + dep_check_trees[myroot]["porttree"] = \ + FakeTree(fakedbapi(settings=mysettings)) + + for dep_type in dep_keys: + mycheck = dep_check(metadata[dep_type], None, mysettings, + myuse="all", myroot=myroot, trees=dep_check_trees) + if not mycheck[0]: + writemsg("%s: %s\n%s\n" % ( + dep_type, metadata[dep_type], mycheck[1]), noiselevel=-1) + if mydo not in invalid_dep_exempt_phases: + return 1 + + for k in misc_keys: + try: + portage.dep.use_reduce( + portage.dep.paren_reduce(metadata[k]), matchall=True) + except portage.exception.InvalidDependString, e: + writemsg("%s: %s\n%s\n" % ( + k, metadata[k], str(e)), noiselevel=-1) + if mydo not in invalid_dep_exempt_phases: + return 1 + + if not metadata["SLOT"]: + writemsg("SLOT is undefined\n", noiselevel=-1) + if mydo not in invalid_dep_exempt_phases: + return 1 + + return os.EX_OK + expandcache={} def _movefile(src, dest, **kwargs): |