PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI"
PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE \
- EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR PM_EBUILD_HOOK_DIR \
+ EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \
+ PM_EBUILD_HOOK_DIR \
PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \
PORTAGE_BIN_PATH PORTAGE_BUILDDIR PORTAGE_BUNZIP2_COMMAND \
The AA and KV variables are no longer exported to the ebuild environment.
</para>
</section>
+ <section id='package-ebuild-eapi-4_pre1-variables-merge-type'>
+ <title>MERGE_TYPE</title>
+ <para>
+ The type of package that is being merged. Possible values are:
+ "source" if building and installing a package from source, "binary" if installing a binary
+ package, and "buildonly" if building a binary package without installing it.
+ </para>
+ </section>
<section id='package-ebuild-eapi-4_pre1-variables-replaced-versions'>
<title>REPLACING_VERSIONS and REPLACED_BY_VERSION</title>
<para>
self._build_dir = EbuildBuildDir(
scheduler=self.scheduler, settings=settings)
settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
+ settings.configdict["pkg"]["MERGE_TYPE"] = "binary"
# The prefetcher has already completed or it
# could be running now. If it's running now,
portdb = root_config.trees[tree].dbapi
settings.setcpv(pkg)
settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
+ if self.opts.buildpkgonly:
+ settings.configdict["pkg"]["MERGE_TYPE"] = "buildonly"
+ else:
+ settings.configdict["pkg"]["MERGE_TYPE"] = "source"
ebuild_path = portdb.findname(pkg.cpv, myrepo=pkg.repo)
if ebuild_path is None:
raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
def eapi_exports_KV(eapi):
return eapi in ("0", "1", "2", "3")
+def eapi_exports_merge_type(eapi):
+ return eapi not in ("0", "1", "2", "3")
+
def eapi_exports_replace_vars(eapi):
return eapi not in ("0", "1", "2", "3")
"A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI",
"EBUILD_PHASE", "ED", "EMERGE_FROM", "EPREFIX", "EROOT",
"HOMEPAGE", "INHERITED", "IUSE",
- "KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE", "PORTAGE_BUILDIR_LOCKED",
+ "KEYWORDS", "LICENSE", "MERGE_TYPE",
+ "PDEPEND", "PF", "PKGUSE", "PORTAGE_BUILDIR_LOCKED",
"PORTAGE_BUILT_USE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
"PORTAGE_NONFATAL", "PORTAGE_REPO_NAME", "PORTAGE_SANDBOX_COMPAT_LEVEL",
"PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT",
"EBUILD_FORCE_TEST",
"EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "ED",
"EMERGE_FROM", "EPREFIX", "EROOT",
- "FEATURES", "FILESDIR", "HOME", "NOCOLOR", "PATH",
+ "FEATURES", "FILESDIR", "HOME", "MERGE_TYPE", "NOCOLOR", "PATH",
"PKGDIR",
"PKGUSE", "PKG_LOGDIR", "PKG_TMPDIR",
"PORTAGE_ACTUAL_DISTDIR", "PORTAGE_ARCHLIST",
from portage.dbapi.porttree import portdbapi
from portage.dbapi.vartree import vartree
from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_separator, _slot_separator
-from portage.eapi import eapi_exports_AA, eapi_supports_prefix, eapi_exports_replace_vars
+from portage.eapi import eapi_exports_AA, eapi_exports_merge_type, \
+ eapi_supports_prefix, eapi_exports_replace_vars
from portage.env.loaders import KeyValuePairFileLoader
from portage.exception import InvalidDependString, PortageException
from portage.localization import _
if not eapi_exports_AA(eapi):
mydict.pop("AA", None)
+ if not eapi_exports_merge_type(eapi):
+ mydict.pop("MERGE_TYPE", None)
+
# Prefix variables are supported starting with EAPI 3.
if phase == 'depend' or eapi is None or not eapi_supports_prefix(eapi):
mydict.pop("ED", None)