From a77292d37e3c2604479514abed2dda64dabace25 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 20 Jan 2012 12:29:31 -0800 Subject: Fix --changed-use interaction with bug 297549. The automatic --binpkg-respect-use code (from bug #297549) was inappropriately overriding --changed-use and triggering behavior like --newuse, as reported here: http://archives.gentoo.org/gentoo-dev/msg_6070ab87737d7e16a5cec2a72c9111fd.xml --- pym/_emerge/depgraph.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 0c9e5f2ad..6d0ba1ca2 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -827,20 +827,28 @@ class depgraph(object): else: self._dynamic_config._slot_conflict_parent_atoms.add(parent_atom) - def _reinstall_for_flags(self, forced_flags, + def _reinstall_for_flags(self, pkg, forced_flags, orig_use, orig_iuse, cur_use, cur_iuse): """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._dynamic_config.myparams.get( - "binpkg_respect_use") in ("y", "auto"): + + # binpkg_respect_use: Behave like newuse by default. If newuse is + # False and changed_use is True, then behave like changed_use. + binpkg_respect_use = (pkg.built and + self._dynamic_config.myparams.get("binpkg_respect_use") + in ("y", "auto")) + newuse = "--newuse" in self._frozen_config.myopts + changed_use = "changed-use" == self._frozen_config.myopts.get("--reinstall") + + if newuse or (binpkg_respect_use and not changed_use): flags = set(orig_iuse.symmetric_difference( cur_iuse).difference(forced_flags)) flags.update(orig_iuse.intersection(orig_use).symmetric_difference( cur_iuse.intersection(cur_use))) if flags: return flags - elif "changed-use" == self._frozen_config.myopts.get("--reinstall"): + + elif changed_use or binpkg_respect_use: flags = orig_iuse.intersection(orig_use).symmetric_difference( cur_iuse.intersection(cur_use)) if flags: @@ -4039,8 +4047,8 @@ class depgraph(object): cur_iuse = iuses if myeb and not usepkgonly and not useoldpkg: cur_iuse = myeb.iuse.all - reinstall_for_flags = self._reinstall_for_flags(forced_flags, - old_use, iuses, now_use, cur_iuse) + reinstall_for_flags = self._reinstall_for_flags(pkg, + forced_flags, old_use, iuses, now_use, cur_iuse) if reinstall_for_flags: if not pkg.installed: self._dynamic_config.ignored_binaries.setdefault(pkg, set()).update(reinstall_for_flags) @@ -4060,7 +4068,7 @@ class depgraph(object): cur_use = self._pkg_use_enabled(pkg) cur_iuse = pkg.iuse.all reinstall_for_flags = \ - self._reinstall_for_flags( + self._reinstall_for_flags(pkg, forced_flags, old_use, old_iuse, cur_use, cur_iuse) if reinstall_for_flags: -- cgit v1.2.3-1-g7c22