From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
Date: Tue, 22 Nov 2016 17:11:27 +0000 (UTC) [thread overview]
Message-ID: <1479833528.d7af27b4166f9ce693203bfc92d9bf44d3db081c.zmedico@gentoo> (raw)
commit: d7af27b4166f9ce693203bfc92d9bf44d3db081c
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 20 23:13:14 2016 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 22 16:52:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d7af27b4
dep_zapdeps: make package selections internally consistent (bug 600346)
When selecting packages to determine which choices have upgrades
or downgrades relative to other choices, make the package selections
internally consistent by choosing a package that satisfies all atoms
in the choice which match a package in the same slot.
Also, fix the Atom.match() method to handle _pkg_str instances,
since dep_zapdeps can pass in _pkg_str instances instead of Package
instances.
X-Gentoo-Bug: 600346
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=600346
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/portage/dep/__init__.py | 16 ++++++++++++----
pym/portage/dep/dep_check.py | 28 ++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 5dd1638..968ff5b 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1603,10 +1603,18 @@ class Atom(_unicode):
if pkg.cp == self.cp:
return bool(match_from_list(self, [pkg]))
else:
- for provided_cp in pkg.provided_cps:
- if provided_cp == self.cp:
- return bool(match_from_list(
- self.replace(self.cp, provided_cp, 1), [pkg]))
+ try:
+ provided_cps = pkg.provided_cps
+ except AttributeError:
+ # Since _pkg_str instances lack PROVIDE metadata,
+ # just ignore this case (PROVIDE has been deprecated
+ # for years).
+ pass
+ else:
+ for provided_cp in provided_cps:
+ if provided_cp == self.cp:
+ return bool(match_from_list(
+ self.replace(self.cp, provided_cp, 1), [pkg]))
return False
_extended_cp_re_cache = {}
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 9d2ca4b..737d2b1 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
__all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']
+import collections
import logging
import operator
@@ -354,6 +355,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
all_use_satisfied = True
all_use_unmasked = True
conflict_downgrade = False
+ slot_atoms = collections.defaultdict(list)
slot_map = {}
cp_map = {}
for atom in atoms:
@@ -418,9 +420,31 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_slot = Atom("%s:%s" % (atom.cp, avail_pkg.slot))
slot_map[avail_slot] = avail_pkg
+ slot_atoms[avail_slot].append(atom)
highest_cpv = cp_map.get(avail_pkg.cp)
- if highest_cpv is None or \
- vercmp(avail_pkg.version, highest_cpv.version) > 0:
+ all_match_current = None
+ all_match_previous = None
+ if (highest_cpv is not None and
+ highest_cpv.slot == avail_pkg.slot):
+ # If possible, make the package selection internally
+ # consistent by choosing a package that satisfies all
+ # atoms which match a package in the same slot. Later on,
+ # the package version chosen here is used in the
+ # has_upgrade/has_downgrade logic to prefer choices with
+ # upgrades, and a package choice that is not internally
+ # consistent will lead the has_upgrade/has_downgrade logic
+ # to produce invalid results (see bug 600346).
+ all_match_current = all(a.match(avail_pkg)
+ for a in slot_atoms[avail_slot])
+ all_match_previous = all(a.match(highest_cpv)
+ for a in slot_atoms[avail_slot])
+ if all_match_previous and not all_match_current:
+ continue
+
+ current_higher = (highest_cpv is None or
+ vercmp(avail_pkg.version, highest_cpv.version) > 0)
+
+ if current_higher or (all_match_current and not all_match_previous):
cp_map[avail_pkg.cp] = avail_pkg
this_choice = _dep_choice(atoms=atoms, slot_map=slot_map,
next reply other threads:[~2016-11-22 17:11 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 17:11 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-07-02 15:34 [gentoo-commits] proj/portage:master commit in: pym/portage/dep/ Brian Dolbec
2017-03-08 19:30 Zac Medico
2015-02-24 17:41 Zac Medico
2014-08-28 8:59 Michał Górny
2014-03-30 19:00 Sebastian Luther
2013-08-22 4:15 Zac Medico
2013-07-30 5:48 Zac Medico
2013-06-10 0:50 Zac Medico
2012-12-11 9:42 Arfrever Frehtes Taifersar Arahesis
2012-11-25 11:03 Arfrever Frehtes Taifersar Arahesis
2012-11-14 19:55 Zac Medico
2012-10-14 19:21 Zac Medico
2012-09-27 16:58 Zac Medico
2012-09-26 3:31 Zac Medico
2012-09-14 6:00 Zac Medico
2012-07-02 23:11 Zac Medico
2012-07-02 20:28 Zac Medico
2012-06-25 21:28 Zac Medico
2012-06-20 7:00 Zac Medico
2012-06-10 23:18 Zac Medico
2012-06-10 22:43 Zac Medico
2012-06-10 22:37 Zac Medico
2012-06-10 22:20 Zac Medico
2012-06-10 22:16 Zac Medico
2012-06-10 21:51 Zac Medico
2012-06-10 21:08 Zac Medico
2012-06-10 20:48 Zac Medico
2012-05-30 0:47 Arfrever Frehtes Taifersar Arahesis
2012-05-14 6:54 Zac Medico
2012-05-14 0:08 Zac Medico
2012-05-13 20:37 Zac Medico
2012-05-13 20:22 Zac Medico
2012-05-13 9:31 Zac Medico
2012-04-22 21:41 Zac Medico
2012-01-10 18:41 Zac Medico
2011-10-05 19:58 Zac Medico
2011-09-23 1:55 Zac Medico
2011-09-23 0:48 Zac Medico
2011-09-10 14:31 Zac Medico
2011-06-23 10:56 Arfrever Frehtes Taifersar Arahesis
2011-06-08 19:05 Zac Medico
2011-04-11 22:30 Zac Medico
2011-03-17 18:44 Zac Medico
2011-02-19 22:55 Zac Medico
2011-02-08 18:57 Zac Medico
2011-02-08 0:43 Zac Medico
2011-02-07 22:20 Zac Medico
2011-02-07 11:45 Zac Medico
2011-02-07 11:19 Zac Medico
2011-02-05 0:27 Zac Medico
2011-02-04 23:04 Zac Medico
2011-02-04 6:29 zmedico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479833528.d7af27b4166f9ce693203bfc92d9bf44d3db081c.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox