public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: man/, pym/portage/dep/, pym/portage/tests/dep/
@ 2011-02-07 22:07 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2011-02-07 22:07 UTC (permalink / raw
  To: gentoo-commits

commit:     22d47a3a8f54ee2f337b0b7fa5d02e6cacae1ecb
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  7 22:06:56 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb  7 22:06:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=22d47a3a

Update dates in headers.

---
 man/ebuild.5                               |    2 +-
 pym/portage/dep/dep_check.py               |    2 +-
 pym/portage/tests/dep/test_paren_reduce.py |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/ebuild.5 b/man/ebuild.5
index 5aecefd..dd6a31b 100644
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@ -1,4 +1,4 @@
-.TH "EBUILD" "5" "Sep 2010" "Portage VERSION" "Portage"
+.TH "EBUILD" "5" "Feb 2011" "Portage VERSION" "Portage"
 .SH "NAME"
 ebuild \- the internal format, variables, and functions in an ebuild script
 .SH "DESCRIPTION"

diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index da9b4e5..60896c0 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps']

diff --git a/pym/portage/tests/dep/test_paren_reduce.py b/pym/portage/tests/dep/test_paren_reduce.py
index a7bbf97..9a147a0 100644
--- a/pym/portage/tests/dep/test_paren_reduce.py
+++ b/pym/portage/tests/dep/test_paren_reduce.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.tests import TestCase



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: man/, pym/portage/dep/, pym/portage/tests/dep/
@ 2012-07-18 19:55 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2012-07-18 19:55 UTC (permalink / raw
  To: gentoo-commits

commit:     3e84557b91b43ea6924bbab8a3d477509513cac8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 18 19:55:16 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jul 18 19:55:16 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e84557b

Support =*/*-*9999* wildcard atom, bug #402197.

---
 man/portage.5                                    |    3 +
 pym/portage/dep/__init__.py                      |   75 +++++++++++++++++----
 pym/portage/tests/dep/testAtom.py                |    4 +
 pym/portage/tests/dep/test_best_match_to_list.py |    2 +
 4 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/man/portage.5 b/man/portage.5
index 9823eb1..ad84ff1 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -162,6 +162,9 @@ next to each other.
 
 .I Examples:
 .nf
+# 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 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 f0d07a5..8286e8d 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -141,9 +141,10 @@ def _get_atom_wildcard_re(eapi_attrs):
 	else:
 		pkg_re = r'[\w+*][\w+*-]*?'
 
-	atom_re = re.compile(r'(?P<simple>(' +
-		_extended_cat + r')/(' + pkg_re +
-		r'))(:(?P<slot>' + _slot_loose + r'))?(' +
+	atom_re = re.compile(r'((?P<simple>(' +
+		_extended_cat + r')/(' + pkg_re + r'))' + \
+		'|(?P<star>=((' + _extended_cat + r')/(' + pkg_re + r'))-(?P<version>\*\d+\*)))' + \
+		'(:(?P<slot>' + _slot_loose + r'))?(' +
 		_repo_separator + r'(?P<repo>' + _repo_name + r'))?$')
 
 	_atom_wildcard_re_cache[cache_key] = atom_re
@@ -1243,18 +1244,27 @@ class Atom(_unicode):
 		self.__dict__['blocker'] = blocker
 		m = atom_re.match(s)
 		extended_syntax = False
+		extended_version = None
 		if m is None:
 			if allow_wildcard:
-				m = _get_atom_wildcard_re(eapi_attrs).match(s)
+				atom_re = _get_atom_wildcard_re(eapi_attrs)
+				m = atom_re.match(s)
 				if m is None:
 					raise InvalidAtom(self)
-				op = None
 				gdict = m.groupdict()
-				cpv = cp = gdict['simple']
+				if m.group('star') is not None:
+					op = '=*'
+					base = atom_re.groupindex['star']
+					cp = m.group(base + 1)
+					cpv = m.group('star')[1:]
+					extended_version = m.group(base + 4)
+				else:
+					op = None
+					cpv = cp = m.group('simple')
 				if cpv.find("**") != -1:
 					raise InvalidAtom(self)
-				slot = gdict['slot']
-				repo = gdict['repo']
+				slot = m.group('slot')
+				repo = m.group('repo')
 				use_str = None
 				extended_syntax = True
 			else:
@@ -1297,7 +1307,7 @@ class Atom(_unicode):
 		except InvalidData:
 			# plain cp, wildcard, or something
 			self.__dict__['cpv'] = cpv
-			self.__dict__['version'] = None
+			self.__dict__['version'] = extended_version
 		self.__dict__['repo'] = repo
 		if slot is None:
 			self.__dict__['slot'] = None
@@ -2003,19 +2013,23 @@ def best_match_to_list(mypkg, mylist):
 	"""
 	operator_values = {'=':6, '~':5, '=*':4,
 		'>':2, '<':2, '>=':2, '<=':2, None:1}
-	maxvalue = -2
+	maxvalue = -99
 	bestm  = None
 	mypkg_cpv = None
 	for x in match_to_list(mypkg, mylist):
 		if x.extended_syntax:
-			if dep_getslot(x) is not None:
+			if x.operator == '=*':
 				if maxvalue < 0:
 					maxvalue = 0
 					bestm = x
-			else:
+			elif x.slot is not None:
 				if maxvalue < -1:
 					maxvalue = -1
 					bestm = x
+			else:
+				if maxvalue < -2:
+					maxvalue = -2
+					bestm = x
 			continue
 		if dep_getslot(x) is not None:
 			if maxvalue < 3:
@@ -2099,7 +2113,39 @@ def match_from_list(mydep, candidate_list):
 
 	mylist = []
 
-	if operator is None:
+	if mydep.extended_syntax:
+
+		for x in candidate_list:
+			cp = getattr(x, "cp", None)
+			if cp is None:
+				mysplit = catpkgsplit(remove_slot(x))
+				if mysplit is not None:
+					cp = mysplit[0] + '/' + mysplit[1]
+
+			if cp is None:
+				continue
+
+			if cp == mycpv or extended_cp_match(mydep.cp, cp):
+				mylist.append(x)
+
+		if mylist and mydep.operator == "=*":
+
+			candidate_list = mylist
+			mylist = []
+			# Currently, only \*\d+\* is supported.
+			ver = mydep.version[1:-1]
+
+			for x in candidate_list:
+				x_ver = getattr(x, "version", None)
+				if x_ver is None:
+					xs = catpkgsplit(remove_slot(x))
+					if xs is None:
+						continue
+					x_ver = "-".join(xs[-2:])
+				if ver in x_ver:
+					mylist.append(x)
+
+	elif operator is None:
 		for x in candidate_list:
 			cp = getattr(x, "cp", None)
 			if cp is None:
@@ -2110,8 +2156,7 @@ def match_from_list(mydep, candidate_list):
 			if cp is None:
 				continue
 
-			if cp == mycpv or (mydep.extended_syntax and \
-				extended_cp_match(mydep.cp, cp)):
+			if cp == mydep.cp:
 				mylist.append(x)
 
 	elif operator == "=": # Exact match

diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py
index e0cfaab..f5a7d37 100644
--- a/pym/portage/tests/dep/testAtom.py
+++ b/pym/portage/tests/dep/testAtom.py
@@ -20,6 +20,10 @@ class TestAtom(TestCase):
 				(None,  'sys-apps/portage', None, '0', '[doc]', None), False, False ),
 			( "*/*",
 				(None,  '*/*', None, None, None, None), True, False ),
+			( "=*/*-*9999*",
+				('=*',  '*/*', '*9999*', None, None, None), True, False ),
+			( "=*/*-*9999*:0::repo_name",
+				('=*',  '*/*', '*9999*', '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 58ab95b..8a14038 100644
--- a/pym/portage/tests/dep/test_best_match_to_list.py
+++ b/pym/portage/tests/dep/test_best_match_to_list.py
@@ -38,6 +38,8 @@ class Test_best_match_to_list(TestCase):
 						[Atom("=dev-libs/A-1:0")], True),
 					("dev-libs/A-1", [Atom("dev-libs/*", allow_wildcard=True), Atom("=dev-libs/A-1:0")], \
 						[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-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")], \



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: man/, pym/portage/dep/, pym/portage/tests/dep/
@ 2012-10-10 19:12 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2012-10-10 19:12 UTC (permalink / raw
  To: gentoo-commits

commit:     68288994493ee3ab56d0baf24ec3d0449330ccf5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 10 19:12:18 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct 10 19:12:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=68288994

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 705d0d9..12938e2 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 6e03004..b1a46b8 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<simple>(' +
 		_extended_cat + r')/(' + pkg_re + r'))' + \
-		'|(?P<star>=((' + _extended_cat + r')/(' + pkg_re + r'))-(?P<version>\*\d+\*)))' + \
+		'|(?P<star>=((' + _extended_cat + r')/(' + pkg_re + r'))-(?P<version>\*\w+\*)))' + \
 		'(:(?P<slot>' + _slot_loose + r'))?(' +
 		_repo_separator + r'(?P<repo>' + _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 094538d..948166d 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 8a14038..0ea8342 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")], \


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-10 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18 19:55 [gentoo-commits] proj/portage:master commit in: man/, pym/portage/dep/, pym/portage/tests/dep/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2012-10-10 19:12 Zac Medico
2011-02-07 22:07 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox