summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/depgraph.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-05 02:45:29 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-05 02:45:29 -0700
commit03a201256ab9a8557862e30732ecc9b7de19a885 (patch)
tree041008b57f7776399ca5aee338760b72b0c605cb /pym/_emerge/depgraph.py
parentf27e8b3aa5e5feec5095ee199f04b61367841979 (diff)
downloadportage-03a201256ab9a8557862e30732ecc9b7de19a885.tar.gz
portage-03a201256ab9a8557862e30732ecc9b7de19a885.tar.bz2
portage-03a201256ab9a8557862e30732ecc9b7de19a885.zip
* Add a --autounmask[=n] option and for now leave it disable
by default in order to minimize the impact of any bugs. * If _wrapped_select_pkg_highest_available_imp returns an installed package when the user has not explicitly requested for this package to be replaced (typically via an atom on the command line), reject the installed package and try to unmask one.
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r--pym/_emerge/depgraph.py37
1 files changed, 31 insertions, 6 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 056c7bdb5..05c108592 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2483,15 +2483,40 @@ class depgraph(object):
self._dynamic_config._visible_pkgs[pkg.root].cpv_inject(pkg)
return ret
+ def _want_installed_pkg(self, pkg):
+ """
+ Given an installed package returned from select_pkg, return
+ True if the user has not explicitly requested for this package
+ to be replaced (typically via an atom on the command line).
+ """
+ if "selective" not in self._dynamic_config.myparams and \
+ pkg.root == self._frozen_config.target_root:
+ try:
+ next(self._iter_atoms_for_pkg(pkg))
+ except StopIteration:
+ pass
+ except portage.exception.InvalidDependString:
+ pass
+ else:
+ return False
+ return True
+
def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False):
pkg, existing = self._wrapped_select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps)
- if pkg is None:
- pkg, existing = self._wrapped_select_pkg_highest_available_imp(root, atom, \
- onlydeps=onlydeps, allow_missing_keywords=True)
-
- if pkg is not None and not pkg.visible:
- self._dynamic_config._needed_user_config_changes.setdefault(pkg, set()).add("unstable keyword")
+ if self._frozen_config.myopts.get('--autounmask', 'n') is True:
+ if pkg is not None and \
+ pkg.installed and \
+ not self._want_installed_pkg(pkg):
+ pkg = None
+ if pkg is None:
+ pkg, existing = \
+ self._wrapped_select_pkg_highest_available_imp(
+ root, atom, onlydeps=onlydeps,
+ allow_missing_keywords=True)
+
+ if pkg is not None and not pkg.visible:
+ self._dynamic_config._needed_user_config_changes.setdefault(pkg, set()).add("unstable keyword")
return pkg, existing