public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/_emerge/
Date: Thu, 28 Aug 2014 16:07:32 +0000 (UTC)	[thread overview]
Message-ID: <1409241762.617a64f77055ddda1dd86a506cf98f5adc545fae.zmedico@gentoo> (raw)

commit:     617a64f77055ddda1dd86a506cf98f5adc545fae
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 00:07:10 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 16:02:42 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=617a64f7

dep_check: fix bug #515230

This fixes dep_check so that graph packages do not mask non-graph
packages (in the same slot) unless the graph packages also match the
dependency atom being satisfied. This requires logic changes in both
_dep_check_composite_db._visible and dep_zapdeps.

Also, fix _dep_check_composite_db match / _cpv_pkg_map
interactions to ensure correct match results.

X-Gentoo-Bug: 515230
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=515230

---
 pym/_emerge/depgraph.py      | 30 +++++++++++++++++++-----------
 pym/portage/dep/dep_check.py | 10 +++++-----
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index a10297a..845a43a 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -8259,18 +8259,20 @@ class _dep_check_composite_db(dbapi):
 
 		return ret
 
-	def match(self, atom):
+	def match_pkgs(self, atom):
 		cache_key = (atom, atom.unevaluated_atom)
 		ret = self._match_cache.get(cache_key)
 		if ret is not None:
+			for pkg in ret:
+				self._cpv_pkg_map[pkg.cpv] = pkg
 			return ret[:]
 
+		atom_set = InternalPackageSet(initial_atoms=(atom,))
 		ret = []
 		pkg, existing = self._depgraph._select_package(self._root, atom)
 
-		if pkg is not None and self._visible(pkg):
-			self._cpv_pkg_map[pkg.cpv] = pkg
-			ret.append(pkg.cpv)
+		if pkg is not None and self._visible(pkg, atom_set):
+			ret.append(pkg)
 
 		if pkg is not None and \
 			atom.slot is None and \
@@ -8301,18 +8303,19 @@ class _dep_check_composite_db(dbapi):
 					self._root, slot_atom)
 				if not pkg:
 					continue
-				if not self._visible(pkg):
+				if not self._visible(pkg, atom_set):
 					continue
-				self._cpv_pkg_map[pkg.cpv] = pkg
-				ret.append(pkg.cpv)
+				ret.append(pkg)
 
 			if len(ret) > 1:
-				self._cpv_sort_ascending(ret)
+				ret.sort()
 
 		self._match_cache[cache_key] = ret
+		for pkg in ret:
+			self._cpv_pkg_map[pkg.cpv] = pkg
 		return ret[:]
 
-	def _visible(self, pkg):
+	def _visible(self, pkg, atom_set):
 		if pkg.installed and not self._depgraph._want_installed_pkg(pkg):
 			return False
 		if pkg.installed and \
@@ -8350,6 +8353,11 @@ class _dep_check_composite_db(dbapi):
 		elif in_graph != pkg:
 			# Mask choices for packages that would trigger a slot
 			# conflict with a previously selected package.
+			if not atom_set.findAtomForPackage(in_graph,
+				modified_use=self._depgraph._pkg_use_enabled(in_graph)):
+				# Only mask if the graph package matches the given
+				# atom (fixes bug #515230).
+				return True
 			return False
 		return True
 
@@ -8357,8 +8365,8 @@ class _dep_check_composite_db(dbapi):
 		metadata = self._cpv_pkg_map[cpv]._metadata
 		return [metadata.get(x, "") for x in wants]
 
-	def match_pkgs(self, atom):
-		return [self._cpv_pkg_map[cpv] for cpv in self.match(atom)]
+	def match(self, atom):
+		return [pkg.cpv for pkg in self.match_pkgs(atom)]
 
 def ambiguous_package_name(arg, atoms, root_config, spinner, myopts):
 

diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index b79c5bc..22eed96 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -414,16 +414,16 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
 						unsat_use_non_installed.append(this_choice)
 			else:
 				all_in_graph = True
-				for slot_atom in slot_map:
+				for atom in atoms:
 					# New-style virtuals have zero cost to install.
-					if slot_atom.startswith("virtual/"):
+					if atom.blocker or atom.cp.startswith("virtual/"):
 						continue
 					# We check if the matched package has actually been
 					# added to the digraph, in order to distinguish between
 					# those packages and installed packages that may need
 					# to be uninstalled in order to resolve blockers.
-					graph_matches = graph_db.match_pkgs(slot_atom)
-					if not graph_matches or graph_matches[-1] not in graph:
+					if not any(pkg in graph for pkg in
+						graph_db.match_pkgs(atom)):
 						all_in_graph = False
 						break
 				circular_atom = None


             reply	other threads:[~2014-08-28 16:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28 16:07 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-09  0:27 [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/_emerge/ Zac Medico
2012-06-08 22:08 Zac Medico
2012-05-12 23:27 Zac Medico
2011-05-31  2:18 Zac Medico
2011-02-13  7:39 Zac Medico
2011-02-13  1:54 Zac Medico
2011-02-12  0:16 Zac Medico

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=1409241762.617a64f77055ddda1dd86a506cf98f5adc545fae.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