ebuild.sh: move use* funcs to phase-helpers.sh
authorZac Medico <zmedico@gentoo.org>
Sun, 11 Sep 2011 21:29:04 +0000 (14:29 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 11 Sep 2011 21:29:04 +0000 (14:29 -0700)
bin/ebuild.sh
bin/phase-helpers.sh

index 936405d962230dea9b81918e1f8f36b75d893854..ccf84a455f1ecd7bef3a72b39821d0ac1c9f26d7 100755 (executable)
@@ -127,54 +127,6 @@ esyslog() {
        return 0
 }
 
-useq() {
-       has $EBUILD_PHASE prerm postrm || eqawarn \
-               "QA Notice: The 'useq' function is deprecated (replaced by 'use')"
-       use ${1}
-}
-
-usev() {
-       if use ${1}; then
-               echo "${1#!}"
-               return 0
-       fi
-       return 1
-}
-
-use() {
-       local u=$1
-       local found=0
-
-       # if we got something like '!flag', then invert the return value
-       if [[ ${u:0:1} == "!" ]] ; then
-               u=${u:1}
-               found=1
-       fi
-
-       if [[ $EBUILD_PHASE = depend ]] ; then
-               # TODO: Add a registration interface for eclasses to register
-               # any number of phase hooks, so that global scope eclass
-               # initialization can by migrated to phase hooks in new EAPIs.
-               # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup
-               #if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then
-               #       die "use() called during invalid phase: $EBUILD_PHASE"
-               #fi
-               true
-
-       # Make sure we have this USE flag in IUSE
-       elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then
-               [[ $u =~ $PORTAGE_IUSE ]] || \
-                       eqawarn "QA Notice: USE Flag '${u}' not" \
-                               "in IUSE for ${CATEGORY}/${PF}"
-       fi
-
-       if has ${u} ${USE} ; then
-               return ${found}
-       else
-               return $((!found))
-       fi
-}
-
 # Return true if given package is installed. Otherwise return false.
 # Takes single depend-type atoms.
 has_version() {
@@ -838,7 +790,7 @@ else
        # in global scope, even though they are completely useless during
        # the "depend" phase.
        for x in diropts docompress exeopts insopts \
-               keepdir libopts use_with use_enable ; do
+               keepdir libopts use useq usev use_with use_enable ; do
                eval "${x}() { : ; }"
        done
        unset x
index 337639f45f66cb1f6f623b3ba8a14f7c97199374..6064346bee154888983043bcb37b958dd3919952 100644 (file)
@@ -149,6 +149,55 @@ keepdir() {
        fi
 }
 
+
+useq() {
+       has $EBUILD_PHASE prerm postrm || eqawarn \
+               "QA Notice: The 'useq' function is deprecated (replaced by 'use')"
+       use ${1}
+}
+
+usev() {
+       if use ${1}; then
+               echo "${1#!}"
+               return 0
+       fi
+       return 1
+}
+
+use() {
+       local u=$1
+       local found=0
+
+       # if we got something like '!flag', then invert the return value
+       if [[ ${u:0:1} == "!" ]] ; then
+               u=${u:1}
+               found=1
+       fi
+
+       if [[ $EBUILD_PHASE = depend ]] ; then
+               # TODO: Add a registration interface for eclasses to register
+               # any number of phase hooks, so that global scope eclass
+               # initialization can by migrated to phase hooks in new EAPIs.
+               # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup
+               #if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then
+               #       die "use() called during invalid phase: $EBUILD_PHASE"
+               #fi
+               true
+
+       # Make sure we have this USE flag in IUSE
+       elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then
+               [[ $u =~ $PORTAGE_IUSE ]] || \
+                       eqawarn "QA Notice: USE Flag '${u}' not" \
+                               "in IUSE for ${CATEGORY}/${PF}"
+       fi
+
+       if has ${u} ${USE} ; then
+               return ${found}
+       else
+               return $((!found))
+       fi
+}
+
 use_with() {
        if [ -z "$1" ]; then
                echo "!!! use_with() called without a parameter." >&2