From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 38E3C138A1A for ; Fri, 14 Nov 2014 17:29:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BB445E0950; Fri, 14 Nov 2014 17:29:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5AE41E0950 for ; Fri, 14 Nov 2014 17:29:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 073283404DE for ; Fri, 14 Nov 2014 17:29:25 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A4EC4A22B for ; Fri, 14 Nov 2014 17:29:23 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1415986099.3b08575233ecf1d3e6f31f959741a4826aeac4a9.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/portageq pym/portage/tests/emerge/test_simple.py X-VCS-Directories: pym/portage/tests/emerge/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 3b08575233ecf1d3e6f31f959741a4826aeac4a9 X-VCS-Branch: master Date: Fri, 14 Nov 2014 17:29:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b1b2281c-0e07-4602-bf9d-517ebc976bc8 X-Archives-Hash: 2abeea948da003313e77b44dc8a16560 commit: 3b08575233ecf1d3e6f31f959741a4826aeac4a9 Author: Zac Medico gentoo org> AuthorDate: Fri Nov 14 06:57:45 2014 +0000 Commit: Zac Medico gentoo 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 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