1 |
Specify the root to use as the --quickpkg-direct package source. This |
2 |
root is assumed to be immutable during the entire emerge operation. |
3 |
The default is set to "/". |
4 |
|
5 |
Bug: https://bugs.gentoo.org/752066 |
6 |
Signed-off-by: Zac Medico <zmedico@g.o> |
7 |
--- |
8 |
lib/_emerge/actions.py | 19 ++++++++++++++++--- |
9 |
lib/_emerge/depgraph.py | 11 +++++++++-- |
10 |
lib/_emerge/main.py | 5 +++++ |
11 |
lib/portage/tests/emerge/test_simple.py | 3 ++- |
12 |
man/emerge.1 | 10 ++++++++-- |
13 |
5 files changed, 40 insertions(+), 8 deletions(-) |
14 |
|
15 |
diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py |
16 |
index 5e8a46957..2e155899c 100644 |
17 |
--- a/lib/_emerge/actions.py |
18 |
+++ b/lib/_emerge/actions.py |
19 |
@@ -49,7 +49,7 @@ from portage.package.ebuild._ipc.QueryCommand import QueryCommand |
20 |
from portage.package.ebuild.fetch import _hide_url_passwd |
21 |
from portage._sets import load_default_config, SETPREFIX |
22 |
from portage._sets.base import InternalPackageSet |
23 |
-from portage.util import cmp_sort_key, writemsg, varexpand, \ |
24 |
+from portage.util import cmp_sort_key, normalize_path, writemsg, varexpand, \ |
25 |
writemsg_level, writemsg_stdout |
26 |
from portage.util.digraph import digraph |
27 |
from portage.util.SlotObject import SlotObject |
28 |
@@ -106,13 +106,26 @@ def action_build(emerge_config, trees=DeprecationWarning, |
29 |
# before we get here, so warn if they're not (bug #267103). |
30 |
chk_updated_cfg_files(settings['EROOT'], ['/etc/portage']) |
31 |
|
32 |
+ quickpkg_root = normalize_path(os.path.abspath( |
33 |
+ emerge_config.opts.get('--quickpkg-direct-root', |
34 |
+ emerge_config.running_config.settings['ROOT']))).rstrip(os.path.sep) + os.path.sep |
35 |
quickpkg_direct = ("--usepkg" in emerge_config.opts and |
36 |
emerge_config.opts.get('--quickpkg-direct', 'n') == 'y' and |
37 |
- emerge_config.target_config is not emerge_config.running_config) |
38 |
+ emerge_config.target_config.settings['ROOT'] != quickpkg_root) |
39 |
if '--getbinpkg' in emerge_config.opts or quickpkg_direct: |
40 |
kwargs = {} |
41 |
if quickpkg_direct: |
42 |
- kwargs['add_repos'] = (emerge_config.running_config.trees['vartree'].dbapi,) |
43 |
+ if quickpkg_root == emerge_config.running_config.root: |
44 |
+ quickpkg_vardb = emerge_config.running_config.trees['vartree'].dbapi |
45 |
+ else: |
46 |
+ quickpkg_settings = portage.config( |
47 |
+ config_root=emerge_config.target_config.settings['PORTAGE_CONFIGROOT'], |
48 |
+ target_root=quickpkg_root, |
49 |
+ env=emerge_config.target_config.settings.backupenv, |
50 |
+ sysroot=emerge_config.target_config.settings['SYSROOT'], |
51 |
+ eprefix=emerge_config.target_config.settings['EPREFIX']) |
52 |
+ quickpkg_vardb = portage.vartree(settings=quickpkg_settings).dbapi |
53 |
+ kwargs['add_repos'] = (quickpkg_vardb,) |
54 |
|
55 |
try: |
56 |
emerge_config.target_config.trees['bintree'].populate( |
57 |
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py |
58 |
index 0bb0352e7..898cf6c1a 100644 |
59 |
--- a/lib/_emerge/depgraph.py |
60 |
+++ b/lib/_emerge/depgraph.py |
61 |
@@ -41,7 +41,7 @@ from portage._sets import SETPREFIX |
62 |
from portage._sets.base import InternalPackageSet |
63 |
from portage.util import ConfigProtect, shlex_split, new_protect_filename |
64 |
from portage.util import cmp_sort_key, writemsg, writemsg_stdout |
65 |
-from portage.util import ensure_dirs |
66 |
+from portage.util import ensure_dirs, normalize_path |
67 |
from portage.util import writemsg_level, write_atomic |
68 |
from portage.util.digraph import digraph |
69 |
from portage.util.futures import asyncio |
70 |
@@ -4567,8 +4567,15 @@ class depgraph: |
71 |
self._dynamic_config._skip_restart = True |
72 |
return False, myfavorites |
73 |
|
74 |
+ # Since --quickpkg-direct assumes that --quickpkg-direct-root is |
75 |
+ # immutable, assert that there are no merged or unmerge tasks |
76 |
+ # for --quickpkg-direct-root. |
77 |
+ quickpkg_root = normalize_path(os.path.abspath( |
78 |
+ self._frozen_config.myopts.get('--quickpkg-direct-root', |
79 |
+ self._frozen_config._running_root.settings['ROOT']))).rstrip(os.path.sep) + os.path.sep |
80 |
if (self._frozen_config.myopts.get('--quickpkg-direct', 'n') == 'y' and |
81 |
- self._frozen_config.target_root is not self._frozen_config._running_root): |
82 |
+ self._frozen_config.settings['ROOT'] != quickpkg_root and |
83 |
+ self._frozen_config._running_root.settings['ROOT'] == quickpkg_root): |
84 |
running_root = self._frozen_config._running_root.root |
85 |
for node in self._dynamic_config.digraph: |
86 |
if (isinstance(node, Package) and node.operation in ('merge', 'uninstall') and |
87 |
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py |
88 |
index 5075f7f57..0ac25ea36 100644 |
89 |
--- a/lib/_emerge/main.py |
90 |
+++ b/lib/_emerge/main.py |
91 |
@@ -645,6 +645,11 @@ def parse_opts(tmpcmdline, silent=False): |
92 |
"choices": y_or_n |
93 |
}, |
94 |
|
95 |
+ "--quickpkg-direct-root": { |
96 |
+ "help": "Specify the root to use as the --quickpkg-direct package source", |
97 |
+ "action" : "store" |
98 |
+ }, |
99 |
+ |
100 |
"--quiet": { |
101 |
"shortopt" : "-q", |
102 |
"help" : "reduced or condensed output", |
103 |
diff --git a/lib/portage/tests/emerge/test_simple.py b/lib/portage/tests/emerge/test_simple.py |
104 |
index 8ba74c609..1638fcb66 100644 |
105 |
--- a/lib/portage/tests/emerge/test_simple.py |
106 |
+++ b/lib/portage/tests/emerge/test_simple.py |
107 |
@@ -292,7 +292,8 @@ call_has_and_best_version() { |
108 |
path=binhost_remote_path) |
109 |
|
110 |
test_commands = ( |
111 |
- emerge_cmd + ("--usepkgonly", "--root", cross_root, "--quickpkg-direct=y", "dev-libs/A"), |
112 |
+ emerge_cmd + ("--usepkgonly", "--root", cross_root, "--quickpkg-direct=y", "--quickpkg-direct-root", "/", "dev-libs/A"), |
113 |
+ emerge_cmd + ("--usepkgonly", "--quickpkg-direct=y", "--quickpkg-direct-root", cross_root, "dev-libs/A"), |
114 |
env_update_cmd, |
115 |
portageq_cmd + ("envvar", "-v", "CONFIG_PROTECT", "EROOT", |
116 |
"PORTAGE_CONFIGROOT", "PORTAGE_TMPDIR", "USERLAND"), |
117 |
diff --git a/man/emerge.1 b/man/emerge.1 |
118 |
index c1bcd0220..1a2a3fd3d 100644 |
119 |
--- a/man/emerge.1 |
120 |
+++ b/man/emerge.1 |
121 |
@@ -1,4 +1,4 @@ |
122 |
-.TH "EMERGE" "1" "Nov 2019" "Portage VERSION" "Portage" |
123 |
+.TH "EMERGE" "1" "Nov 2020" "Portage VERSION" "Portage" |
124 |
.SH "NAME" |
125 |
emerge \- Command\-line interface to the Portage system |
126 |
.SH "SYNOPSIS" |
127 |
@@ -844,7 +844,8 @@ b blocked by another package (automatically resolved conflict) |
128 |
Enable use of installed packages directly as binary packages. This is |
129 |
similar to using binary packages produced by \fBquickpkg\fR(1), but |
130 |
installed packages are used directly as though they are binary packages. |
131 |
-This option only works in combination with the \fB\-\-root=DIR\fR option, |
132 |
+If \fB\-\-quickpkg\-direct\-root=DIR\fR is not also set to something |
133 |
+other than "/", then \fB\-\-root=DIR\fR must be used, |
134 |
and it comes with the caveat that packages are only allowed to be |
135 |
installed into the root that is specified by the \fB\-\-root=DIR\fR |
136 |
option (the other root which serves as a source of packages is |
137 |
@@ -857,6 +858,11 @@ quickpkg options are \fI\-\-include\-config\fR and |
138 |
man page). When a configuration file is not included because it is |
139 |
protected, an ewarn message is logged. |
140 |
.TP |
141 |
+.BR \-\-quickpkg\-direct\-root=DIR |
142 |
+Specify the root to use as the \fB\-\-quickpkg\-direct\fR package source. |
143 |
+This root is assumed to be immutable during the entire emerge operation. |
144 |
+The default is set to "/". |
145 |
+.TP |
146 |
.BR "\-\-quiet [ y | n ]" ", " \-q |
147 |
Results may vary, but the general outcome is a reduced or condensed |
148 |
output from portage's displays. |
149 |
-- |
150 |
2.26.2 |