diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-01-17 08:48:32 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-01-17 08:48:32 +0000 |
commit | d3941c871eaf35e4bedfa4d469581d37f0de853f (patch) | |
tree | 81676ef8ae14bb8f5ec9b2c6ae188d41e2b11684 /pym/portage.py | |
parent | ad5e7103aba7e4c2f92ed4c54f6a97f0a375b713 (diff) | |
download | portage-d3941c871eaf35e4bedfa4d469581d37f0de853f.tar.gz portage-d3941c871eaf35e4bedfa4d469581d37f0de853f.tar.bz2 portage-d3941c871eaf35e4bedfa4d469581d37f0de853f.zip |
Merge doebuild *DEPEND validation from trunk r5652:5655.
svn path=/main/branches/2.1.2/; revision=5686
Diffstat (limited to 'pym/portage.py')
-rw-r--r-- | pym/portage.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 2e6b571cf..13014ef6a 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3352,6 +3352,30 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, return spawn(EBUILD_SH_BINARY + " depend", mysettings) + # 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"] + metadata = dict(izip(dep_keys, mydbapi.aux_get(mycpv, dep_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 + del mycpv, dep_keys, metadata, FakeTree, dep_check_trees + if "PORTAGE_TMPDIR" not in mysettings or \ not os.path.isdir(mysettings["PORTAGE_TMPDIR"]): writemsg("The directory specified in your " + \ |