From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8B93F1381F3 for ; Sun, 9 Jun 2013 00:23:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 73679E0839; Sun, 9 Jun 2013 00:23:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E3C99E0839 for ; Sun, 9 Jun 2013 00:23:09 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BDAF933E286 for ; Sun, 9 Jun 2013 00:23:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 593D9E468F for ; Sun, 9 Jun 2013 00:23:06 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1370737370.889e19d27ac978dbbc9699bac152657675569ebd.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/portage/tests/dep/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dep/__init__.py pym/portage/tests/dep/test_match_from_list.py X-VCS-Directories: pym/portage/dep/ pym/portage/tests/dep/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 889e19d27ac978dbbc9699bac152657675569ebd X-VCS-Branch: master Date: Sun, 9 Jun 2013 00:23:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 916389d4-3b98-4e94-a4c0-a2fcf40e77ea X-Archives-Hash: f4ee5e0005f27e6684abc05d1c64b9e5 commit: 889e19d27ac978dbbc9699bac152657675569ebd Author: Zac Medico gentoo org> AuthorDate: Sun Jun 9 00:22:50 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Jun 9 00:22:50 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=889e19d2 match_from_list: =* op with revision, bug #467826 --- pym/portage/dep/__init__.py | 32 ++++++++++++++++++++++----- pym/portage/tests/dep/test_match_from_list.py | 7 +++++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 7776f89..798903f 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -2164,15 +2164,37 @@ def match_from_list(mydep, candidate_list): myver = mycpv_cps[2].lstrip("0") if not myver or not myver[0].isdigit(): myver = "0"+myver - mycpv_cmp = mycpv_cps[0] + "/" + mycpv_cps[1] + "-" + myver + if myver == mycpv_cps[2]: + mycpv_cmp = mycpv + else: + # Use replace to preserve the revision part if it exists + # (mycpv_cps[3] can't be trusted because in contains r0 + # even when the input has no revision part). + mycpv_cmp = mycpv.replace( + mydep.cp + "-" + mycpv_cps[2], + mydep.cp + "-" + myver, 1) for x in candidate_list: - xs = getattr(x, "cpv_split", None) - if xs is None: - xs = catpkgsplit(remove_slot(x)) + try: + x.cp + except AttributeError: + try: + pkg = _pkg_str(remove_slot(x)) + except InvalidData: + continue + else: + pkg = x + + xs = pkg.cpv_split myver = xs[2].lstrip("0") if not myver or not myver[0].isdigit(): myver = "0"+myver - xcpv = xs[0]+"/"+xs[1]+"-"+myver + if myver == xs[2]: + xcpv = pkg.cpv + else: + # Use replace to preserve the revision part if it exists. + xcpv = pkg.cpv.replace( + pkg.cp + "-" + xs[2], + pkg.cp + "-" + myver, 1) if xcpv.startswith(mycpv_cmp): mylist.append(x) diff --git a/pym/portage/tests/dep/test_match_from_list.py b/pym/portage/tests/dep/test_match_from_list.py index b648624..8a1c9e2 100644 --- a/pym/portage/tests/dep/test_match_from_list.py +++ b/pym/portage/tests/dep/test_match_from_list.py @@ -1,4 +1,4 @@ -# Copyright 2006-2012 Gentoo Foundation +# Copyright 2006-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import sys @@ -71,6 +71,11 @@ class Test_match_from_list(TestCase): (">sys-apps/portage-047", ["sys-apps/portage-046-r1"], []), ("sys-apps/portage:0", [Package("=sys-apps/portage-045:0")], ["sys-apps/portage-045"]), ("sys-apps/portage:0", [Package("=sys-apps/portage-045:1")], []), + ("=cat/pkg-1-r1*", ["cat/pkg-1_alpha1"], []), + ("=cat/pkg-1-r1*", ["cat/pkg-1-r11"], ["cat/pkg-1-r11"]), + ("=cat/pkg-1-r1*", ["cat/pkg-01-r11"], ["cat/pkg-01-r11"]), + ("=cat/pkg-01-r1*", ["cat/pkg-1-r11"], ["cat/pkg-1-r11"]), + ("=cat/pkg-01-r1*", ["cat/pkg-001-r11"], ["cat/pkg-001-r11"]), ("=sys-fs/udev-1*", ["sys-fs/udev-123"], ["sys-fs/udev-123"]), ("=sys-fs/udev-4*", ["sys-fs/udev-456"], ["sys-fs/udev-456"]), ("*/*", ["sys-fs/udev-456"], ["sys-fs/udev-456"]),