Gentoo Archives: gentoo-commits

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