Make sure we don't allow IUSE defaults in EAPIs that don't allow them
authorSebastian Luther <SebastianLuther@gmx.de>
Wed, 11 Aug 2010 10:50:13 +0000 (12:50 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Aug 2010 10:54:04 +0000 (03:54 -0700)
pym/_emerge/Package.py
pym/portage/tests/resolver/test_eapi.py

index 58c453ff959d4a73ad343044cbd362f431fffc18..992851bb12195ca28d93be517afe82ccb84501df 100644 (file)
@@ -8,6 +8,7 @@ import portage
 from portage.cache.mappings import slot_dict_class
 from portage.dep import isvalidatom, use_reduce, \
        paren_enclose, _slot_re
+from portage.eapi import eapi_has_iuse_defaults
 from _emerge.Task import Task
 
 if sys.hexversion >= 0x3000000:
@@ -47,6 +48,10 @@ class Package(Task):
                        # Avoid an InvalidAtom exception when creating slot_atom.
                        # This package instance will be masked due to empty SLOT.
                        slot = '0'
+               if (self.iuse.enabled or self.iuse.enabled) and \
+                       not eapi_has_iuse_defaults(self.metadata["EAPI"]):
+                       self._invalid_metadata('IUSE.invalid',
+                               "IUSE contains defaults, but EAPI doesn't allow them")
                self.slot_atom = portage.dep.Atom("%s:%s" % (self.cp, slot))
                self.category, self.pf = portage.catsplit(self.cpv)
                self.cpv_split = portage.catpkgsplit(self.cpv)
index a18b2c7c6d0cb6214d112d4afd3ffe1c6e8c087e..94cdd4a998f070874c71c8c7155e872febdfc10b 100644 (file)
@@ -54,7 +54,7 @@ class EAPITestCase(TestCase):
                        }
 
                requests = (
-                               #~ (["=dev-libs/A-1.0"], {}, None, False, None),
+                               (["=dev-libs/A-1.0"], {}, None, False, None),
                                (["=dev-libs/A-1.1"], {}, None, True, ["dev-libs/A-1.1"]),
                                (["=dev-libs/A-1.2"], {}, None, True, ["dev-libs/A-1.2"]),
                                (["=dev-libs/A-1.3"], {}, None, True, ["dev-libs/A-1.3"]),