Atom: don't allow :slot* syntax
authorZac Medico <zmedico@gentoo.org>
Tue, 18 Sep 2012 20:17:34 +0000 (13:17 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 18 Sep 2012 20:17:34 +0000 (13:17 -0700)
This syntax is useless, and PMS doesn't discuss it.

pym/portage/dep/__init__.py
pym/portage/tests/dep/testAtom.py
pym/portage/tests/dep/test_isvalidatom.py
pym/portage/tests/dep/test_match_from_list.py

index 4d85f945b55c9479eddf85021241e4960462d3a5..b4b240d436bef454cf0a650ec84c312783a3f48f 100644 (file)
@@ -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
index 0c72fd0e683873c1c9fb765e10fe60abfc872d02..094538dab5d929434bde7744737237f8acd4e2fd 100644 (file)
@@ -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}),
                )
index abcec755e872def442e5c86b18b63ad65b21b760..625bde5d494fed6f57bd8ab22c919913a9913c85 100644 (file)
@@ -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),
                )
 
index 2a1945b083a05b6b2dc7a3e3899c00109a5f44d3..4a6ab3b48012680d63d978572871c513e28ef147 100644 (file)
@@ -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")], [] ),