diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-03-28 11:11:12 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-03-28 11:11:12 +0000 |
commit | d9c3209d449b1ba1c46930e30440b77161b21eff (patch) | |
tree | ad94e28504bc199d670c0758b07608f036d94f63 /pym | |
parent | f5002b88d715957f0e31a7e866011bb72f9a973c (diff) | |
download | portage-d9c3209d449b1ba1c46930e30440b77161b21eff.tar.gz portage-d9c3209d449b1ba1c46930e30440b77161b21eff.tar.bz2 portage-d9c3209d449b1ba1c46930e30440b77161b21eff.zip |
Bug #211554 - Replace references to config["USE"] with references to
config["PORTAGE_USE"] (which is filtered for intersection with IUSE)
so that dependency calculations at installation time are consistent
with those at depclean time. (trunk r9391:9393)
svn path=/main/branches/2.1.2/; revision=9540
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 123 |
1 files changed, 63 insertions, 60 deletions
diff --git a/pym/portage.py b/pym/portage.py index 4b3df78eb..ab4b2eb4d 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1429,7 +1429,7 @@ class config: # Blacklist vars that could interfere with portage internals. for blacklisted in "CATEGORY", "PKGUSE", "PORTAGE_CONFIGROOT", \ - "ROOT": + "PORTAGE_IUSE", "PORTAGE_USE", "ROOT": for cfg in self.lookuplist: cfg.pop(blacklisted, None) del blacklisted, cfg @@ -1874,6 +1874,7 @@ class config: self.modifying() if self.mycpv == mycpv: return + ebuild_phase = self.get("EBUILD_PHASE") has_changed = False self.mycpv = mycpv cp = dep_getkey(mycpv) @@ -1950,7 +1951,7 @@ class config: if "test" in self.features: test_use_changed = \ bool(re.search(r'(^|\s)[-+]?test(\s|$)', iuse)) != \ - ("test" in self.get("PORTAGE_USE","").split()) + ("test" in self["USE"].split()) if self.get("EBUILD_PHASE") or \ self._use_wildcards or \ test_use_changed: @@ -1962,6 +1963,63 @@ class config: if has_changed: self.reset(keeping_pkg=1,use_cache=use_cache) + # Filter out USE flags that aren't part of IUSE. This has to + # be done for every setcpv() call since practically every + # package has different IUSE. Some flags are considered to + # be implicit members of IUSE: + # + # * Flags derived from ARCH + # * Flags derived from USE_EXPAND_HIDDEN variables + # * Masked flags, such as those from {,package}use.mask + # * Forced flags, such as those from {,package}use.force + # * build and bootstrap flags used by bootstrap.sh + + usesplit = self["USE"].split() + iuse_implicit = set(x.lstrip("+-") for x in iuse.split()) + + # Flags derived from ARCH. + arch = self.configdict["defaults"].get("ARCH") + if arch: + iuse_implicit.add(arch) + iuse_implicit.update(self.get("PORTAGE_ARCHLIST", "").split()) + + # Flags derived from USE_EXPAND_HIDDEN variables + # such as ELIBC, KERNEL, and USERLAND. + use_expand_hidden = self.get("USE_EXPAND_HIDDEN", "").split() + use_expand_hidden_raw = use_expand_hidden + if use_expand_hidden: + use_expand_hidden = re.compile("^(%s)_.*" % \ + ("|".join(x.lower() for x in use_expand_hidden))) + for x in usesplit: + if use_expand_hidden.match(x): + iuse_implicit.add(x) + + # Flags that have been masked or forced. + iuse_implicit.update(self.usemask) + iuse_implicit.update(self.useforce) + + # build and bootstrap flags used by bootstrap.sh + iuse_implicit.add("build") + iuse_implicit.add("bootstrap") + + if ebuild_phase: + iuse_grep = iuse_implicit.copy() + if use_expand_hidden_raw: + for x in use_expand_hidden_raw: + iuse_grep.add(x.lower() + "_.*") + if iuse_grep: + iuse_grep = "^(%s)$" % "|".join(sorted(iuse_grep)) + else: + iuse_grep = "" + self.configdict["pkg"]["PORTAGE_IUSE"] = iuse_grep + + # Filtered for the ebuild environment. Store this in a separate + # attribute since we still want to be able to see global USE + # settings for things like emerge --info. + self.configdict["pkg"]["PORTAGE_USE"] = " ".join(sorted( + x for x in usesplit if \ + x in iuse_implicit)) + def _getMaskAtom(self, cpv, metadata): """ Take a package and return a matching package.mask atom, or None if no @@ -2109,7 +2167,7 @@ class config: return if isinstance(mydbapi, portdbapi): self.setcpv(mycpv, mydb=mydbapi) - myuse = self["USE"] + myuse = self["PORTAGE_USE"] elif isinstance(mydbapi, dict): myuse = mydbapi["USE"] else: @@ -2395,64 +2453,9 @@ class config: if arch and arch not in usesplit: usesplit.append(arch) - # Filter out USE flags that aren't part of IUSE. Some - # flags are considered to be implicit members of IUSE: - # - # * Flags derived from ARCH - # * Flags derived from USE_EXPAND_HIDDEN variables - # * Masked flags, such as those from {,package}use.mask - # * Forced flags, such as those from {,package}use.force - # * build and bootstrap flags used by bootstrap.sh - - # Do this even when there's no package since setcpv() can - # optimize away regenerate() calls. - iuse_implicit = set(iuse) - - # Flags derived from ARCH. - if arch: - iuse_implicit.add(arch) - iuse_implicit.update(self.get("PORTAGE_ARCHLIST", "").split()) - - # Flags derived from USE_EXPAND_HIDDEN variables - # such as ELIBC, KERNEL, and USERLAND. - use_expand_hidden = self.get("USE_EXPAND_HIDDEN", "").split() - use_expand_hidden_raw = use_expand_hidden - if use_expand_hidden: - use_expand_hidden = re.compile("^(%s)_.*" % \ - ("|".join(x.lower() for x in use_expand_hidden))) - for x in usesplit: - if use_expand_hidden.match(x): - iuse_implicit.add(x) - - # Flags that have been masked or forced. - iuse_implicit.update(self.usemask) - iuse_implicit.update(self.useforce) - - # build and bootstrap flags used by bootstrap.sh - iuse_implicit.add("build") - iuse_implicit.add("bootstrap") - - iuse_grep = iuse_implicit.copy() - if use_expand_hidden_raw: - for x in use_expand_hidden_raw: - iuse_grep.add(x.lower() + "_.*") - if iuse_grep: - iuse_grep = "^(%s)$" % "|".join(sorted(iuse_grep)) - else: - iuse_grep = "" - self["PORTAGE_IUSE"] = iuse_grep - usesplit = [x for x in usesplit if \ x not in self.usemask] - # Filtered for the ebuild environment. Store this in a separate - # attribute since we still want to be able to see global USE - # settings for things like emerge --info. - self["PORTAGE_USE"] = " ".join(sorted( - x for x in usesplit if \ - x in iuse_implicit)) - self.backup_changes("PORTAGE_USE") - usesplit.sort() self.configlist[-1]["USE"]= " ".join(usesplit) @@ -2654,7 +2657,7 @@ class config: mydict[k] = v # Filtered by IUSE and implicit IUSE. - mydict["USE"] = self["PORTAGE_USE"] + mydict["USE"] = self.get("PORTAGE_USE", "") # sandbox's bashrc sources /etc/profile which unsets ROOTPATH, # so we have to back it up and restore it. @@ -5372,7 +5375,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, if use=="yes": if myuse is None: #default behavior - myusesplit = mysettings["USE"].split() + myusesplit = mysettings["PORTAGE_USE"].split() else: myusesplit = myuse # We've been given useflags to use. |