metadata = None
if metadata and not built:
pkgsettings.setcpv(cpv, mydb=metadata)
- metadata["USE"] = pkgsettings.get("USE", "")
+ metadata["USE"] = pkgsettings["PORTAGE_USE"]
if metadata is None:
mreasons = ["corruption"]
else:
mydbapi.aux_get(mykey, self._mydbapi_keys)))
if mytype == "ebuild":
pkgsettings.setcpv(mykey, mydb=portdb)
- metadata["USE"] = pkgsettings["USE"]
+ metadata["USE"] = pkgsettings["PORTAGE_USE"]
myuse = metadata["USE"].split()
if not arg and myroot == self.target_root:
pkgsettings.setcpv(myeb, mydb=mydb)
else:
pkgsettings.setcpv(myeb_pkg, mydb=mydb)
- now_use = pkgsettings["USE"].split()
+ now_use = pkgsettings["PORTAGE_USE"].split()
forced_flags = set()
forced_flags.update(pkgsettings.useforce)
forced_flags.update(pkgsettings.usemask)
metadata = dict(izip(self._mydbapi_keys,
portdb.aux_get(myeb, self._mydbapi_keys)))
pkgsettings.setcpv(myeb, mydb=portdb)
- metadata["USE"] = pkgsettings["USE"]
+ metadata["USE"] = pkgsettings["PORTAGE_USE"]
matched_packages.append(
(["ebuild", myroot, myeb], metadata))
repo_path_real = os.path.dirname(os.path.dirname(
os.path.dirname(ebuild_path)))
pkgsettings.setcpv(pkg_key, mydb=mydbapi)
- metadata["USE"] = pkgsettings["USE"]
+ metadata["USE"] = pkgsettings["PORTAGE_USE"]
else:
repo_path_real = portdb.getRepositoryPath(repo_name)
pkg_use = metadata["USE"].split()
if pkg_type == "ebuild":
pkgsettings = self.pkgsettings[myroot]
pkgsettings.setcpv(pkg_key, mydb=fakedb[myroot])
- fakedb[myroot].aux_update(pkg_key, {"USE":pkgsettings["USE"]})
+ fakedb[myroot].aux_update(pkg_key,
+ {"USE":pkgsettings["PORTAGE_USE"]})
self.spinner.update()
class RepoDisplay(object):
metadata.update(izip(metadata_keys,
mydbapi.aux_get(pkg_key, metadata_keys)))
pkgsettings.setcpv(pkg_key, mydb=mydbapi)
- metadata["USE"] = pkgsettings["USE"]
+ metadata["USE"] = pkgsettings["PORTAGE_USE"]
else:
if pkg_type == "binary":
mydbapi = bindb
if portdb.cpv_exists(pkg):
mydb = portdb
pkgsettings.setcpv(pkg, mydb=mydb)
- if valuesmap["IUSE"].intersection(pkgsettings["USE"].split()) != \
- valuesmap["USE"]:
+ if valuesmap["IUSE"].intersection(
+ pkgsettings["PORTAGE_USE"].split()) != valuesmap["USE"]:
diff_values["USE"] = valuesmap["USE"]
# If a difference was found, print the info for
# this package.
# 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
self.modifying()
if self.mycpv == mycpv:
return
+ ebuild_phase = self.get("EBUILD_PHASE")
has_changed = False
self.mycpv = mycpv
cp = dep_getkey(mycpv)
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:
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
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:
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)
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.
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.