public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/_config/, repoman/man/, pym/portage/package/ebuild/, ...
@ 2018-05-01 16:25 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2018-05-01 16:25 UTC (permalink / raw
  To: gentoo-commits

commit:     d8d47bf451bb3fd6bce1cdb035a5f12253f5a167
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 30 20:45:54 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May  1 08:28:43 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d8d47bf4

Export BROOT to ebuild env in EAPI 7

Export the BROOT variable corresponding to the location where BDEPEND
are installed.

Bug: https://bugs.gentoo.org/317337

 bin/eapi.sh                                                    |  4 ++++
 bin/ebuild.sh                                                  |  3 +++
 bin/phase-functions.sh                                         |  3 +++
 man/ebuild.5                                                   |  6 ++++++
 pym/portage/eapi.py                                            |  7 ++++++-
 pym/portage/package/ebuild/_config/LocationsManager.py         |  4 ++++
 pym/portage/package/ebuild/_config/special_env_vars.py         |  4 ++--
 pym/portage/package/ebuild/config.py                           | 10 +++++++++-
 repoman/cnf/qa_data/qa_data.yaml                               |  2 +-
 repoman/man/repoman.1                                          |  2 +-
 .../pym/repoman/modules/linechecks/assignment/assignment.py    |  9 ++++++++-
 repoman/pym/repoman/modules/linechecks/quotes/quotes.py        |  3 ++-
 12 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index b4d8c9a90..3f4c9691b 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -30,6 +30,10 @@ ___eapi_has_prefix_variables() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2)$ || " ${FEATURES} " == *" force-prefix "* ]]
 }
 
+___eapi_has_BROOT() {
+	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 ___eapi_has_SYSROOT() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
 }

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 11441bfb2..98ed570c2 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -769,6 +769,9 @@ else
 	if ___eapi_has_prefix_variables; then
 		declare -r ED EPREFIX EROOT
 	fi
+	if ___eapi_has_BROOT; then
+		declare -r BROOT
+	fi
 
 	# If ${EBUILD_FORCE_TEST} == 1 and USE came from ${T}/environment
 	# then it might not have USE=test like it's supposed to here.

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 1e096cddc..1f9faaa41 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -100,6 +100,9 @@ __filter_readonly_variables() {
 	filtered_vars="$readonly_bash_vars $bash_misc_vars
 		$PORTAGE_READONLY_VARS $misc_garbage_vars"
 
+	if ___eapi_has_BROOT; then
+		filtered_vars+=" BROOT"
+	fi
 	if ___eapi_has_SYSROOT; then
 		filtered_vars+=" SYSROOT"
 	fi

diff --git a/man/ebuild.5 b/man/ebuild.5
index eb27d43bb..9f491dd73 100644
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@ -527,6 +527,12 @@ Beginning with \fBEAPI 3\fR, contains
 "${ROOT%/}${EPREFIX}/" for convenience
 purposes. Do not modify this variable.
 .TP
+.B BROOT\fR = \fI"${EPREFIX}"
+Beginning with \fBEAPI 7\fR, the absolute path to the root directory
+containing build dependencies satisfied by BDEPEND, typically
+executable build tools. This includes any applicable offset prefix. Do
+not modify this variable.
+.TP
 .B DESCRIPTION\fR = \fI"A happy little package"
 Should contain a short description of the package.
 .TP

diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index f34e19ac9..158d58243 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -123,13 +123,17 @@ def eapi_path_variables_end_with_trailing_slash(eapi):
 	return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
 			"5", "5-progress", "6")
 
+def eapi_has_broot(eapi):
+	return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
+			"5", "5-progress", "5-hdepend", "6")
+
 def eapi_has_sysroot(eapi):
 	return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi",
 			"5", "5-progress", "5-hdepend", "6")
 
 _eapi_attrs = collections.namedtuple('_eapi_attrs',
 	'allows_package_provided '
-	'bdepend dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
+	'bdepend broot dots_in_PN dots_in_use_flags exports_EBUILD_PHASE_FUNC '
 	'exports_PORTDIR exports_ECLASSDIR '
 	'feature_flag_test feature_flag_targetroot '
 	'hdepend iuse_defaults iuse_effective posixish_locale '
@@ -159,6 +163,7 @@ def _get_eapi_attrs(eapi):
 	eapi_attrs = _eapi_attrs(
 		allows_package_provided=(eapi is None or eapi_allows_package_provided(eapi)),
 		bdepend = (eapi is not None and eapi_has_bdepend(eapi)),
+		broot = (eapi is None or eapi_has_broot(eapi)),
 		dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)),
 		dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)),
 		empty_groups_always_true = (eapi is not None and eapi_empty_groups_always_true(eapi)),

diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
index 3a2697145..b57443ba7 100644
--- a/pym/portage/package/ebuild/_config/LocationsManager.py
+++ b/pym/portage/package/ebuild/_config/LocationsManager.py
@@ -73,6 +73,10 @@ class LocationsManager(object):
 
 		self.esysroot = self.sysroot.rstrip(os.sep) + self.eprefix + os.sep
 
+		# TODO: Set this via the constructor using
+		# PORTAGE_OVERRIDE_EPREFIX.
+		self.broot = portage.const.EPREFIX
+
 	def load_profiles(self, repositories, known_repository_paths):
 		known_repository_paths = set(os.path.realpath(x)
 			for x in known_repository_paths)

diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py
index 68770e237..3323ff064 100644
--- a/pym/portage/package/ebuild/_config/special_env_vars.py
+++ b/pym/portage/package/ebuild/_config/special_env_vars.py
@@ -14,7 +14,7 @@ import re
 # to enter the config instance from the external environment or
 # configuration files.
 env_blacklist = frozenset((
-	"A", "AA", "BDEPEND", "CATEGORY", "DEPEND", "DESCRIPTION",
+	"A", "AA", "BDEPEND", "BROOT", "CATEGORY", "DEPEND", "DESCRIPTION",
 	"DOCS", "EAPI",
 	"EBUILD_FORCE_TEST", "EBUILD_PHASE",
 	"EBUILD_PHASE_FUNC", "EBUILD_SKIP_MANIFEST",
@@ -42,7 +42,7 @@ environ_whitelist = []
 # environment in order to prevent sandbox from sourcing /etc/profile
 # in it's bashrc (causing major leakage).
 environ_whitelist += [
-	"ACCEPT_LICENSE", "BASH_ENV", "BUILD_PREFIX", "COLUMNS", "D",
+	"ACCEPT_LICENSE", "BASH_ENV", "BROOT", "BUILD_PREFIX", "COLUMNS", "D",
 	"DISTDIR", "DOC_SYMLINKS_DIR", "EAPI", "EBUILD",
 	"EBUILD_FORCE_TEST",
 	"EBUILD_PHASE", "EBUILD_PHASE_FUNC", "ECLASSDIR", "ECLASS_DEPTH", "ED",

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index e7a047884..f9b257b86 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -346,6 +346,7 @@ class config(object):
 			config_root = locations_manager.config_root
 			sysroot = locations_manager.sysroot
 			esysroot = locations_manager.esysroot
+			broot = locations_manager.broot
 			abs_user_config = locations_manager.abs_user_config
 			make_conf_paths = [
 				os.path.join(config_root, 'etc', 'make.conf'),
@@ -509,6 +510,7 @@ class config(object):
 			self["EPREFIX"] = eprefix
 			self["EROOT"] = eroot
 			self["ESYSROOT"] = esysroot
+			self["BROOT"] = broot
 			known_repos = []
 			portdir = ""
 			portdir_overlay = ""
@@ -680,6 +682,8 @@ class config(object):
 			self.backup_changes("EROOT")
 			self["ESYSROOT"] = esysroot
 			self.backup_changes("ESYSROOT")
+			self["BROOT"] = broot
+			self.backup_changes("BROOT")
 
 			# The prefix of the running portage instance is used in the
 			# ebuild environment to implement the --host-root option for
@@ -2758,6 +2762,9 @@ class config(object):
 		if not (src_phase and eapi_attrs.sysroot):
 			mydict.pop("ESYSROOT", None)
 
+		if not (src_phase and eapi_attrs.broot):
+			mydict.pop("BROOT", None)
+
 		# Prefix variables are supported beginning with EAPI 3, or when
 		# force-prefix is in FEATURES, since older EAPIs would otherwise be
 		# useless with prefix configurations. This brings compatibility with
@@ -2806,7 +2813,8 @@ class config(object):
 			mydict.pop("ECLASSDIR", None)
 
 		if not eapi_attrs.path_variables_end_with_trailing_slash:
-			for v in ("D", "ED", "ROOT", "EROOT", "SYSROOT", "ESYSROOT"):
+			for v in ("D", "ED", "ROOT", "EROOT", "SYSROOT", "ESYSROOT",
+					"BROOT"):
 				if v in mydict:
 					mydict[v] = mydict[v].rstrip(os.path.sep)
 

diff --git a/repoman/cnf/qa_data/qa_data.yaml b/repoman/cnf/qa_data/qa_data.yaml
index 573cdb449..32994e013 100644
--- a/repoman/cnf/qa_data/qa_data.yaml
+++ b/repoman/cnf/qa_data/qa_data.yaml
@@ -128,7 +128,7 @@ qahelp:
     variable:
         invalidchar: "A variable contains an invalid character that is not part of the ASCII character set"
         readonly: "Assigning a readonly variable"
-        usedwithhelpers: "Ebuild uses D, ROOT, ED, EROOT or EPREFIX with helpers"
+        usedwithhelpers: "Ebuild uses D, ROOT, BROOT, ED, EROOT or EPREFIX with helpers"
     virtual:
         suspect: "Ebuild contains a package that usually should be pulled via virtual/, not directly."
     wxwidgets:

diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
index c87146b61..01f37dd99 100644
--- a/repoman/man/repoman.1
+++ b/repoman/man/repoman.1
@@ -432,7 +432,7 @@ character set.
 Assigning a readonly variable
 .TP
 .B variable.usedwithhelpers
-Ebuild uses D, ROOT, ED, EROOT or EPREFIX with helpers
+Ebuild uses D, ROOT, BROOT, ED, EROOT or EPREFIX with helpers
 .TP
 .B virtual.suspect
 Ebuild contains a package that usually should be pulled via virtual/,

diff --git a/repoman/pym/repoman/modules/linechecks/assignment/assignment.py b/repoman/pym/repoman/modules/linechecks/assignment/assignment.py
index 496c9d092..33bef8a08 100644
--- a/repoman/pym/repoman/modules/linechecks/assignment/assignment.py
+++ b/repoman/pym/repoman/modules/linechecks/assignment/assignment.py
@@ -1,7 +1,7 @@
 
 import re
 
-from portage.eapi import eapi_supports_prefix
+from portage.eapi import eapi_supports_prefix, eapi_has_broot
 from repoman.modules.linechecks.base import LineCheck
 
 
@@ -29,3 +29,10 @@ class Eapi3EbuildAssignment(EbuildAssignment):
 	def check_eapi(self, eapi):
 		return eapi_supports_prefix(eapi)
 
+class Eapi7EbuildAssignment(EbuildAssignment):
+	"""Ensure ebuilds don't assign to readonly EAPI 7-introduced variables."""
+
+	readonly_assignment = re.compile(r'\s*(export\s+)?BROOT=')
+
+	def check_eapi(self, eapi):
+		return eapi_has_broot(eapi)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
index 68c594e23..e5ea4d0ca 100644
--- a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -17,7 +17,8 @@ class EbuildQuote(LineCheck):
 		r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
 		r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
 	ignore_comment = False
-	var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+	var_names = [
+                "D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "BROOT", "WORKDIR"]
 
 	# EAPI=3/Prefix vars
 	var_names += ["ED", "EPREFIX", "EROOT"]


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-01 16:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01 16:25 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/_config/, repoman/man/, pym/portage/package/ebuild/, Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox