1 |
This fixes the unmerge-backup and downgrade-backup features to be |
2 |
compatible with the new setup.py quickpkg install location, while |
3 |
preserving compatibility for running from a source tree (for unit tests |
4 |
or development purposes). If not running from a source tree, then the |
5 |
PATH variable is used to locate the quickpkg binary. |
6 |
|
7 |
X-Gentoo-Bug: 523152 |
8 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523152 |
9 |
--- |
10 |
pym/portage/dbapi/vartree.py | 10 ++++++++++ |
11 |
pym/portage/tests/emerge/test_simple.py | 10 ++++++++++ |
12 |
2 files changed, 20 insertions(+) |
13 |
|
14 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
15 |
index 8bc6073..b46ba0b 100644 |
16 |
--- a/pym/portage/dbapi/vartree.py |
17 |
+++ b/pym/portage/dbapi/vartree.py |
18 |
@@ -25,6 +25,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
19 |
'_merge_unicode_error', '_spawn_phase', |
20 |
'portage.package.ebuild.prepare_build_dirs:prepare_build_dirs', |
21 |
'portage.package.ebuild._ipc.QueryCommand:QueryCommand', |
22 |
+ 'portage.process:find_binary', |
23 |
'portage.util:apply_secpass_permissions,ConfigProtect,ensure_dirs,' + \ |
24 |
'writemsg,writemsg_level,write_atomic,atomic_ofstream,writedict,' + \ |
25 |
'grabdict,normalize_path,new_protect_filename', |
26 |
@@ -5011,6 +5012,15 @@ class dblink(object): |
27 |
quickpkg_binary = os.path.join(self.settings["PORTAGE_BIN_PATH"], |
28 |
"quickpkg") |
29 |
|
30 |
+ if not os.access(quickpkg_binary, os.X_OK): |
31 |
+ # If not running from the source tree, use PATH. |
32 |
+ quickpkg_binary = find_binary("quickpkg") |
33 |
+ if quickpkg_binary is None: |
34 |
+ self._display_merge( |
35 |
+ _("%s: command not found") % "quickpkg", |
36 |
+ level=logging.ERROR, noiselevel=-1) |
37 |
+ return 127 |
38 |
+ |
39 |
# Let quickpkg inherit the global vartree config's env. |
40 |
env = dict(self.vartree.settings.items()) |
41 |
env["__PORTAGE_INHERIT_VARDB_LOCK"] = "1" |
42 |
diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py |
43 |
index 9c1b1bf..0bb83ae 100644 |
44 |
--- a/pym/portage/tests/emerge/test_simple.py |
45 |
+++ b/pym/portage/tests/emerge/test_simple.py |
46 |
@@ -243,6 +243,12 @@ pkg_preinst() { |
47 |
emerge_cmd + ("--metadata",), |
48 |
rm_cmd + ("-rf", cachedir), |
49 |
emerge_cmd + ("--oneshot", "virtual/foo"), |
50 |
+ lambda: self.assertFalse(os.path.exists( |
51 |
+ os.path.join(pkgdir, "virtual", "foo-0.tbz2"))), |
52 |
+ ({"FEATURES" : "unmerge-backup"},) + \ |
53 |
+ emerge_cmd + ("--unmerge", "virtual/foo"), |
54 |
+ lambda: self.assertTrue(os.path.exists( |
55 |
+ os.path.join(pkgdir, "virtual", "foo-0.tbz2"))), |
56 |
emerge_cmd + ("--pretend", "dev-libs/A"), |
57 |
ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"), |
58 |
emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"), |
59 |
@@ -395,6 +401,10 @@ move dev-util/git dev-vcs/git |
60 |
|
61 |
for args in test_commands: |
62 |
|
63 |
+ if hasattr(args, '__call__'): |
64 |
+ args() |
65 |
+ continue |
66 |
+ |
67 |
if isinstance(args[0], dict): |
68 |
local_env = env.copy() |
69 |
local_env.update(args[0]) |
70 |
-- |
71 |
1.8.5.5 |