Make useq() die if called during the "depend" phase in newer EAPIs.
authorZac Medico <zmedico@gentoo.org>
Sun, 3 May 2009 20:28:16 +0000 (20:28 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 3 May 2009 20:28:16 +0000 (20:28 -0000)
(trunk r13598)

svn path=/main/branches/2.1.6/; revision=13604

bin/ebuild.sh

index 9d49ae2a45e73429d67015cf4cae80d8e1458639..ca001ab33b438b7f3445107b0a43bb98f6d373d7 100755 (executable)
@@ -141,12 +141,16 @@ useq() {
                found=1
        fi
 
+       if [[ $EBUILD_PHASE = depend ]] ; then
+               # Skip this for older EAPIs since lots of ebuilds/eclasses
+               # have stuff in global scope that really belongs somewhere
+               # like pkg_setup or src_configure.
+               if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 ; then
+                       die "use() called during invalid phase: $EBUILD_PHASE"
+               fi
+
        # Make sure we have this USE flag in IUSE
-       # Skip this during the "depend" phase because lots of ebuilds/eclasses
-       # have stuff in global scope that really belongs somewhere like pkg_setup
-       # or src_configure.
-       if [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE && \
-               $EBUILD_PHASE != depend ]] ; then
+       elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then
                [[ $u =~ $PORTAGE_IUSE ]] || \
                        eqawarn "QA Notice: USE Flag '${u}' not" \
                                "in IUSE for ${CATEGORY}/${PF}"