diff options
authorZac Medico <zmedico@gentoo.org>2019-11-24 21:08:14 -0800
committerZac Medico <zmedico@gentoo.org>2019-11-26 19:19:20 -0800
commit8faad11a18fcc33329931a75002f293e8fa462eb (patch)
tree3c21750fa5a368c7840228a25c85097645c98c7a /lib/_emerge/depgraph.py
parentman/emerge.1: fix \fB typo (diff)
emerge: add --quickpkg-direct option
Enable use of installed packages directly as binary packages. This is similar to using binary packages produced by quickpkg(1), but installed packages are used directly as though they are binary packages. This option only works in combination with the --root=DIR option, and it comes with the caveat that packages are only allowed to be installed into the root that is specified by the --root=DIR option. The other root which serves as a source of packages is assumed to be immutable during the entire operation (similar to --buildpkgonly mode). Default behavior for handling of protected configuration files is controlled by the QUICKPKG_DEFAULT_OPTS variable. When a configuration file is not included because it is protected, an ewarn message is logged. Suggested use cases: * Install packages from a buildtime container into an empty root, in order to create a minimal runtime container (which need not include a package manager). In a multi-stage Dockerfile, install runtime files to an empty directory in the build stage, and in the final stage use COPY to populate a container with the contents of that directory. For greater efficiency, use buildah to install directly into a mounted container, avoiding the COPY step. Use the emerge --usepkgonly and --ignore-soname-deps=n options to account for soname dependencies, allowing implicit system dependencies such as glibc to be automatically pulled into the runtime image. * Enable a live usb, iso, or pxe image to act as a binary installer that uses packages installed in the live image as a source of binary packages. Bug: https://bugs.gentoo.org/699986 Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge/depgraph.py')
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 1127a6234..6d8e73172 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -495,6 +495,7 @@ class _dynamic_depgraph_config(object):
self._backtrack_infos = {}
self._buildpkgonly_deps_unsatisfied = False
+ self._quickpkg_direct_deps_unsatisfied = False
self._autounmask = self.myparams['autounmask']
self._displayed_autounmask = False
self._success_without_autounmask = False
@@ -4526,6 +4527,16 @@ class depgraph(object):
self._dynamic_config._skip_restart = True
return False, myfavorites
+ if (self._frozen_config.myopts.get('--quickpkg-direct', 'n') == 'y' and
+ self._frozen_config.target_root is not self._frozen_config._running_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
+ node.root == running_root):
+ self._dynamic_config._quickpkg_direct_deps_unsatisfied = True
+ self._dynamic_config._skip_restart = True
+ return False, myfavorites
if (not self._dynamic_config._prune_rebuilds and
config = self._dynamic_config._backtrack_infos.setdefault("config", {})
@@ -9062,6 +9073,14 @@ class depgraph(object):
writemsg("!!! Cannot merge requested packages. "
"Merge deps and try again.\n\n", noiselevel=-1)
+ if self._dynamic_config._quickpkg_direct_deps_unsatisfied:
+ self._show_merge_list()
+ writemsg("\n!!! --quickpkg-direct requires all "
+ "dependencies to be merged for root '{}'.\n".format(
+ self._frozen_config._running_root.root), noiselevel=-1)
+ writemsg("!!! Cannot merge requested packages. "
+ "Merge deps and try again.\n\n", noiselevel=-1)
def saveNomergeFavorites(self):
"""Find atoms in favorites that are not in the mergelist and add them
to the world file if necessary."""