From 0d9ea2752aa7819e5b26b47920c09218d9f5b7c2 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 8 Jan 2012 07:19:06 +0100 Subject: [PATCH] Set REPOSITORY variable in ebuild environment in EAPI="4-python". --- bin/phase-functions.sh | 4 ++-- pym/portage/eapi.py | 5 ++++- .../package/ebuild/_config/special_env_vars.py | 6 +++--- pym/portage/package/ebuild/doebuild.py | 11 ++++++++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 2167853dc..ce251ceb9 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Hardcoded bash lists are needed for backward compatibility with @@ -9,7 +9,7 @@ PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE - PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI" + PDEPEND PROVIDE RDEPEND REPOSITORY RESTRICT SLOT SRC_URI" PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE \ EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \ diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py index da5fd8c27..65c99c7e5 100644 --- a/pym/portage/eapi.py +++ b/pym/portage/eapi.py @@ -1,4 +1,4 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 def eapi_has_iuse_defaults(eapi): @@ -34,6 +34,9 @@ def eapi_exports_merge_type(eapi): def eapi_exports_replace_vars(eapi): return eapi not in ("0", "1", "2", "3") +def eapi_exports_REPOSITORY(eapi): + return eapi in ("4-python",) + def eapi_has_pkg_pretend(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 c1628f773..132f8ebd8 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ( @@ -21,8 +21,8 @@ env_blacklist = frozenset(( "PORTAGE_BACKGROUND_UNMERGE", "PORTAGE_BUILDIR_LOCKED", "PORTAGE_BUILT_USE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE", "PORTAGE_NONFATAL", "PORTAGE_REPO_NAME", - "PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT", - "ROOT", "SLOT", "SRC_URI" + "PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "REPOSITORY", + "RESTRICT", "ROOT", "SLOT", "SRC_URI" )) environ_whitelist = [] diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 3c0d023d4..cb7cc1cb3 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] @@ -41,8 +41,9 @@ from portage.dbapi.porttree import _parse_uri_map from portage.dep import Atom, check_required_use, \ human_readable_required_use, paren_enclose, use_reduce from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \ - eapi_exports_replace_vars, eapi_has_required_use, \ - eapi_has_src_prepare_and_src_configure, eapi_has_pkg_pretend + eapi_exports_replace_vars, eapi_exports_REPOSITORY, \ + eapi_has_required_use, eapi_has_src_prepare_and_src_configure, \ + eapi_has_pkg_pretend from portage.elog import elog_process, _preload_elog_modules from portage.elog.messages import eerror, eqawarn from portage.exception import DigestException, FileNotFound, \ @@ -243,6 +244,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, mysettings['PORTDIR'] = repo.eclass_db.porttrees[0] mysettings['PORTDIR_OVERLAY'] = ' '.join(repo.eclass_db.porttrees[1:]) mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name + mysettings.configdict["pkg"]["REPOSITORY"] = repo.name mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"]) mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"]) @@ -412,6 +414,9 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, mysettings["KV"] = "" mysettings.backup_changes("KV") + if mydo != "depend" and not eapi_exports_REPOSITORY(eapi): + mysettings.pop('REPOSITORY', None) + _doebuild_manifest_cache = None _doebuild_broken_ebuilds = set() _doebuild_broken_manifests = set() -- 2.26.2