Create a PORTAGE_IUSE variable containing an egrep pattern
authorZac Medico <zmedico@gentoo.org>
Tue, 18 Dec 2007 06:57:53 +0000 (06:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 18 Dec 2007 06:57:53 +0000 (06:57 -0000)
for use by the QA check that's built into useq(). This allows
the IUSE logic for this check to be isolated in the python
code. (trunk r8945)

svn path=/main/branches/2.1.2/; revision=8948

bin/ebuild.sh
pym/portage.py

index 25638be66a9b0cecb2bd1bd33bdb99bb316557a1..e88f734423f6b0b8f4db8af0f0f1b2a3062f4219 100755 (executable)
@@ -138,15 +138,10 @@ useq() {
        fi
 
        # Make sure we have this USE flag in IUSE
-       if ! hasq "${u}" ${IUSE} ${E_IUSE} && \
-               ! hasq "+${u}" ${IUSE} ${E_IUSE} && \
-               ! hasq "-${u}" ${IUSE} ${E_IUSE} && \
-               ! hasq "${u}" ${PORTAGE_ARCHLIST} selinux && \
-               [[ ${u} != arch_* ]] && \
-               [[ ${u} != elibc_* ]] && \
-               [[ ${u} != kernel_* ]] && \
-               [[ ${u} != userland_* ]] ; then
-               eqawarn "QA Notice: USE Flag '${u}' not in IUSE for ${CATEGORY}/${PF}"
+       if [[ ${EBUILD_PHASE} != depend ]] && [[ -n ${PORTAGE_IUSE} ]] ; then
+               echo "${u}" | egrep -q "${PORTAGE_IUSE}" || \
+                       eqawarn "QA Notice: USE Flag '${u}' not" \
+                               "in IUSE for ${CATEGORY}/${PF}"
        fi
 
        if hasq ${u} ${USE} ; then
@@ -1367,7 +1362,8 @@ READONLY_EBUILD_METADATA="DEPEND DESCRIPTION
 
 READONLY_PORTAGE_VARS="D EBUILD EBUILD_PHASE \
        EBUILD_SH_ARGS EMERGE_FROM FILESDIR PORTAGE_BINPKG_FILE \
-       PORTAGE_BIN_PATH PORTAGE_PYM_PATH PORTAGE_MUTABLE_FILTERED_VARS \
+       PORTAGE_BIN_PATH PORTAGE_IUSE \
+       PORTAGE_PYM_PATH PORTAGE_MUTABLE_FILTERED_VARS \
        PORTAGE_SAVED_READONLY_VARS PORTAGE_TMPDIR T WORKDIR"
 
 PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR"
index eed8dd158d4a331f670a4f8db803b2c4e7613775..254c35d64453a6de896423d8163c221922e20847 100644 (file)
@@ -1016,6 +1016,7 @@ class config:
                "PORTAGE_BUILDDIR", "PORTAGE_COLORMAP",
                "PORTAGE_CONFIGROOT", "PORTAGE_DEBUG", "PORTAGE_DEPCACHEDIR",
                "PORTAGE_GID", "PORTAGE_INST_GID", "PORTAGE_INST_UID",
+               "PORTAGE_IUSE",
                "PORTAGE_LOG_FILE", "PORTAGE_MASTER_PID",
                "PORTAGE_PYM_PATH", "PORTAGE_REPO_NAME", "PORTAGE_RESTRICT",
                "PORTAGE_TMPDIR", "PORTAGE_WORKDIR_MODE",
@@ -2377,12 +2378,12 @@ class config:
                        iuse_implicit = set(iuse)
 
                        # Flags derived from ARCH.
-                       if arch:
-                               iuse_implicit.add(arch)
+                       iuse_implicit.update(self.get("PORTAGE_ARCHLIST", "").split())
 
                        # Flags derived from USE_EXPAND_HIDDEN variables
                        # such as ELIBC, KERNEL, and USERLAND.
                        use_expand_hidden = self.get("USE_EXPAND_HIDDEN", "").split()
+                       use_expand_hidden_raw = use_expand_hidden
                        if use_expand_hidden:
                                use_expand_hidden = re.compile("^(%s)_.*" % \
                                        ("|".join(x.lower() for x in use_expand_hidden)))
@@ -2394,6 +2395,16 @@ class config:
                        iuse_implicit.update(x for x in self.useforce \
                                if x not in self.usemask)
 
+                       iuse_grep = iuse_implicit.copy()
+                       if use_expand_hidden_raw:
+                               for x in use_expand_hidden_raw:
+                                       iuse_grep.add(x.lower() + "_.*")
+                       if iuse_grep:
+                               iuse_grep = "^(%s)$" % "|".join(sorted(iuse_grep))
+                       else:
+                               iuse_grep = ""
+                       self.configdict["pkg"]["PORTAGE_IUSE"] = iuse_grep
+
                        usesplit = [x for x in usesplit if \
                                x in iuse_implicit and \
                                x not in self.usemask]