Tweak automatic --binpkg-respect-use behavior.
authorZac Medico <zmedico@gentoo.org>
Thu, 22 Sep 2011 03:03:03 +0000 (20:03 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 22 Sep 2011 03:03:03 +0000 (20:03 -0700)
If --binpkg-respect-use is not explicitly specified, we enable the
behavior automatically (like requested in bug #297549), as long as it
doesn't strongly conflict with other options that have been specified.
Strongly conflicting options currently include --usepkgonly and
--rebuilt-binaries.

pym/_emerge/create_depgraph_params.py
pym/_emerge/depgraph.py
pym/_emerge/main.py

index 221c440ef384a002c582387cffe93d1413b7aeac..d94ad89b324325a96eb617de81834e93023fe8d0 100644 (file)
@@ -64,6 +64,17 @@ def create_depgraph_params(myopts, myaction):
                '--update' in myopts:
                myparams['rebuilt_binaries'] = True
 
+       binpkg_respect_use = myopts.get('--binpkg-respect-use')
+       if binpkg_respect_use is not None:
+               myparams['binpkg_respect_use'] = binpkg_respect_use
+       elif '--usepkgonly' not in myopts and \
+               myopts.get('--rebuilt-binaries') is not True:
+               # If --binpkg-respect-use is not explicitly specified, we enable
+               # the behavior automatically (like requested in bug #297549), as
+               # long as it doesn't strongly conflict with other options that
+               # have been specified.
+               myparams['binpkg_respect_use'] = 'auto'
+
        if myopts.get("--selective") == "n":
                # --selective=n can be used to remove selective
                # behavior that may have been implied by some
index e8d96f4fe3df002b26d13bcecbb796990af10720..a4f6c3ddc14da4e2e8da075605a362cf601d6607 100644 (file)
@@ -552,7 +552,8 @@ class depgraph(object):
                """
                if not self._dynamic_config.ignored_binaries \
                        or '--quiet' in self._frozen_config.myopts \
-                       or "--binpkg-respect-use" in self._frozen_config.myopts:
+                       or self._dynamic_config.myparams.get(
+                       "binpkg_respect_use") in ("y", "n"):
                        return
 
                self._show_merge_list()
@@ -796,7 +797,8 @@ class depgraph(object):
                """Return a set of flags that trigger reinstallation, or None if there
                are no such flags."""
                if "--newuse" in self._frozen_config.myopts or \
-                       self._frozen_config.myopts.get("--binpkg-respect-use", True) == True:
+                       self._dynamic_config.myparams.get(
+                       "binpkg_respect_use") in ("y", "auto"):
                        flags = set(orig_iuse.symmetric_difference(
                                cur_iuse).difference(forced_flags))
                        flags.update(orig_iuse.intersection(orig_use).symmetric_difference(
@@ -3967,7 +3969,8 @@ class depgraph(object):
                                        if built and not useoldpkg and (not installed or matched_pkgs_ignore_use) and \
                                                ("--newuse" in self._frozen_config.myopts or \
                                                "--reinstall" in self._frozen_config.myopts or \
-                                               self._frozen_config.myopts.get("--binpkg-respect-use", True) == True):
+                                               (not installed and self._dynamic_config.myparams.get(
+                                               "binpkg_respect_use") in ("y", "auto"))):
                                                iuses = pkg.iuse.all
                                                old_use = self._pkg_use_enabled(pkg)
                                                if myeb:
index d2fc0ac5f7a08eb46ad078ea2afcf800d8372786..f4ea36c7b24abf752b9bcf4dd003ec3ee3344b40 100644 (file)
@@ -968,10 +968,11 @@ def parse_opts(tmpcmdline, silent=False):
        if myoptions.deselect in true_y:
                myoptions.deselect = True
 
-       if myoptions.binpkg_respect_use in true_y:
-               myoptions.binpkg_respect_use = True
-       else:
-               myoptions.binpkg_respect_use = None
+       if myoptions.binpkg_respect_use is not None:
+               if myoptions.binpkg_respect_use in true_y:
+                       myoptions.binpkg_respect_use = 'y'
+               else:
+                       myoptions.binpkg_respect_use = 'n'
 
        if myoptions.complete_graph in true_y:
                myoptions.complete_graph = True