From 68288994493ee3ab56d0baf24ec3d0449330ccf5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 10 Oct 2012 12:12:18 -0700 Subject: [PATCH] Atom: support *_beta* wildcard, bug #437872 --- man/portage.5 | 4 +++- pym/portage/dep/__init__.py | 4 ++-- pym/portage/tests/dep/testAtom.py | 6 +++++- pym/portage/tests/dep/test_best_match_to_list.py | 6 +++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index 705d0d943..12938e200 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -1,4 +1,4 @@ -.TH "PORTAGE" "5" "Sep 2012" "Portage VERSION" "Portage" +.TH "PORTAGE" "5" "Oct 2012" "Portage VERSION" "Portage" .SH NAME portage \- the heart of Gentoo .SH "DESCRIPTION" @@ -173,6 +173,8 @@ next to each other. # match anything with a version containing 9999, which can be used in # package.mask to prevent emerge --autounmask from selecting live ebuilds =*/*-*9999* +# match anything with a version containing _beta +=*/*-*_beta* # match anything from the 'sys\-apps' category sys\-apps/* # match packages named 'zlib' from any category diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 6e030047c..b1a46b8aa 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -143,7 +143,7 @@ def _get_atom_wildcard_re(eapi_attrs): atom_re = re.compile(r'((?P(' + _extended_cat + r')/(' + pkg_re + r'))' + \ - '|(?P=((' + _extended_cat + r')/(' + pkg_re + r'))-(?P\*\d+\*)))' + \ + '|(?P=((' + _extended_cat + r')/(' + pkg_re + r'))-(?P\*\w+\*)))' + \ '(:(?P' + _slot_loose + r'))?(' + _repo_separator + r'(?P' + _repo_name + r'))?$', re.UNICODE) @@ -2134,7 +2134,7 @@ def match_from_list(mydep, candidate_list): candidate_list = mylist mylist = [] - # Currently, only \*\d+\* is supported. + # Currently, only \*\w+\* is supported. ver = mydep.version[1:-1] for x in candidate_list: diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py index 094538dab..948166d8e 100644 --- a/pym/portage/tests/dep/testAtom.py +++ b/pym/portage/tests/dep/testAtom.py @@ -1,4 +1,4 @@ -# Copyright 2006, 2010 Gentoo Foundation +# Copyright 2006-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -24,6 +24,10 @@ class TestAtom(TestCase): ('=*', '*/*', '*9999*', None, None, None), True, False ), ( "=*/*-*9999*:0::repo_name", ('=*', '*/*', '*9999*', '0', None, 'repo_name'), True, True ), + ( "=*/*-*_beta*", + ('=*', '*/*', '*_beta*', None, None, None), True, False ), + ( "=*/*-*_beta*:0::repo_name", + ('=*', '*/*', '*_beta*', '0', None, 'repo_name'), True, True ), ( "sys-apps/*", (None, 'sys-apps/*', None, None, None, None), True, False ), ( "*/portage", diff --git a/pym/portage/tests/dep/test_best_match_to_list.py b/pym/portage/tests/dep/test_best_match_to_list.py index 8a1403828..0ea834238 100644 --- a/pym/portage/tests/dep/test_best_match_to_list.py +++ b/pym/portage/tests/dep/test_best_match_to_list.py @@ -1,5 +1,5 @@ # test_best_match_to_list.py -- Portage Unit Testing Functionality -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from itertools import permutations @@ -40,6 +40,10 @@ class Test_best_match_to_list(TestCase): [Atom("=dev-libs/A-1:0"), Atom("dev-libs/*", allow_wildcard=True)], True), ("dev-libs/A-4.9999-r1", [Atom("dev-libs/*", allow_wildcard=True), Atom("=*/*-*9999*", allow_wildcard=True)], \ [Atom("=*/*-*9999*", allow_wildcard=True), Atom("dev-libs/*", allow_wildcard=True)], True), + ("dev-libs/A-4_beta-r1", [Atom("dev-libs/*", allow_wildcard=True), Atom("=*/*-*_beta*", allow_wildcard=True)], \ + [Atom("=*/*-*_beta*", allow_wildcard=True), Atom("dev-libs/*", allow_wildcard=True)], True), + ("dev-libs/A-4_beta1-r1", [Atom("dev-libs/*", allow_wildcard=True), Atom("=*/*-*_beta*", allow_wildcard=True)], \ + [Atom("=*/*-*_beta*", allow_wildcard=True), Atom("dev-libs/*", allow_wildcard=True)], True), ("dev-libs/A-1:0", [Atom("dev-*/*", allow_wildcard=True), Atom("dev-*/*:0", allow_wildcard=True),\ Atom("dev-libs/A"), Atom("<=dev-libs/A-2"), Atom("dev-libs/A:0"), \ Atom("=dev-libs/A-1*"), Atom("~dev-libs/A-1"), Atom("=dev-libs/A-1")], \ -- 2.26.2