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/
Date: Mon, 14 May 2012 00:08:32 +0000 (UTC)	[thread overview]
Message-ID: <1336954097.d76df09c56687a58581dc279d4f6e37a95acfb9b.zmedico@gentoo> (raw)

commit:     d76df09c56687a58581dc279d4f6e37a95acfb9b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May 14 00:08:17 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 14 00:08:17 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d76df09c

dep_check: use _pkg_str + vercmp, not pkgcmp

---
 pym/portage/dep/dep_check.py |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 0866673..99a5eb0 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']
@@ -11,7 +11,7 @@ from portage.dep import Atom, match_from_list, use_reduce
 from portage.exception import InvalidDependString, ParseError
 from portage.localization import _
 from portage.util import writemsg, writemsg_level
-from portage.versions import catpkgsplit, cpv_getkey, pkgcmp
+from portage.versions import vercmp, _pkg_str
 
 def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
 	trees=None, use_mask=None, use_force=None, **kwargs):
@@ -39,14 +39,12 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
 	parent = mytrees.get("parent")
 	virt_parent = mytrees.get("virt_parent")
 	graph_parent = None
-	eapi = None
 	if parent is not None:
 		if virt_parent is not None:
 			graph_parent = virt_parent
 			parent = virt_parent
 		else:
 			graph_parent = parent
-		eapi = parent.metadata["EAPI"]
 	repoman = not mysettings.local_config
 	if kwargs["use_binaries"]:
 		portdb = trees[myroot]["bintree"].dbapi
@@ -352,8 +350,14 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
 			avail_pkg = mydbapi.match(atom.without_use)
 			if avail_pkg:
 				avail_pkg = avail_pkg[-1] # highest (ascending order)
-				avail_slot = Atom("%s:%s" % (atom.cp,
-					mydbapi.aux_get(avail_pkg, ["SLOT"])[0]))
+				try:
+					slot = avail_pkg.slot
+				except AttributeError:
+					eapi, slot, repo = mydbapi.aux_get(avail_pkg,
+						["EAPI", "SLOT", "repository"])
+					avail_pkg = _pkg_str(avail_pkg, eapi=eapi,
+						slot=slot, repo=repo)
+				avail_slot = Atom("%s:%s" % (atom.cp, slot))
 			if not avail_pkg:
 				all_available = False
 				all_use_satisfied = False
@@ -368,16 +372,19 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
 					avail_pkg_use = avail_pkg_use[-1]
 					if avail_pkg_use != avail_pkg:
 						avail_pkg = avail_pkg_use
-						avail_slot = Atom("%s:%s" % (atom.cp,
-							mydbapi.aux_get(avail_pkg, ["SLOT"])[0]))
+						try:
+							slot = avail_pkg.slot
+						except AttributeError:
+							eapi, slot, repo = mydbapi.aux_get(avail_pkg,
+								["EAPI", "SLOT", "repository"])
+							avail_pkg = _pkg_str(avail_pkg,
+								eapi=eapi, slot=slot, repo=repo)
 
 			slot_map[avail_slot] = avail_pkg
-			pkg_cp = cpv_getkey(avail_pkg)
-			highest_cpv = cp_map.get(pkg_cp)
+			highest_cpv = cp_map.get(avail_pkg.cp)
 			if highest_cpv is None or \
-				pkgcmp(catpkgsplit(avail_pkg)[1:],
-				catpkgsplit(highest_cpv)[1:]) > 0:
-				cp_map[pkg_cp] = avail_pkg
+				vercmp(avail_pkg.version, highest_cpv.version) > 0:
+				cp_map[avail_pkg.cp] = avail_pkg
 
 		this_choice = (atoms, slot_map, cp_map, all_available)
 		if all_available:
@@ -515,8 +522,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
 				for cp in intersecting_cps:
 					version_1 = cp_map_1[cp]
 					version_2 = cp_map_2[cp]
-					difference = pkgcmp(catpkgsplit(version_1)[1:],
-						catpkgsplit(version_2)[1:])
+					difference = vercmp(version_1.version, version_2.version)
 					if difference != 0:
 						if difference > 0:
 							has_upgrade = True



             reply	other threads:[~2012-05-14  0:08 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14  0:08 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
2016-11-22 17:11 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-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=1336954097.d76df09c56687a58581dc279d4f6e37a95acfb9b.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