fi
if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
- "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" "$USE"
+ "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1"
return $?
fi
fi
if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
- "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" "$USE"
+ "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1"
return $?
fi
"EBUILD_PHASE", "ED", "EMERGE_FROM", "EPREFIX", "EROOT",
"HOMEPAGE", "INHERITED", "IUSE",
"KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE",
- "PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
+ "PORTAGE_BUILT_USE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
"PORTAGE_NONFATAL", "PORTAGE_REPO_NAME",
"PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT",
"ROOT", "SLOT", "SRC_URI"
@returns: tuple of (stdout, stderr, returncode)
"""
- # Note that $USE is passed via IPC in order to ensure that
- # we have the correct value for built/installed packages,
- # since the config class doesn't currently provide a way
- # to access built/installed $USE that would work in all
- # possible scenarios.
- cmd, root, atom, use = argv
+ cmd, root, atom = argv
try:
atom = Atom(atom)
except InvalidAtom:
return ('', 'invalid atom: %s\n' % atom, 2)
+ use = self.settings.get('PORTAGE_BUILT_USE')
+ if use is None:
+ use = self.settings['PORTAGE_USE']
+
use = frozenset(use.split())
atom = atom.evaluate_conditionals(use)
pkg_configdict.addLazySingleton(k,
mydb.__getitem__, k)
else:
+ # When calling dbapi.aux_get(), grab USE for built/installed
+ # packages since we want to save it PORTAGE_BUILT_USE for
+ # evaluating conditional USE deps in atoms passed via IPC to
+ # helpers like has_version and best_version.
+ aux_keys = list(aux_keys)
+ aux_keys.append('USE')
for k, v in zip(aux_keys, mydb.aux_get(self.mycpv, aux_keys)):
pkg_configdict[k] = v
+ built_use = frozenset(pkg_configdict.pop('USE').split())
+ if not built_use:
+ # Empty USE means this dbapi instance does not contain
+ # built packages.
+ built_use = None
+
repository = pkg_configdict.pop("repository", None)
if repository is not None:
pkg_configdict["PORTAGE_REPO_NAME"] = repository
env_configdict.addLazySingleton('PORTAGE_RESTRICT',
lazy_vars.__getitem__, 'PORTAGE_RESTRICT')
+ if built_use is not None:
+ pkg_configdict['PORTAGE_BUILT_USE'] = ' '.join(built_use)
+
# If reset() has not been called, it's safe to return
# early if IUSE has not changed.
if not has_changed and previous_iuse == iuse: