From: Zac Medico Date: Sat, 4 Dec 2010 03:55:18 +0000 (-0800) Subject: EAPI 4: Support MERGE_TYPE (bug #347351) X-Git-Tag: v2.2.0_alpha7~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8553b7bcb4b0bef2973774c22cc2fa84682c464b;p=portage.git EAPI 4: Support MERGE_TYPE (bug #347351) --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 04330262e..491301f7a 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1678,7 +1678,8 @@ PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION 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 \ diff --git a/doc/package/ebuild/eapi/4.docbook b/doc/package/ebuild/eapi/4.docbook index e69b698db..ed450984f 100644 --- a/doc/package/ebuild/eapi/4.docbook +++ b/doc/package/ebuild/eapi/4.docbook @@ -290,6 +290,14 @@ src_install() { The AA and KV variables are no longer exported to the ebuild environment. +
+ MERGE_TYPE + + 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. + +
REPLACING_VERSIONS and REPLACED_BY_VERSION diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index 89f136106..9279fa39a 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -55,6 +55,7 @@ class Binpkg(CompositeTask): 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, diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py index 0f9b85cc3..6de7ac1c8 100644 --- a/pym/_emerge/EbuildBuild.py +++ b/pym/_emerge/EbuildBuild.py @@ -42,6 +42,10 @@ class EbuildBuild(CompositeTask): 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) diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py index eb2809ee8..da5fd8c27 100644 --- a/pym/portage/eapi.py +++ b/pym/portage/eapi.py @@ -28,6 +28,9 @@ def eapi_exports_AA(eapi): 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") diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 31b10cd22..561de9cf4 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -12,7 +12,8 @@ env_blacklist = frozenset(( "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", @@ -35,7 +36,7 @@ environ_whitelist += [ "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", diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 335656c31..664075197 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -27,7 +27,8 @@ from portage.dbapi import dbapi 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 _ @@ -2062,6 +2063,9 @@ class config(object): 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)