from portage import _unicode_decode
from portage import _unicode_encode
from portage.const import VDB_PATH
+from _emerge.Package import Package
+from _emerge.RootConfig import RootConfig
if not opts.ignore_default_opts:
default_opts = portage.settings.get("EBUILD_DEFAULT_OPTS", "").split()
if ebuild.startswith(vdb_path):
mytree = "vartree"
+ pkg_type = "installed"
portage_ebuild = portage.db[portage.root][mytree].dbapi.findname(cpv, myrepo=myrepo)
else:
mytree = "porttree"
+ pkg_type = "ebuild"
portage_ebuild = portage.portdb.findname(cpv, myrepo=myrepo)
tmpsettings.features.discard("fail-clean")
-# Apply package.env settings. This allows per-package FEATURES and other
-# variables (possibly PORTAGE_TMPDIR) to be available as soon as possible.
try:
- tmpsettings.setcpv(cpv, mydb=portage.db[portage.root][mytree].dbapi)
+ metadata = dict(zip(Package.metadata_keys,
+ portage.db[portage.settings["ROOT"]][mytree].dbapi.aux_get(
+ cpv, Package.metadata_keys)))
except KeyError:
# aux_get failure, message should have been shown on stderr.
sys.exit(1)
+root_config = RootConfig(portage.settings,
+ portage.db[portage.settings["ROOT"]], None)
+
+pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv,
+ metadata=metadata, root_config=root_config,
+ type_name=pkg_type)
+
+# Apply package.env and repo-level settings. This allows per-package
+# FEATURES and other variables (possibly PORTAGE_TMPDIR) to be
+# available as soon as possible.
+tmpsettings.setcpv(pkg)
+
def stale_env_warning():
if "clean" not in pargs and \
"noauto" not in tmpsettings.features and \