summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-09-18 13:17:34 -0700
committerZac Medico <zmedico@gentoo.org>2012-09-18 13:17:34 -0700
commit61406033e6ae182d9f4a7fceea81871e74f9b0b6 (patch)
tree5b91cad6b3b144979a2d7af17e6526342aa7d4d4
parentcache/sqlite.py: fix getitem order assumption (diff)
downloadportage-61406033e6ae182d9f4a7fceea81871e74f9b0b6.tar.gz
portage-61406033e6ae182d9f4a7fceea81871e74f9b0b6.tar.bz2
portage-61406033e6ae182d9f4a7fceea81871e74f9b0b6.zip
Atom: don't allow :slot* syntax
This syntax is useless, and PMS doesn't discuss it.
-rw-r--r--pym/portage/dep/__init__.py2
-rw-r--r--pym/portage/tests/dep/testAtom.py1
-rw-r--r--pym/portage/tests/dep/test_isvalidatom.py2
-rw-r--r--pym/portage/tests/dep/test_match_from_list.py2
4 files changed, 3 insertions, 4 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 4d85f945b..b4b240d43 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1333,6 +1333,8 @@ class Atom(_unicode):
sub_slot = sub_slot[:-1]
self.__dict__['sub_slot'] = sub_slot
self.__dict__['slot_operator'] = slot_operator
+ if self.slot is not None and self.slot_operator == "*":
+ raise InvalidAtom(self)
else:
self.__dict__['slot'] = slot
self.__dict__['sub_slot'] = None
diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py
index 0c72fd0e6..094538dab 100644
--- a/pym/portage/tests/dep/testAtom.py
+++ b/pym/portage/tests/dep/testAtom.py
@@ -155,7 +155,6 @@ class TestAtom(TestCase):
("virtual/ffmpeg:=", "4-slot-abi", {"slot": None, "sub_slot": None, "slot_operator": "="}),
("virtual/ffmpeg:0=", "4-slot-abi", {"slot": "0", "sub_slot": None, "slot_operator": "="}),
("virtual/ffmpeg:*", "4-slot-abi", {"slot": None, "sub_slot": None, "slot_operator": "*"}),
- ("virtual/ffmpeg:0*", "4-slot-abi", {"slot": "0", "sub_slot": None, "slot_operator": "*"}),
("virtual/ffmpeg:0", "4-slot-abi", {"slot": "0", "sub_slot": None, "slot_operator": None}),
("virtual/ffmpeg", "4-slot-abi", {"slot": None, "sub_slot": None, "slot_operator": None}),
)
diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py
index abcec755e..625bde5d4 100644
--- a/pym/portage/tests/dep/test_isvalidatom.py
+++ b/pym/portage/tests/dep/test_isvalidatom.py
@@ -141,7 +141,7 @@ class IsValidAtom(TestCase):
IsValidAtomTestCase("virtual/ffmpeg:=", True),
IsValidAtomTestCase("virtual/ffmpeg:0=", True),
IsValidAtomTestCase("virtual/ffmpeg:*", True),
- IsValidAtomTestCase("virtual/ffmpeg:0*", True),
+ IsValidAtomTestCase("virtual/ffmpeg:0*", False),
IsValidAtomTestCase("virtual/ffmpeg:0", True),
)
diff --git a/pym/portage/tests/dep/test_match_from_list.py b/pym/portage/tests/dep/test_match_from_list.py
index 2a1945b08..4a6ab3b48 100644
--- a/pym/portage/tests/dep/test_match_from_list.py
+++ b/pym/portage/tests/dep/test_match_from_list.py
@@ -108,13 +108,11 @@ class Test_match_from_list(TestCase):
("virtual/ffmpeg:=", [Package("=virtual/ffmpeg-0.10.3:0/53")], ["virtual/ffmpeg-0.10.3"] ),
("virtual/ffmpeg:0=", [Package("=virtual/ffmpeg-0.10.3:0/53")], ["virtual/ffmpeg-0.10.3"] ),
("virtual/ffmpeg:*", [Package("=virtual/ffmpeg-0.10.3:0/53")], ["virtual/ffmpeg-0.10.3"] ),
- ("virtual/ffmpeg:0*", [Package("=virtual/ffmpeg-0.10.3:0/53")], ["virtual/ffmpeg-0.10.3"] ),
("virtual/ffmpeg:0", [Package("=virtual/ffmpeg-0.10.3:0/53")], ["virtual/ffmpeg-0.10.3"] ),
("sys-libs/db:4.8/4.8", [Package("=sys-libs/db-4.8.30:4.8")], ["sys-libs/db-4.8.30"] ),
("sys-libs/db:4.8/4.8=", [Package("=sys-libs/db-4.8.30:4.8")], ["sys-libs/db-4.8.30"] ),
("sys-libs/db:4.8=", [Package("=sys-libs/db-4.8.30:4.8")], ["sys-libs/db-4.8.30"] ),
- ("sys-libs/db:4.8*", [Package("=sys-libs/db-4.8.30:4.8")], ["sys-libs/db-4.8.30"] ),
("sys-libs/db:*", [Package("=sys-libs/db-4.8.30:4.8")], ["sys-libs/db-4.8.30"] ),
("sys-libs/db:4.8/0", [Package("=sys-libs/db-4.8.30:4.8")], [] ),
("sys-libs/db:4.8/0=", [Package("=sys-libs/db-4.8.30:4.8")], [] ),