From 5e19aa3468f551eb326fe8865269aedad1703384 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 19 Sep 2014 16:00:43 -0700 Subject: [PATCH] _quickpkg_dblink: fix bug #523152 This fixes the unmerge-backup and downgrade-backup features to be compatible with the new setup.py quickpkg install location, while preserving compatibility for running from a source tree (for unit tests or developement purposes). If not running from a source tree, then the PATH variable is used to locate the quickpkg binary. X-Gentoo-Bug: 523152 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523152 --- pym/portage/dbapi/vartree.py | 9 +++++++++ pym/portage/tests/emerge/test_simple.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 8bc6073..20b5911 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -25,6 +25,7 @@ portage.proxy.lazyimport.lazyimport(globals(), '_merge_unicode_error', '_spawn_phase', 'portage.package.ebuild.prepare_build_dirs:prepare_build_dirs', 'portage.package.ebuild._ipc.QueryCommand:QueryCommand', + 'portage.process:find_binary', 'portage.util:apply_secpass_permissions,ConfigProtect,ensure_dirs,' + \ 'writemsg,writemsg_level,write_atomic,atomic_ofstream,writedict,' + \ 'grabdict,normalize_path,new_protect_filename', @@ -5011,6 +5012,14 @@ class dblink(object): quickpkg_binary = os.path.join(self.settings["PORTAGE_BIN_PATH"], "quickpkg") + if not os.access(quickpkg_binary, os.EX_OK): + # If not running from the source tree, use PATH. + quickpkg_binary = find_binary("quickpkg") + if quickpkg_binary is None: + self._display_merge("quickpkg: command not found", + level=logging.ERROR, noiselevel=-1) + return 127 + # Let quickpkg inherit the global vartree config's env. env = dict(self.vartree.settings.items()) env["__PORTAGE_INHERIT_VARDB_LOCK"] = "1" diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py index 9c1b1bf..0bb83ae 100644 --- a/pym/portage/tests/emerge/test_simple.py +++ b/pym/portage/tests/emerge/test_simple.py @@ -243,6 +243,12 @@ pkg_preinst() { emerge_cmd + ("--metadata",), rm_cmd + ("-rf", cachedir), emerge_cmd + ("--oneshot", "virtual/foo"), + lambda: self.assertFalse(os.path.exists( + os.path.join(pkgdir, "virtual", "foo-0.tbz2"))), + ({"FEATURES" : "unmerge-backup"},) + \ + emerge_cmd + ("--unmerge", "virtual/foo"), + lambda: self.assertTrue(os.path.exists( + os.path.join(pkgdir, "virtual", "foo-0.tbz2"))), emerge_cmd + ("--pretend", "dev-libs/A"), ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"), emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"), @@ -395,6 +401,10 @@ move dev-util/git dev-vcs/git for args in test_commands: + if hasattr(args, '__call__'): + args() + continue + if isinstance(args[0], dict): local_env = env.copy() local_env.update(args[0]) -- 1.8.5.5