aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-10-31 22:19:02 -0700
committerZac Medico <zmedico@gentoo.org>2020-11-01 14:25:27 -0800
commit15ac405fecf3e52ffd93d9a34e472bdc18604a4f (patch)
tree9e72c24ea50fbc1ac639ede2140dd8b0c65ccafb /lib/_emerge
parentpid-sandbox: Forward SIGTSTP and SIGCONT (bug 704498) (diff)
downloadportage-15ac405fecf3e52ffd93d9a34e472bdc18604a4f.tar.gz
portage-15ac405fecf3e52ffd93d9a34e472bdc18604a4f.tar.bz2
portage-15ac405fecf3e52ffd93d9a34e472bdc18604a4f.zip
emerge: add --quickpkg-direct-root option
Specify the root to use as the --quickpkg-direct package source. This root is assumed to be immutable during the entire emerge operation. The default is set to "/". Bug: https://bugs.gentoo.org/752066 Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge')
-rw-r--r--lib/_emerge/actions.py19
-rw-r--r--lib/_emerge/depgraph.py11
-rw-r--r--lib/_emerge/main.py5
3 files changed, 30 insertions, 5 deletions
diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index 5e8a46957..239bf6f47 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -49,7 +49,7 @@ from portage.package.ebuild._ipc.QueryCommand import QueryCommand
from portage.package.ebuild.fetch import _hide_url_passwd
from portage._sets import load_default_config, SETPREFIX
from portage._sets.base import InternalPackageSet
-from portage.util import cmp_sort_key, writemsg, varexpand, \
+from portage.util import cmp_sort_key, normalize_path, writemsg, varexpand, \
writemsg_level, writemsg_stdout
from portage.util.digraph import digraph
from portage.util.SlotObject import SlotObject
@@ -106,13 +106,26 @@ def action_build(emerge_config, trees=DeprecationWarning,
# before we get here, so warn if they're not (bug #267103).
chk_updated_cfg_files(settings['EROOT'], ['/etc/portage'])
+ quickpkg_root = normalize_path(os.path.abspath(
+ emerge_config.opts.get('--quickpkg-direct-root',
+ emerge_config.running_config.settings['ROOT']))).rstrip(os.path.sep) + os.path.sep
quickpkg_direct = ("--usepkg" in emerge_config.opts and
emerge_config.opts.get('--quickpkg-direct', 'n') == 'y' and
- emerge_config.target_config is not emerge_config.running_config)
+ emerge_config.target_config.settings['ROOT'] != quickpkg_root)
if '--getbinpkg' in emerge_config.opts or quickpkg_direct:
kwargs = {}
if quickpkg_direct:
- kwargs['add_repos'] = (emerge_config.running_config.trees['vartree'].dbapi,)
+ if quickpkg_root == emerge_config.running_config.settings['ROOT']:
+ quickpkg_vardb = emerge_config.running_config.trees['vartree'].dbapi
+ else:
+ quickpkg_settings = portage.config(
+ config_root=emerge_config.target_config.settings['PORTAGE_CONFIGROOT'],
+ target_root=quickpkg_root,
+ env=emerge_config.target_config.settings.backupenv.copy(),
+ sysroot=emerge_config.target_config.settings['SYSROOT'],
+ eprefix=emerge_config.target_config.settings['EPREFIX'])
+ quickpkg_vardb = portage.vartree(settings=quickpkg_settings).dbapi
+ kwargs['add_repos'] = (quickpkg_vardb,)
try:
emerge_config.target_config.trees['bintree'].populate(
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 0bb0352e7..6aaacfe44 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -41,7 +41,7 @@ from portage._sets import SETPREFIX
from portage._sets.base import InternalPackageSet
from portage.util import ConfigProtect, shlex_split, new_protect_filename
from portage.util import cmp_sort_key, writemsg, writemsg_stdout
-from portage.util import ensure_dirs
+from portage.util import ensure_dirs, normalize_path
from portage.util import writemsg_level, write_atomic
from portage.util.digraph import digraph
from portage.util.futures import asyncio
@@ -4567,8 +4567,15 @@ class depgraph:
self._dynamic_config._skip_restart = True
return False, myfavorites
+ # Since --quickpkg-direct assumes that --quickpkg-direct-root is
+ # immutable, assert that there are no merge or unmerge tasks
+ # for --quickpkg-direct-root.
+ quickpkg_root = normalize_path(os.path.abspath(
+ self._frozen_config.myopts.get('--quickpkg-direct-root',
+ self._frozen_config._running_root.settings['ROOT']))).rstrip(os.path.sep) + os.path.sep
if (self._frozen_config.myopts.get('--quickpkg-direct', 'n') == 'y' and
- self._frozen_config.target_root is not self._frozen_config._running_root):
+ self._frozen_config.settings['ROOT'] != quickpkg_root and
+ self._frozen_config._running_root.settings['ROOT'] == quickpkg_root):
running_root = self._frozen_config._running_root.root
for node in self._dynamic_config.digraph:
if (isinstance(node, Package) and node.operation in ('merge', 'uninstall') and
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
index 5075f7f57..0ac25ea36 100644
--- a/lib/_emerge/main.py
+++ b/lib/_emerge/main.py
@@ -645,6 +645,11 @@ def parse_opts(tmpcmdline, silent=False):
"choices": y_or_n
},
+ "--quickpkg-direct-root": {
+ "help": "Specify the root to use as the --quickpkg-direct package source",
+ "action" : "store"
+ },
+
"--quiet": {
"shortopt" : "-q",
"help" : "reduced or condensed output",