public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2011-09-05 22:36 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-09-05 22:36 UTC (permalink / raw
  To: gentoo-commits

commit:     41652a49cbd99ea129b36834faf5ba7508f3f617
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  5 22:35:02 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep  5 22:35:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=41652a49

tests/emerge: test egencache

This tests --update in any case, and --update-use-local-desc only if
python xml support is detected.

---
 bin/egencache                           |   11 +++-----
 pym/portage/tests/emerge/test_simple.py |   43 ++++++++++++++++++++++++------
 2 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 53ae565..bf29474 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -772,8 +772,6 @@ def egencache_main(args):
 	parser, options, atoms = parse_args(args)
 
 	config_root = options.config_root
-	if config_root is None:
-		config_root = '/'
 
 	# The calling environment is ignored, so the program is
 	# completely controlled by commandline arguments.
@@ -790,8 +788,10 @@ def egencache_main(args):
 	if options.portdir is not None:
 		env['PORTDIR'] = options.portdir
 
+	eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX")
+
 	settings = portage.config(config_root=config_root,
-		target_root='/', local_config=False, env=env)
+		local_config=False, env=env, _eprefix=eprefix)
 
 	default_opts = None
 	if not options.ignore_default_opts:
@@ -800,14 +800,11 @@ def egencache_main(args):
 	if default_opts:
 		parser, options, args = parse_args(default_opts + args)
 
-		if options.config_root is not None:
-			config_root = options.config_root
-
 		if options.cache_dir is not None:
 			env['PORTAGE_DEPCACHEDIR'] = options.cache_dir
 
 		settings = portage.config(config_root=config_root,
-			target_root='/', local_config=False, env=env)
+			local_config=False, env=env, _eprefix=eprefix)
 
 	if not options.update and not options.update_use_local_desc \
 			and not options.update_changelogs:

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 20cfa8f..3f7a3be 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -7,7 +7,7 @@ import sys
 import portage
 from portage import os
 from portage import _unicode_decode
-from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH
+from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, USER_CONFIG_PATH
 from portage.process import find_binary
 from portage.tests import TestCase
 from portage.tests.resolver.ResolverPlayground import ResolverPlayground
@@ -15,6 +15,14 @@ from portage.util import ensure_dirs
 
 class SimpleEmergeTestCase(TestCase):
 
+	def _have_python_xml(self):
+		try:
+			__import__("xml.etree.ElementTree")
+			__import__("xml.parsers.expat").parsers.expat.ExpatError
+		except (AttributeError, ImportError):
+			return False
+		return True
+
 	def testSimple(self):
 
 		debug = False
@@ -111,6 +119,8 @@ src_install() {
 		)
 
 		portage_python = portage._python_interpreter
+		egencache_cmd = (portage_python, "-Wd",
+			os.path.join(PORTAGE_BIN_PATH, "egencache"))
 		emerge_cmd = (portage_python, "-Wd",
 			os.path.join(PORTAGE_BIN_PATH, "emerge"))
 		emaint_cmd = (portage_python, "-Wd",
@@ -118,7 +128,12 @@ src_install() {
 		quickpkg_cmd = (portage_python, "-Wd",
 			os.path.join(PORTAGE_BIN_PATH, "quickpkg"))
 
+		egencache_extra_args = []
+		if self._have_python_xml():
+			egencache_extra_args.append("--update-use-local-desc")
+
 		test_commands = (
+			egencache_cmd + ("--update",) + tuple(egencache_extra_args),
 			emerge_cmd + ("--version",),
 			emerge_cmd + ("--info",),
 			emerge_cmd + ("--info", "--verbose"),
@@ -149,8 +164,21 @@ src_install() {
 		portage_tmpdir = os.path.join(eprefix, "var", "tmp", "portage")
 		portdir = settings["PORTDIR"]
 		profile_path = settings.profile_path
+		user_config_dir = os.path.join(os.sep, eprefix, USER_CONFIG_PATH)
 		var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
 
+		features = []
+		features.append("metadata-transfer")
+		if not portage.process.sandbox_capable:
+			features.append("-sandbox")
+
+		# Since egencache ignores settings from the calling environment,
+		# configure it via make.conf.
+		make_conf = (
+			"FEATURES=\"%s\"\n" % (" ".join(features),),
+			"PORTDIR=\"%s\"\n" % (portdir,),
+		)
+
 		path =  os.environ.get("PATH")
 		if path is not None and not path.strip():
 			path = None
@@ -188,17 +216,11 @@ src_install() {
 			"PORTAGE_PYTHON" : portage_python,
 			"PORTAGE_TMPDIR" : portage_tmpdir,
 			"PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
-			"PORTDIR" : portdir,
 			"PYTHONPATH" : pythonpath,
 		}
 
-		features = []
-		if not portage.process.sandbox_capable:
-			features.append("-sandbox")
-		if features:
-			env["FEATURES"] = " ".join(features)
-
-		dirs = [distdir, fake_bin, portage_tmpdir, var_cache_edb]
+		dirs = [distdir, fake_bin, portage_tmpdir,
+			user_config_dir, var_cache_edb]
 		true_symlinks = ["chown", "chgrp"]
 		true_binary = find_binary("true")
 		self.assertEqual(true_binary is None, False,
@@ -206,6 +228,9 @@ src_install() {
 		try:
 			for d in dirs:
 				ensure_dirs(d)
+			with open(os.path.join(user_config_dir, "make.conf"), 'w') as f:
+				for line in make_conf:
+					f.write(line)
 			for x in true_symlinks:
 				os.symlink(true_binary, os.path.join(fake_bin, x))
 			with open(os.path.join(var_cache_edb, "counter"), 'wb') as f:



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2011-09-07 17:50 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-09-07 17:50 UTC (permalink / raw
  To: gentoo-commits

commit:     5e1f136ba4c4f31dd5540594f48dc42f62ee09d9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  7 17:49:46 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep  7 17:49:46 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5e1f136b

egencache: remove metadata-transfer warning

It should be enough that the automatic use of metadata-transfer is
documented in the man page, and allows us to avoid showing a useless
warning in common usage scenarios.

---
 bin/egencache                           |    3 ---
 pym/portage/tests/emerge/test_simple.py |    1 -
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/bin/egencache b/bin/egencache
index 66854e1..6229ed6 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -816,9 +816,6 @@ def egencache_main(args):
 		return 1
 
 	if options.update and 'metadata-transfer' not in settings.features:
-		writemsg_level("ecachegen: warning: " + \
-			"automatically enabling FEATURES=metadata-transfer\n",
-			level=logging.WARNING, noiselevel=-1)
 		settings.features.add('metadata-transfer')
 
 	if options.update:

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index f3c9320..6810d05 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -190,7 +190,6 @@ src_install() {
 		var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
 
 		features = []
-		features.append("metadata-transfer")
 		if not portage.process.sandbox_capable:
 			features.append("-sandbox")
 



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2013-02-10 20:14 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2013-02-10 20:14 UTC (permalink / raw
  To: gentoo-commits

commit:     b9e0ee1bff068c7a161890294c259f6a04b4315a
Author:     Christoph Junghans <ottxor <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 10 19:42:52 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Feb 10 20:13:39 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b9e0ee1b

Avoid using gawk, where generic awk is enough

---
 bin/misc-functions.sh                   |    4 ++--
 pym/portage/tests/emerge/test_simple.py |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index ddd9179..f23545e 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -432,7 +432,7 @@ install_qa_check() {
 		# Check for shared libraries lacking SONAMEs
 		qa_var="QA_SONAME_${ARCH/-/_}"
 		eval "[[ -n \${!qa_var} ]] && QA_SONAME=(\"\${${qa_var}[@]}\")"
-		f=$(scanelf -ByF '%S %p' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
+		f=$(scanelf -ByF '%S %p' "${ED}"{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
 		if [[ -n ${f} ]] ; then
 			echo "${f}" > "${T}"/scanelf-missing-SONAME.log
 			if [[ "${QA_STRICT_SONAME-unset}" == unset ]] ; then
@@ -466,7 +466,7 @@ install_qa_check() {
 		# Check for shared libraries lacking NEEDED entries
 		qa_var="QA_DT_NEEDED_${ARCH/-/_}"
 		eval "[[ -n \${!qa_var} ]] && QA_DT_NEEDED=(\"\${${qa_var}[@]}\")"
-		f=$(scanelf -ByF '%n %p' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
+		f=$(scanelf -ByF '%n %p' "${ED}"{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:")
 		if [[ -n ${f} ]] ; then
 			echo "${f}" > "${T}"/scanelf-missing-NEEDED.log
 			if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 282a045..5c0d821 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -316,7 +316,7 @@ pkg_preinst() {
 		# Override things that may be unavailable, or may have portability
 		# issues when running tests in exotic environments.
 		#   prepstrip - bug #447810 (bash read builtin EINTR problem)
-		true_symlinks = ["find", "gawk", "prepstrip", "sed", "scanelf"]
+		true_symlinks = ["find", "prepstrip", "sed", "scanelf"]
 		true_binary = find_binary("true")
 		self.assertEqual(true_binary is None, False,
 			"true command not found")


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2013-03-21  0:38 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2013-03-21  0:38 UTC (permalink / raw
  To: gentoo-commits

commit:     72e7055e0f48b96dad4c6b44ee2ce711a23cad7d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 21 00:38:28 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 21 00:38:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=72e7055e

Test portageq and etc-update for bug #462412.

---
 bin/etc-update                          |    4 ++--
 pym/portage/tests/emerge/test_simple.py |    8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/bin/etc-update b/bin/etc-update
index 347ba1a..1a99231 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -620,7 +620,7 @@ while [[ -n $1 ]] ; do
 done
 ${SET_X} && set -x
 
-type portageq >/dev/null || die "missing portageq"
+type -P portageq >/dev/null || die "missing portageq"
 portage_vars=(
 	CONFIG_PROTECT{,_MASK}
 	PORTAGE_CONFIGROOT
@@ -630,7 +630,7 @@ portage_vars=(
 	USERLAND
 	NOCOLOR
 )
-eval $(portageq envvar -v ${portage_vars[@]})
+eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "$(type -P portageq)" envvar -v ${portage_vars[@]})
 export PORTAGE_TMPDIR
 SCAN_PATHS=${*:-${CONFIG_PROTECT}}
 

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 5c0d821..fea8b73 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -7,7 +7,8 @@ import sys
 import portage
 from portage import os
 from portage import _unicode_decode
-from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, USER_CONFIG_PATH
+from portage.const import (BASH_BINARY,
+	PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, USER_CONFIG_PATH)
 from portage.process import find_binary
 from portage.tests import TestCase
 from portage.tests.resolver.ResolverPlayground import ResolverPlayground
@@ -175,6 +176,8 @@ pkg_preinst() {
 			os.path.join(PORTAGE_BIN_PATH, "emaint"))
 		env_update_cmd = (portage_python, "-Wd",
 			os.path.join(PORTAGE_BIN_PATH, "env-update"))
+		etc_update_cmd = (BASH_BINARY,
+			os.path.join(PORTAGE_BIN_PATH, "etc-update"))
 		fixpackages_cmd = (portage_python, "-Wd",
 			os.path.join(PORTAGE_BIN_PATH, "fixpackages"))
 		portageq_cmd = (portage_python, "-Wd",
@@ -198,6 +201,9 @@ pkg_preinst() {
 
 		test_commands = (
 			env_update_cmd,
+			portageq_cmd + ("envvar", "-v", "CONFIG_PROTECT", "EROOT",
+				"PORTAGE_CONFIGROOT", "PORTAGE_TMPDIR", "USERLAND"),
+			etc_update_cmd,
 			emerge_cmd + ("--version",),
 			emerge_cmd + ("--info",),
 			emerge_cmd + ("--info", "--verbose"),


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2014-11-14 17:29 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2014-11-14 17:29 UTC (permalink / raw
  To: gentoo-commits

commit:     3b08575233ecf1d3e6f31f959741a4826aeac4a9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 14 06:57:45 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 14 17:28:19 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3b085752

portageq: fix eroot parameter (bug #529200)

The portageq eroot parameter has been broken since commit
c9f6aa9f0151adb3c86706eaef1914cdbdcf2b6d, due to premature instantiation
of portage.settings (before the ROOT variable was set). Premature access
to the portage.settings attribute must be avoided by using other
available means to determine the EPREFIX.

Fixes: c9f6aa9f0151 ("Add cross-prefix support")
X-Gentoo-Bug: 529200
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=529200
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>

---
 bin/portageq                            |  9 ++++++++-
 pym/portage/tests/emerge/test_simple.py | 10 ++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/bin/portageq b/bin/portageq
index 009f116..ef565d1 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -1392,7 +1392,14 @@ def main(argv):
 			sys.stderr.write("Run portageq with --help for info\n")
 			sys.stderr.flush()
 			sys.exit(os.EX_USAGE)
-		eprefix = portage.settings["EPREFIX"]
+		# Calculate EPREFIX and ROOT that will be used to construct
+		# portage.settings later. It's tempting to use
+		# portage.settings["EPREFIX"] here, but that would force
+		# instantiation of portage.settings, which we don't want to do
+		# until after we've calculated ROOT (see bug #529200).
+		eprefix = os.environ.get("EPREFIX", portage.const.EPREFIX)
+		if eprefix:
+			eprefix = portage.util.normalize_path(eprefix)
 		eroot = portage.util.normalize_path(argv[2])
 
 		if eprefix:

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 6c20a07..0101362 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -217,6 +217,8 @@ pkg_preinst() {
 		self.assertFalse(test_ebuild is None)
 
 		cross_prefix = os.path.join(eprefix, "cross_prefix")
+		cross_root = os.path.join(eprefix, "cross_root")
+		cross_eroot = os.path.join(cross_root, eprefix.lstrip(os.sep))
 
 		test_commands = (
 			env_update_cmd,
@@ -318,6 +320,10 @@ pkg_preinst() {
 				portageq_cmd + ("has_version", cross_prefix, "dev-libs/A"),
 			({"EPREFIX" : cross_prefix},) + \
 				portageq_cmd + ("has_version", cross_prefix, "dev-libs/B"),
+
+			# Test ROOT support
+			({"ROOT": cross_root},) + emerge_cmd + ("dev-libs/B",),
+			portageq_cmd + ("has_version", cross_eroot, "dev-libs/B"),
 		)
 
 		distdir = playground.distdir
@@ -372,8 +378,8 @@ pkg_preinst() {
 				os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"]
 
 		updates_dir = os.path.join(test_repo_location, "profiles", "updates")
-		dirs = [cachedir, cachedir_pregen, cross_prefix, distdir, fake_bin,
-			portage_tmpdir, updates_dir,
+		dirs = [cachedir, cachedir_pregen, cross_eroot, cross_prefix,
+			distdir, fake_bin, portage_tmpdir, updates_dir,
 			user_config_dir, var_cache_edb]
 		etc_symlinks = ("dispatch-conf.conf", "etc-update.conf")
 		# Override things that may be unavailable, or may have portability


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2018-05-01 18:15 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2018-05-01 18:15 UTC (permalink / raw
  To: gentoo-commits

commit:     a0ac6e6727abec8d2482c95b1e84d8df24d78619
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May  1 18:14:07 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May  1 18:15:47 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a0ac6e67

phase-helpers.sh: fix best/has_version -b for cross-prefix

Fixes: 43b6be7423aa ("phase-helpers.sh: Implement -r|-d|-b options for best/has_version")

 bin/phase-helpers.sh                    |  2 +-
 pym/portage/tests/emerge/test_simple.py | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 59c19cf67..8b16d7d31 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -912,7 +912,7 @@ ___best_version_and_has_version_common() {
 				case ${root_arg} in
 					-r) root=${EROOT} ;;
 					-d) root=${ESYSROOT} ;;
-					-b) root=${BROOT:-/} ;;
+					-b) root=${BROOT:-/${PORTAGE_OVERRIDE_EPREFIX#/}} ;;
 				esac
 			else
 				case ${root_arg} in

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 17dcd548d..495e22297 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -119,11 +119,13 @@ pkg_preinst() {
 				"EAPI" : "7_pre1",
 				"KEYWORDS": "~x86",
 				"RDEPEND": "dev-libs/D[flag]",
+				"MISC_CONTENT": install_something,
 			},
 			"dev-libs/D-1": {
 				"EAPI" : "7_pre1",
 				"KEYWORDS": "~x86",
 				"IUSE" : "flag",
+				"MISC_CONTENT": install_something,
 			},
 			"virtual/foo-0": {
 				"EAPI" : "5",
@@ -326,6 +328,16 @@ pkg_preinst() {
 			portageq_cmd + ("match", eroot, "dev-libs/D[flag]"),
 
 			# Test cross-prefix usage, including chpathtool for binpkgs.
+			# EAPI 7
+			({"EPREFIX" : cross_prefix},) + \
+				emerge_cmd + ("dev-libs/C",),
+			({"EPREFIX" : cross_prefix},) + \
+				portageq_cmd + ("has_version", cross_prefix, "dev-libs/C"),
+			({"EPREFIX" : cross_prefix},) + \
+				portageq_cmd + ("has_version", cross_prefix, "dev-libs/D"),
+			({"ROOT": cross_root},) + emerge_cmd + ("dev-libs/D",),
+			portageq_cmd + ("has_version", cross_eroot, "dev-libs/D"),
+			# EAPI 5
 			({"EPREFIX" : cross_prefix},) + \
 				emerge_cmd + ("--usepkgonly", "dev-libs/A"),
 			({"EPREFIX" : cross_prefix},) + \


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/
@ 2018-05-01 23:50 Zac Medico
  0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2018-05-01 23:50 UTC (permalink / raw
  To: gentoo-commits

commit:     4bda6c546aab816e835f62b326db9c2215e182ac
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May  1 23:37:33 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May  1 23:49:44 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4bda6c54

Revert "phase-helpers.sh: fix best/has_version -b for cross-prefix"

This reverts commit a0ac6e6727abec8d2482c95b1e84d8df24d78619,
since BROOT is only supposed to be set in src_* phases.
Update SimpleEmergeTestCase to call best/has_version -b only
in src_install for EAPI 7.

Reported-by: James Le Cuirot <chewi <AT> gentoo.org>

 bin/phase-helpers.sh                    |  2 +-
 pym/portage/tests/emerge/test_simple.py | 23 ++++++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 8b16d7d31..59c19cf67 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -912,7 +912,7 @@ ___best_version_and_has_version_common() {
 				case ${root_arg} in
 					-r) root=${EROOT} ;;
 					-d) root=${ESYSROOT} ;;
-					-b) root=${BROOT:-/${PORTAGE_OVERRIDE_EPREFIX#/}} ;;
+					-b) root=${BROOT:-/} ;;
 				esac
 			else
 				case ${root_arg} in

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 204c23296..b1402ddd5 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -58,6 +58,8 @@ src_install() {
 	echo "blah blah blah" > "${T}"/latin-1-$(printf "\\xa9")-regular-file || die
 	doins "${T}"/latin-1-$(printf "\\xa9")-regular-file
 	dosym latin-1-$(printf "\\xa9")-regular-file ${latin_1_dir}/latin-1-$(printf "\\xa9")-symlink || die
+
+	call_has_and_best_version
 }
 
 pkg_config() {
@@ -69,14 +71,29 @@ pkg_info() {
 }
 
 pkg_preinst() {
+	if ! ___eapi_best_version_and_has_version_support_-b_-d_-r; then
+		# The BROOT variable is unset during pkg_* phases for EAPI 7,
+		# therefore best/has_version -b is expected to fail if we attempt
+		# to call it for EAPI 7 here.
+		call_has_and_best_version
+	fi
+}
+
+call_has_and_best_version() {
 	local root_arg
 	if ___eapi_best_version_and_has_version_support_-b_-d_-r; then
 		root_arg="-b"
 	else
 		root_arg="--host-root"
 	fi
-	einfo "called pkg_preinst for $CATEGORY/$PF"
-
+	einfo "called ${EBUILD_PHASE_FUNC} for $CATEGORY/$PF"
+	einfo "EPREFIX=${EPREFIX}"
+	einfo "PORTAGE_OVERRIDE_EPREFIX=${PORTAGE_OVERRIDE_EPREFIX}"
+	einfo "ROOT=${ROOT}"
+	einfo "EROOT=${EROOT}"
+	einfo "SYSROOT=${SYSROOT}"
+	einfo "ESYSROOT=${ESYSROOT}"
+	einfo "BROOT=${BROOT}"
 	# Test that has_version and best_version work correctly with
 	# prefix (involves internal ROOT -> EROOT calculation in order
 	# to support ROOT override via the environment with EAPIs 3
@@ -90,7 +107,7 @@ pkg_preinst() {
 	if [[ ${EPREFIX} != ${PORTAGE_OVERRIDE_EPREFIX} ]] ; then
 		if has_version ${root_arg} $CATEGORY/$PN:$SLOT ; then
 			einfo "has_version ${root_arg} detects an installed instance of $CATEGORY/$PN:$SLOT"
-			einfo "best_version ${root_arg} reports that the installed instance is $(best_version $CATEGORY/$PN:$SLOT)"
+			einfo "best_version ${root_arg} reports that the installed instance is $(best_version ${root_arg} $CATEGORY/$PN:$SLOT)"
 		else
 			einfo "has_version ${root_arg} does not detect an installed instance of $CATEGORY/$PN:$SLOT"
 		fi


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-01 23:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01 23:50 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2018-05-01 18:15 Zac Medico
2014-11-14 17:29 Zac Medico
2013-03-21  0:38 Zac Medico
2013-02-10 20:14 Zac Medico
2011-09-07 17:50 Zac Medico
2011-09-05 22:36 Zac Medico

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