From c13c71f27906c1d2fa444b7c36a8ac4619efeda2 Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Mon, 12 Apr 2010 21:38:06 +0200 Subject: [PATCH] Add REQUIRED_USE to metadata keys, caches, etc. --- bin/ebuild.sh | 25 ++++++++++++++++--------- pym/_emerge/Package.py | 2 +- pym/portage/__init__.py | 2 +- pym/portage/cache/flat_list.py | 2 +- pym/portage/cache/metadata.py | 2 +- pym/portage/dbapi/bintree.py | 9 ++++++--- pym/portage/dbapi/porttree.py | 2 +- pym/portage/dbapi/vartree.py | 3 ++- pym/portage/package/ebuild/config.py | 2 +- 9 files changed, 30 insertions(+), 19 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 2affc923a..4d117f65e 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1086,7 +1086,7 @@ dyn_install() { set -f local f x IFS=$' \t\n\r' - for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE \ + for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE REQUIRED_USE \ PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do x=$(echo -n ${!f}) [[ -n $x ]] && echo "$x" > $f @@ -1260,6 +1260,7 @@ inherit() { local prev_export_funcs_var=$__export_funcs_var local B_IUSE + local B_REQUIRED_USE local B_DEPEND local B_RDEPEND local B_PDEPEND @@ -1308,12 +1309,13 @@ inherit() { set -f # Retain the old data and restore it later. - unset B_IUSE B_DEPEND B_RDEPEND B_PDEPEND + unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND [ "${IUSE+set}" = set ] && B_IUSE="${IUSE}" + [ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}" [ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}" [ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}" [ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}" - unset IUSE DEPEND RDEPEND PDEPEND + unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND #turn on glob expansion set +f @@ -1325,12 +1327,16 @@ inherit() { # If each var has a value, append it to the global variable E_* to # be applied after everything is finished. New incremental behavior. [ "${IUSE+set}" = set ] && export E_IUSE="${E_IUSE} ${IUSE}" + [ "${REQUIRED_USE+set}" = set ] && export E_REQUIRED_USE="${E_REQUIRED_USE} ${REQUIRED_USE}" [ "${DEPEND+set}" = set ] && export E_DEPEND="${E_DEPEND} ${DEPEND}" [ "${RDEPEND+set}" = set ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}" [ "${PDEPEND+set}" = set ] && export E_PDEPEND="${E_PDEPEND} ${PDEPEND}" [ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}" [ "${B_IUSE+set}" = set ] || unset IUSE + + [ "${B_REQUIRED_USE+set}" = set ] && REQUIRED_USE="${B_REQUIRED_USE}" + [ "${B_REQUIRED_USE+set}" = set ] || unset REQUIRED_USE [ "${B_DEPEND+set}" = set ] && DEPEND="${B_DEPEND}" [ "${B_DEPEND+set}" = set ] || unset DEPEND @@ -1600,7 +1606,7 @@ source_all_bashrcs() { # when portage is upgrading itself. READONLY_EBUILD_METADATA="DEFINED_PHASES DEPEND DESCRIPTION - EAPI HOMEPAGE INHERITED IUSE KEYWORDS LICENSE + EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI" READONLY_PORTAGE_VARS="D EBUILD EBUILD_PHASE \ @@ -1774,7 +1780,7 @@ preprocess_ebuild_env() { export SANDBOX_ON="1" export S=${WORKDIR}/${P} -unset E_IUSE E_DEPEND E_RDEPEND E_PDEPEND +unset E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND # Turn of extended glob matching so that g++ doesn't get incorrectly matched. shopt -u extglob @@ -1878,7 +1884,7 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then # In order to ensure correct interaction between ebuilds and # eclasses, they need to be unset before this process of # interaction begins. - unset DEPEND RDEPEND PDEPEND IUSE + unset DEPEND RDEPEND PDEPEND IUSE REQUIRED_USE if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then source "$EBUILD" || die "error sourcing ebuild" @@ -1906,8 +1912,9 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then DEPEND="${DEPEND} ${E_DEPEND}" RDEPEND="${RDEPEND} ${E_RDEPEND}" PDEPEND="${PDEPEND} ${E_PDEPEND}" - - unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND + REQUIRED_USE="${REQUIRED_USE} ${E_REQUIRED_USE}" + + unset ECLASS E_IUSE E_REQUIRED_USE E_DEPEND E_RDEPEND E_PDEPEND # alphabetically ordered by $EBUILD_PHASE value case "$EAPI" in @@ -2151,7 +2158,7 @@ ebuild_main() { fi auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE - DESCRIPTION KEYWORDS INHERITED IUSE UNUSED_00 PDEPEND PROVIDE EAPI + DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04 UNUSED_03 UNUSED_02 UNUSED_01" diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index bba55ca8e..e86eab334 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -30,7 +30,7 @@ class Package(Task): "INHERITED", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND", "repository", "PROPERTIES", "RESTRICT", "SLOT", "USE", - "_mtime_", "DEFINED_PHASES"] + "_mtime_", "DEFINED_PHASES", "REQUIRED_USE"] def __init__(self, **kwargs): Task.__init__(self, **kwargs) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index acf151aea..555dc2be8 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -480,7 +480,7 @@ def _movefile(src, dest, **kwargs): auxdbkeys = ( 'DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', - 'KEYWORDS', 'INHERITED', 'IUSE', 'UNUSED_00', + 'KEYWORDS', 'INHERITED', 'IUSE', 'REQUIRED_USE', 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04', 'UNUSED_03', 'UNUSED_02', 'UNUSED_01', diff --git a/pym/portage/cache/flat_list.py b/pym/portage/cache/flat_list.py index 1c4ec68de..eb7558398 100644 --- a/pym/portage/cache/flat_list.py +++ b/pym/portage/cache/flat_list.py @@ -19,7 +19,7 @@ class database(fs_template.FsBased): # do not screw with this ordering. _eclasses_ needs to be last auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', - 'KEYWORDS', 'IUSE', 'UNUSED_00', + 'KEYWORDS', 'IUSE', 'REQUIRED_USE', 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES') def __init__(self, *args, **config): diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index 9da52ce14..4c735d7e3 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -26,7 +26,7 @@ class database(flat_hash.database): complete_eclass_entries = False auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI', 'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', - 'KEYWORDS', 'INHERITED', 'IUSE', 'UNUSED_00', + 'KEYWORDS', 'INHERITED', 'IUSE', 'REQUIRED_USE', 'PDEPEND', 'PROVIDE', 'EAPI', 'PROPERTIES', 'DEFINED_PHASES') autocommits = True diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index f3f7aff98..31bb5f4ab 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -54,7 +54,8 @@ class bindbapi(fakedbapi): self._aux_cache_keys = set( ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", - "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES"]) + "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES", + "REQUIRED_USE"]) self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys) self._aux_cache = {} @@ -224,7 +225,8 @@ class binarytree(object): self._pkgindex_aux_keys = \ ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", - "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES"] + "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES", + "REQUIRED_USE"] self._pkgindex_aux_keys = list(self._pkgindex_aux_keys) self._pkgindex_use_evaluated_keys = \ ("LICENSE", "RDEPEND", "DEPEND", @@ -249,7 +251,8 @@ class binarytree(object): "RESTRICT": "", "SLOT" : "0", "USE" : "", - "DEFINED_PHASES" : "" + "DEFINED_PHASES" : "", + "REQUIRED_USE" : "" } self._pkgindex_inherited_keys = ["CHOST", "repository"] self._pkgindex_default_header_data = { diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 1db15da51..f0d891edf 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -405,7 +405,7 @@ class portdbapi(dbapi): self._aux_cache_keys = set( ["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", - "RESTRICT", "SLOT", "DEFINED_PHASES"]) + "RESTRICT", "SLOT", "DEFINED_PHASES", "REQUIRED_USE"]) self._aux_cache = {} self._broken_ebuilds = set() diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index db76e0454..28a03ad2c 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -850,7 +850,8 @@ class vardbapi(dbapi): ["BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "DESCRIPTION", "EAPI", "HOMEPAGE", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", - "repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES"]) + "repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES", + "REQUIRED_USE"]) self._aux_cache_obj = None self._aux_cache_filename = os.path.join(self.root, CACHE_PATH, "vdb_metadata.pickle") diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 23d7f219d..f4f05179b 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -140,7 +140,7 @@ class config(object): """ _setcpv_aux_keys = ('DEFINED_PHASES', 'DEPEND', 'EAPI', - 'INHERITED', 'IUSE', 'KEYWORDS', 'LICENSE', 'PDEPEND', + 'INHERITED', 'IUSE', 'REQUIRED_USE', 'KEYWORDS', 'LICENSE', 'PDEPEND', 'PROPERTIES', 'PROVIDE', 'RDEPEND', 'SLOT', 'repository', 'RESTRICT', 'LICENSE',) -- 2.26.2