#the extra $(echo) commands remove newlines
[ -n "${EAPI}" ] || EAPI=0
- case "$EAPI" in
- 0|1|2|3)
- unset REQUIRED_USE
- ;;
- esac
if [ -n "${dbkey}" ] ; then
> "${dbkey}"
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 portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
from _emerge.Task import Task
if sys.hexversion >= 0x3000000:
not eapi_has_iuse_defaults(self.metadata["EAPI"]):
self._invalid_metadata('IUSE.invalid',
"IUSE contains defaults, but EAPI doesn't allow them")
+ if self.metadata["REQUIRED_USE"] and \
+ not eapi_has_required_use(self.metadata["EAPI"]):
+ self._invalid_metadata('REQUIRED_USE.invalid',
+ "REQUIRED_USE set, but EAPI doesn't allow it")
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)
depend = metadata.get("DEPEND", "")
rdepend = metadata.get("RDEPEND", None)
pdepend = metadata.get("PDEPEND", None)
+ required_use = metadata.get("REQUIRED_USE", None)
f = open(ebuild_path, "w")
f.write('EAPI="' + str(eapi) + '"\n')
f.write('RDEPEND="' + str(rdepend) + '"\n')
if rdepend is not None:
f.write('PDEPEND="' + str(pdepend) + '"\n')
+ if required_use is not None:
+ f.write('REQUIRED_USE="' + str(required_use) + '"\n')
f.close()
def _create_ebuild_manifests(self, ebuilds):
depend = metadata.get("DEPEND", "")
rdepend = metadata.get("RDEPEND", None)
pdepend = metadata.get("PDEPEND", None)
+ required_use = metadata.get("REQUIRED_USE", None)
def write_key(key, value):
f = open(os.path.join(vdb_pkg_dir, key), "w")
write_key("RDEPEND", rdepend)
if rdepend is not None:
write_key("PDEPEND", pdepend)
+ if required_use is not None:
+ write_key("REQUIRED_USE", required_use)
def _create_profile(self, ebuilds, installed, profile):
#Create $PORTDIR/profiles/categories
#~ "dev-libs/A-6.2": { "EAPI": 2, "DEPEND": "dev-libs/B[bar(+)]" },
#~ "dev-libs/A-6.3": { "EAPI": 3, "DEPEND": "dev-libs/B[bar(+)]" },
#~ "dev-libs/A-6.4": { "EAPI": 4, "DEPEND": "dev-libs/B[bar(+)]" },
+
+ #EAPI-4: REQUIRED_USE
+ "dev-libs/A-7.0": { "EAPI": 0, "IUSE": "foo bar", "REQUIRED_USE": "|| ( foo bar )" },
+ "dev-libs/A-7.1": { "EAPI": 1, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" },
+ "dev-libs/A-7.2": { "EAPI": 2, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" },
+ "dev-libs/A-7.3": { "EAPI": 3, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" },
+ #~ "dev-libs/A-7.4": { "EAPI": 4, "IUSE": "foo +bar", "REQUIRED_USE": "|| ( foo bar )" },
"dev-libs/B-1": {"EAPI": 1, "IUSE": "+foo"},
}
#~ ResolverPlaygroundTestCase(["=dev-libs/A-6.2"], success = False),
#~ ResolverPlaygroundTestCase(["=dev-libs/A-6.3"], success = False),
#~ ResolverPlaygroundTestCase(["=dev-libs/A-6.4"], success = True, mergelist = ["dev-libs/B-1", "dev-libs/A-6.4"]),
+
+ ResolverPlaygroundTestCase(["=dev-libs/A-7.0"], success = False),
+ ResolverPlaygroundTestCase(["=dev-libs/A-7.1"], success = False),
+ ResolverPlaygroundTestCase(["=dev-libs/A-7.2"], success = False),
+ ResolverPlaygroundTestCase(["=dev-libs/A-7.3"], success = False),
+ #~ ResolverPlaygroundTestCase(["=dev-libs/A-7.4"], success = True, mergelist = ["dev-libs/A-7.4"]),
)
playground = ResolverPlayground(ebuilds=ebuilds)