From: Zac Medico Date: Sat, 1 Sep 2012 22:42:45 +0000 (-0700) Subject: Eliminate bin/ebuild-helpers/4 directory. X-Git-Tag: v2.2.0_alpha124~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ca755a56b628c8296630c3e435425b14d3b8bf10;p=portage.git Eliminate bin/ebuild-helpers/4 directory. Instead, just use conditionals where appropriate inside bin/ebuild-helpers/* scripts. --- diff --git a/bin/banned-helper b/bin/banned-helper deleted file mode 100755 index 17ea9915d..000000000 --- a/bin/banned-helper +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright 2009 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -die "'${0##*/}' has been banned for EAPI '$EAPI'" -exit 1 diff --git a/bin/ebuild-helpers/4/dodoc b/bin/ebuild-helpers/4/dodoc deleted file mode 120000 index 35080ada3..000000000 --- a/bin/ebuild-helpers/4/dodoc +++ /dev/null @@ -1 +0,0 @@ -../doins \ No newline at end of file diff --git a/bin/ebuild-helpers/4/dohard b/bin/ebuild-helpers/4/dohard deleted file mode 120000 index 1a6b57a39..000000000 --- a/bin/ebuild-helpers/4/dohard +++ /dev/null @@ -1 +0,0 @@ -../../banned-helper \ No newline at end of file diff --git a/bin/ebuild-helpers/4/dosed b/bin/ebuild-helpers/4/dosed deleted file mode 120000 index 1a6b57a39..000000000 --- a/bin/ebuild-helpers/4/dosed +++ /dev/null @@ -1 +0,0 @@ -../../banned-helper \ No newline at end of file diff --git a/bin/ebuild-helpers/4/prepalldocs b/bin/ebuild-helpers/4/prepalldocs deleted file mode 120000 index 1a6b57a39..000000000 --- a/bin/ebuild-helpers/4/prepalldocs +++ /dev/null @@ -1 +0,0 @@ -../../banned-helper \ No newline at end of file diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc index 1f333a615..d6ce67933 100755 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@ -1,7 +1,18 @@ #!/bin/bash -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +case "${EAPI}" in + 0|1|2|3) + ;; + *) + exec \ + env \ + __PORTAGE_HELPER="dodoc" \ + doins "$@" + ;; +esac + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh if [ $# -lt 1 ] ; then diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard index b52fd7c00..6ae93d240 100755 --- a/bin/ebuild-helpers/dohard +++ b/bin/ebuild-helpers/dohard @@ -1,7 +1,16 @@ #!/bin/bash -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +case "${EAPI}" in + 0|1|2|3) + ;; + *) + die "'${0##*/}' has been banned for EAPI '$EAPI'" + exit 1 + ;; +esac + if [[ $# -ne 2 ]] ; then echo "$0: two arguments needed" 1>&2 exit 1 diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index fd7793404..26b11a869 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -4,7 +4,9 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -if [[ ${0##*/} == dodoc ]] ; then +helper=${__PORTAGE_HELPER:-${0##*/}} + +if [[ ${helper} == dodoc ]] ; then if [ $# -eq 0 ] ; then # default_src_install may call dodoc with no arguments # when DOC is defined but empty, so simply return @@ -16,7 +18,7 @@ if [[ ${0##*/} == dodoc ]] ; then fi if [ $# -lt 1 ] ; then - helpers_die "${0##*/}: at least one argument needed" + helpers_die "${helper}: at least one argument needed" exit 1 fi @@ -35,7 +37,7 @@ if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then vecho "You should not use \${D} or \${ED} with helpers." 1>&2 vecho " --> ${INSDESTTREE}" 1>&2 vecho "-------------------------------------------------------" 1>&2 - helpers_die "${0##*/} used with \${D} or \${ED}" + helpers_die "${helper} used with \${D} or \${ED}" exit 1 fi @@ -79,7 +81,7 @@ _doins() { install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}" rval=$? [[ -n ${cleanup} ]] && rm -f "${cleanup}" - [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 + [ $rval -ne 0 ] && echo "!!! ${helper}: $mysrc does not exist" 1>&2 return $rval } @@ -99,8 +101,8 @@ for x in "$@" ; do if [[ $PRESERVE_SYMLINKS = n && -d $x ]] || \ [[ $PRESERVE_SYMLINKS = y && -d $x && ! -L $x ]] ; then if [ "${DOINSRECUR}" == "n" ] ; then - if [[ ${0##*/} == dodoc ]] ; then - echo "!!! ${0##*/}: $x is a directory" 1>&2 + if [[ ${helper} == dodoc ]] ; then + echo "!!! ${helper}: $x is a directory" 1>&2 ((failed|=1)) fi continue @@ -155,4 +157,4 @@ for x in "$@" ; do fi done rm -rf "$TMP" -[[ $failed -ne 0 || $success -eq 0 ]] && { helpers_die "${0##*/} failed"; exit 1; } || exit 0 +[[ $failed -ne 0 || $success -eq 0 ]] && { helpers_die "${helper} failed"; exit 1; } || exit 0 diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed index f202df7a7..24ec20587 100755 --- a/bin/ebuild-helpers/dosed +++ b/bin/ebuild-helpers/dosed @@ -1,7 +1,16 @@ #!/bin/bash -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +case "${EAPI}" in + 0|1|2|3) + ;; + *) + die "'${0##*/}' has been banned for EAPI '$EAPI'" + exit 1 + ;; +esac + if [[ $# -lt 1 ]] ; then echo "!!! ${0##*/}: at least one argument needed" >&2 exit 1 diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs index 560a02bcb..c9226d603 100755 --- a/bin/ebuild-helpers/prepalldocs +++ b/bin/ebuild-helpers/prepalldocs @@ -1,9 +1,18 @@ #!/bin/bash -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +case "${EAPI}" in + 0|1|2|3) + ;; + *) + die "'${0##*/}' has been banned for EAPI '$EAPI'" + exit 1 + ;; +esac + if [[ -n $1 ]] ; then vecho "${0##*/}: invalid usage; takes no arguments" 1>&2 fi diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 85d44a1fc..fd7fb25b9 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -29,7 +29,7 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \ PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \ PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR PORTDIR_OVERLAY \ PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \ - __PORTAGE_TEST_HARDLINK_LOCKS" + __PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS" PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR" diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 4d425375f..1bcbbf7ef 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -170,6 +170,7 @@ environ_filter += [ "RESUMECOMMAND_HTTP", "RESUMECOMMAND_HTTPS", "RESUMECOMMAND_RSYNC", "RESUMECOMMAND_SFTP", "SYNC", "UNINSTALL_IGNORE", "USE_EXPAND_HIDDEN", "USE_ORDER", + "__PORTAGE_HELPER" ] environ_filter = frozenset(environ_filter) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 9b678f7fb..9ca684edf 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -155,9 +155,6 @@ def _doebuild_path(settings, eapi=None): path = [] - if eapi not in (None, "0", "1", "2", "3"): - path.append(os.path.join(portage_bin_path, "ebuild-helpers", "4")) - path.append(os.path.join(portage_bin_path, "ebuild-helpers")) path.extend(prerootpath)