EAPI 4: Support MERGE_TYPE (bug #347351)
authorZac Medico <zmedico@gentoo.org>
Sat, 4 Dec 2010 03:55:18 +0000 (19:55 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 4 Dec 2010 03:55:18 +0000 (19:55 -0800)
bin/ebuild.sh
doc/package/ebuild/eapi/4.docbook
pym/_emerge/Binpkg.py
pym/_emerge/EbuildBuild.py
pym/portage/eapi.py
pym/portage/package/ebuild/_config/special_env_vars.py
pym/portage/package/ebuild/config.py

index 04330262ef8f50aac3debc3153c146fa04e03290..491301f7a20081fc144df0fb05138cbc9b42f2b5 100755 (executable)
@@ -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 \
index e69b698db4804facd3c8d4801a931c2ba1bfc991..ed450984fdf578dea37670005a9124acceda7c87 100644 (file)
@@ -290,6 +290,14 @@ src_install() {
                        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>
index 89f13610603ce110c2a103735883349e00a56369..9279fa39a98d64139f328b5c35dbb984eb243cfa 100644 (file)
@@ -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,
index 0f9b85cc326b9481e5b87e63c8fdebb72461e512..6de7ac1c87c59bd5d866d9b86e08ea9336d442b7 100644 (file)
@@ -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)
index eb2809ee83b72fb8e825cce31519b3a562d5fe9f..da5fd8c2713192cf8610285e49845f3f8c6e551b 100644 (file)
@@ -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")
 
index 31b10cd223697b597fb0ecbe6eb043b42c46da39..561de9cf46a013dab8d7745505074465d0bdfd70 100644 (file)
@@ -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",
index 335656c3187cb78815c3a67b761e0d86ed24930c..664075197bc94e2f3f0e64da89022bc019948280 100644 (file)
@@ -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)