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 9BCB01381F3 for ; Fri, 24 May 2013 18:02:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7DE32E094B; Fri, 24 May 2013 18:02:52 +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 0B593E094B for ; Fri, 24 May 2013 18:02:51 +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 26B2433E0B2 for ; Fri, 24 May 2013 18:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id C251DE4404 for ; Fri, 24 May 2013 18:02:49 +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: <1369418542.4839cd921b91e33b0e183d877fd9bd856250eb2a.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_isvalidatom.py X-VCS-Directories: pym/portage/dep/ pym/portage/tests/dep/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 4839cd921b91e33b0e183d877fd9bd856250eb2a X-VCS-Branch: master Date: Fri, 24 May 2013 18:02:49 +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: f048fa55-31fd-4426-8b17-b9ebdce49c2f X-Archives-Hash: 9342a499fc78f750988c22c17d9b4cf5 commit: 4839cd921b91e33b0e183d877fd9bd856250eb2a Author: Zac Medico gentoo org> AuthorDate: Fri May 24 18:02:22 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri May 24 18:02:22 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4839cd92 Atom: handle invalid */foo-version wildcard Before, a wildcard atom could be treated as valid even though it specified a version without an operator, as reported at here: https://forums.gentoo.org/viewtopic-p-7314746.html#7314746 --- pym/portage/dep/__init__.py | 6 ++++-- pym/portage/tests/dep/test_isvalidatom.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 6f3b357..7776f89 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -29,7 +29,7 @@ from portage.eapi import _get_eapi_attrs from portage.exception import InvalidAtom, InvalidData, InvalidDependString from portage.localization import _ from portage.versions import catpkgsplit, catsplit, \ - vercmp, ververify, _cp, _cpv, _pkg_str, _slot, _unknown_repo + vercmp, ververify, _cp, _cpv, _pkg_str, _slot, _unknown_repo, _vr import portage.cache.mappings if sys.hexversion >= 0x3000000: @@ -121,7 +121,7 @@ def _get_atom_wildcard_re(eapi_attrs): pkg_re = r'[\w+*][\w+*-]*?' atom_re = re.compile(r'((?P(' + - _extended_cat + r')/(' + pkg_re + r'))' + \ + _extended_cat + r')/(' + pkg_re + r'(-' + _vr + ')?))' + \ '|(?P=((' + _extended_cat + r')/(' + pkg_re + r'))-(?P\*\w+\*)))' + \ '(:(?P' + _slot_loose + r'))?(' + _repo_separator + r'(?P' + _repo_name + r'))?$', re.UNICODE) @@ -1243,6 +1243,8 @@ class Atom(_unicode): else: op = None cpv = cp = m.group('simple') + if m.group(atom_re.groupindex['simple'] + 3) is not None: + raise InvalidAtom(self) if cpv.find("**") != -1: raise InvalidAtom(self) slot = m.group('slot') diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py index 6b0566d..67ba603 100644 --- a/pym/portage/tests/dep/test_isvalidatom.py +++ b/pym/portage/tests/dep/test_isvalidatom.py @@ -1,4 +1,4 @@ -# Copyright 2006-2010 Gentoo Foundation +# Copyright 2006-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -143,6 +143,9 @@ class IsValidAtom(TestCase): IsValidAtomTestCase("virtual/ffmpeg:*", True), IsValidAtomTestCase("virtual/ffmpeg:0*", False), IsValidAtomTestCase("virtual/ffmpeg:0", True), + + # Wildcard atoms + IsValidAtomTestCase("*/portage-2.1", False, allow_wildcard=True), ) for test_case in test_cases: