From 1af0c40b1300651ca03a7509f49f152c1e595736 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 1 Nov 2011 19:17:19 -0700 Subject: Add EPREFIX and ED support in all ebuild helpers. This allows our prefix tests to use helpers like insinto, doins, and dosym. --- bin/ebuild-helpers/dobin | 8 +++++--- bin/ebuild-helpers/dodir | 6 ++++-- bin/ebuild-helpers/dodoc | 4 +++- bin/ebuild-helpers/doexe | 10 ++++++---- bin/ebuild-helpers/dohard | 8 +++++--- bin/ebuild-helpers/doinfo | 10 ++++++---- bin/ebuild-helpers/doins | 16 +++++++++------- bin/ebuild-helpers/dolib | 6 ++++-- bin/ebuild-helpers/doman | 8 +++++--- bin/ebuild-helpers/domo | 11 +++++++---- bin/ebuild-helpers/dosbin | 10 ++++++---- bin/ebuild-helpers/dosed | 8 +++++--- bin/ebuild-helpers/dosym | 10 ++++++---- bin/ebuild-helpers/ecompressdir | 26 ++++++++++++++------------ bin/ebuild-helpers/fowners | 6 ++++-- bin/ebuild-helpers/fperms | 5 +++-- bin/ebuild-helpers/prepall | 10 ++++++---- bin/ebuild-helpers/prepalldocs | 7 ++++--- bin/ebuild-helpers/prepallinfo | 6 ++++-- bin/ebuild-helpers/prepallman | 6 ++++-- bin/ebuild-helpers/prepallstrip | 6 ++++-- bin/ebuild-helpers/prepinfo | 8 +++++--- bin/ebuild-helpers/preplib | 8 +++++--- bin/ebuild-helpers/prepman | 10 ++++++---- bin/ebuild-helpers/prepstrip | 26 ++++++++++++++------------ 25 files changed, 144 insertions(+), 95 deletions(-) (limited to 'bin/ebuild-helpers') diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin index e385455d7..af3af0d84 100755 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@ -9,15 +9,17 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -if [[ ! -d ${D}${DESTTREE}/bin ]] ; then - install -d "${D}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/bin"; exit 2; } +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then + install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; } fi ret=0 for x in "$@" ; do if [[ -e ${x} ]] ; then - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin" + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin" else echo "!!! ${0##*/}: $x does not exist" 1>&2 false diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir index f40bee7e4..7db7cafb1 100755 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@ -1,10 +1,12 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -install -d ${DIROPTIONS} "${@/#/${D}/}" +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +install -d ${DIROPTIONS} "${@/#/${ED}/}" ret=$? [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" exit $ret diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc index 65713db1a..37bbc79d0 100755 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@ -9,7 +9,9 @@ if [ $# -lt 1 ] ; then exit 1 fi -dir="${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" if [ ! -d "${dir}" ] ; then install -d "${dir}" fi diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe index 360800e02..a5b9af0eb 100755 --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -9,8 +9,10 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then - install -d "${D}${_E_EXEDESTTREE_}" +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then + install -d "${ED}${_E_EXEDESTTREE_}" fi TMP=$T/.doexe_tmp @@ -29,7 +31,7 @@ for x in "$@" ; do mysrc="${x}" fi if [ -e "$mysrc" ] ; then - install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_" + install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_" else echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 false diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard index 22704876c..cf6fb112d 100755 --- a/bin/ebuild-helpers/dohard +++ b/bin/ebuild-helpers/dohard @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 if [[ $# -ne 2 ]] ; then @@ -7,7 +7,9 @@ if [[ $# -ne 2 ]] ; then exit 1 fi +case "$EAPI" in 0|1|2) ED=${D} ;; esac + destdir=${2%/*} -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" +[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" -exec ln -f "${D}$1" "${D}$2" +exec ln -f "${ED}$1" "${ED}$2" diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo index 54fb8dac2..a922ef1be 100755 --- a/bin/ebuild-helpers/doinfo +++ b/bin/ebuild-helpers/doinfo @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -9,11 +9,13 @@ if [[ -z $1 ]] ; then exit 1 fi -if [[ ! -d ${D}usr/share/info ]] ; then - install -d "${D}usr/share/info" || { helpers_die "${0##*/}: failed to install ${D}usr/share/info"; exit 1; } +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +if [[ ! -d ${ED}usr/share/info ]] ; then + install -d "${ED}usr/share/info" || { helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; } fi -install -m0644 "$@" "${D}usr/share/info" +install -m0644 "$@" "${ED}usr/share/info" rval=$? if [ $rval -ne 0 ] ; then for x in "$@" ; do diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins index 7dec14682..b9189d5ed 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -27,12 +27,14 @@ else DOINSRECUR=n fi -if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then +case "$EAPI" in 0|1|2) export ED="${D}" ;; esac + +if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then vecho "-------------------------------------------------------" 1>&2 - vecho "You should not use \${D} with helpers." 1>&2 + 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}" + helpers_die "${0##*/} used with \${D} or \${ED}" exit 1 fi @@ -49,7 +51,7 @@ export TMP=$T/.doins_tmp # Use separate directories to avoid potential name collisions. mkdir -p "$TMP"/{1,2} -[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}" +[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}" _doins() { local mysrc="$1" mydir="$2" cleanup="" rval @@ -63,8 +65,8 @@ _doins() { # $PORTAGE_ACTUAL_DISTDIR/. if [ $PRESERVE_SYMLINKS = y ] && \ ! [[ $(readlink "$mysrc") == "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; then - rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $? - cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}" + rm -rf "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" || return $? + cp -P "$mysrc" "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" return $? else cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $? @@ -73,7 +75,7 @@ _doins() { fi fi - install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}" + install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}" rval=$? [[ -n ${cleanup} ]] && rm -f "${cleanup}" [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib index 87ade425a..9dd11d857 100755 --- a/bin/ebuild-helpers/dolib +++ b/bin/ebuild-helpers/dolib @@ -1,9 +1,11 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 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) ED=${D} ;; esac + # Setup ABI cruft LIBDIR_VAR="LIBDIR_${ABI}" if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then @@ -12,7 +14,7 @@ fi unset LIBDIR_VAR # we need this to default to lib so that things dont break CONF_LIBDIR=${CONF_LIBDIR:-lib} -libdir="${D}${DESTTREE}/${CONF_LIBDIR}" +libdir="${ED}${DESTTREE}/${CONF_LIBDIR}" if [[ $# -lt 1 ]] ; then diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman index 4561bef18..27401f3b3 100755 --- a/bin/ebuild-helpers/doman +++ b/bin/ebuild-helpers/doman @@ -9,6 +9,8 @@ if [[ $# -lt 1 ]] ; then exit 1 fi +case "$EAPI" in 0|1|2) ED=${D} ;; esac + i18n="" ret=0 @@ -44,11 +46,11 @@ for x in "$@" ; do if [[ ${mandir} == *man[0-9n] ]] ; then if [[ -s ${x} ]] ; then - if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then - install -d "${D}/usr/share/man/${mandir}" + if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then + install -d "${ED}/usr/share/man/${mandir}" fi - install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}" + install -m0644 "${x}" "${ED}/usr/share/man/${mandir}/${name}" ((ret|=$?)) elif [[ ! -e ${x} ]] ; then echo "!!! ${0##*/}: $x does not exist" 1>&2 diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo index 4737f44e1..0e3656d58 100755 --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -9,8 +9,11 @@ if [ ${mynum} -lt 1 ] ; then helpers_die "${0}: at least one argument needed" exit 1 fi -if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then - install -d "${D}${DESTTREE}/share/locale/" + +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then + install -d "${ED}${DESTTREE}/share/locale/" fi ret=0 @@ -18,7 +21,7 @@ ret=0 for x in "$@" ; do if [ -e "${x}" ] ; then mytiny="${x##*/}" - mydir="${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES" + mydir="${ED}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES" if [ ! -d "${mydir}" ] ; then install -d "${mydir}" fi diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin index 87a30914a..d0783ed33 100755 --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -9,15 +9,17 @@ if [[ $# -lt 1 ]] ; then exit 1 fi -if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then - install -d "${D}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/sbin"; exit 2; } +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then + install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; } fi ret=0 for x in "$@" ; do if [[ -e ${x} ]] ; then - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin" + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/sbin" else echo "!!! ${0##*/}: ${x} does not exist" 1>&2 false diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed index afc949ba5..00cf5da17 100755 --- a/bin/ebuild-helpers/dosed +++ b/bin/ebuild-helpers/dosed @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 if [[ $# -lt 1 ]] ; then @@ -7,12 +7,14 @@ if [[ $# -lt 1 ]] ; then exit 1 fi +case "$EAPI" in 0|1|2) ED=${D} ;; esac + ret=0 file_found=0 -mysed="s:${D}::g" +mysed="s:${ED}::g" for x in "$@" ; do - y=$D${x#/} + y=$ED${x#/} if [ -e "${y}" ] ; then if [ -f "${y}" ] ; then file_found=1 diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym index 7dd4c6d51..8b7b304ee 100755 --- a/bin/ebuild-helpers/dosym +++ b/bin/ebuild-helpers/dosym @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -9,16 +9,18 @@ if [[ $# -ne 2 ]] ; then exit 1 fi +case "$EAPI" in 0|1|2) ED=${D} ;; esac + if [[ ${2} == */ ]] || \ - [[ -d ${D}${2} && ! -L ${D}${2} ]] ; then + [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then # implicit basename not allowed by PMS (bug #379899) eqawarn "QA Notice: dosym target omits basename: '${2}'" fi destdir=${2%/*} -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" +[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" -ln -snf "$1" "${D}$2" +ln -snf "$1" "${ED}$2" ret=$? [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" exit $ret diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir index 7a95120a9..76c271861 100755 --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -9,19 +9,21 @@ if [[ -z $1 ]] ; then exit 1 fi +case "$EAPI" in 0|1|2) ED=${D} ;; esac + case $1 in --ignore) shift for skip in "$@" ; do - [[ -d ${D}${skip} || -f ${D}${skip} ]] \ - && >> "${D}${skip}.ecompress.skip" + [[ -d ${ED}${skip} || -f ${ED}${skip} ]] \ + && >> "${ED}${skip}.ecompress.skip" done exit 0 ;; --queue) shift set -- "${@/%/.ecompress.dir}" - set -- "${@/#/${D}}" + set -- "${@/#/${ED}}" ret=0 for x in "$@" ; do >> "$x" @@ -32,10 +34,10 @@ case $1 in ;; --dequeue) [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2 - find "${D}" -name '*.ecompress.dir' -print0 \ - | sed -e 's:\.ecompress\.dir::g' -e "s:${D}:/:g" \ + find "${ED}" -name '*.ecompress.dir' -print0 \ + | sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \ | ${XARGS} -0 ecompressdir - find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f + find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f exit 0 ;; --*) @@ -95,8 +97,8 @@ _relocate_skip_dirs() { mv "${src}.ecompress.skip" "${dst}.ecompress.skip" done } -hide_skip_dirs() { _relocate_skip_dirs "${D}" "${T}"/ecompress-skip/ ; } -restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${D}" ; } +hide_skip_dirs() { _relocate_skip_dirs "${ED}" "${T}"/ecompress-skip/ ; } +restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${ED}" ; } ret=0 @@ -104,9 +106,9 @@ rm -rf "${T}"/ecompress-skip for dir in "$@" ; do dir=${dir#/} - dir="${D}${dir}" + dir="${ED}${dir}" if [[ ! -d ${dir} ]] ; then - vecho "${0##*/}: /${dir#${D}} does not exist!" + vecho "${0##*/}: /${dir#${ED}} does not exist!" continue fi cd "${dir}" @@ -132,7 +134,7 @@ for dir in "$@" ; do # now lets do our work [[ -z ${suffix} ]] && continue - vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}" + vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}" funk_up_dir "compress" "${suffix}" "ecompress" # finally, restore the skipped stuff diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners index 4cc6bfacc..3f51b4e54 100755 --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@ -1,13 +1,15 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 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) ED=${D} ;; esac + # we can't prefix all arguments because # chown takes random options slash="/" -chown "${@/#${slash}/${D}${slash}}" +chown "${@/#${slash}/${ED}${slash}}" ret=$? [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" exit $ret diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms index 0260bdc47..9a2971ae5 100755 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@ -1,13 +1,14 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 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) ED=${D} ;; esac # we can't prefix all arguments because # chmod takes random options slash="/" -chmod "${@/#${slash}/${D}${slash}}" +chmod "${@/#${slash}/${ED}${slash}}" ret=$? [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" exit $ret diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall index 701ecba21..611c4ce79 100755 --- a/bin/ebuild-helpers/prepall +++ b/bin/ebuild-helpers/prepall @@ -4,12 +4,14 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +case "$EAPI" in 0|1|2) ED=${D} ;; esac + if has chflags $FEATURES ; then # Save all the file flags for restoration at the end of prepall. - mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree" + mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree" # Remove all the file flags so that prepall can do anything necessary. - chflags -R noschg,nouchg,nosappnd,nouappnd "${D}" - chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null + chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}" + chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null fi prepallman @@ -19,5 +21,5 @@ prepallstrip if has chflags $FEATURES ; then # Restore all the file flags that were saved at the beginning of prepall. - mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null + mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null fi diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs index fdc735d6f..540d02500 100755 --- a/bin/ebuild-helpers/prepalldocs +++ b/bin/ebuild-helpers/prepalldocs @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh @@ -8,8 +8,9 @@ if [[ -n $1 ]] ; then vecho "${0##*/}: invalid usage; takes no arguments" 1>&2 fi -cd "${D}" -[[ -d usr/share/doc ]] || exit 0 +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +[[ -d ${ED}usr/share/doc ]] || exit 0 ecompressdir --ignore /usr/share/doc/${PF}/html ecompressdir --queue /usr/share/doc diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo index 0d978034b..e351f878b 100755 --- a/bin/ebuild-helpers/prepallinfo +++ b/bin/ebuild-helpers/prepallinfo @@ -1,9 +1,11 @@ #!/bin/bash -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh -[[ ! -d ${D}usr/share/info ]] && exit 0 +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +[[ -d ${ED}usr/share/info ]] || exit 0 exec prepinfo diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman index e50de6d67..be7f19453 100755 --- a/bin/ebuild-helpers/prepallman +++ b/bin/ebuild-helpers/prepallman @@ -7,11 +7,13 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh # replaced by controllable compression in EAPI 4 has "${EAPI}" 0 1 2 3 || exit 0 +case "$EAPI" in 0|1|2) ED=${D} ;; esac + ret=0 -find "${D}" -type d -name man > "${T}"/prepallman.filelist +find "${ED}" -type d -name man > "${T}"/prepallman.filelist while read -r mandir ; do - mandir=${mandir#${D}} + mandir=${mandir#${ED}} prepman "${mandir%/man}" ((ret|=$?)) done < "${T}"/prepallman.filelist diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip index ec12ce663..e9f5f8e3e 100755 --- a/bin/ebuild-helpers/prepallstrip +++ b/bin/ebuild-helpers/prepallstrip @@ -1,5 +1,7 @@ #!/bin/bash -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -exec prepstrip "${D}" +case "$EAPI" in 0|1|2) ED=${D} ;; esac + +exec prepstrip "${ED}" diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo index 691fd1372..afe214c6b 100755 --- a/bin/ebuild-helpers/prepinfo +++ b/bin/ebuild-helpers/prepinfo @@ -4,17 +4,19 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +case "$EAPI" in 0|1|2) ED=${D} ;; esac + if [[ -z $1 ]] ; then infodir="/usr/share/info" else - if [[ -d ${D}$1/share/info ]] ; then + if [[ -d ${ED}$1/share/info ]] ; then infodir="$1/share/info" else infodir="$1/info" fi fi -if [[ ! -d ${D}${infodir} ]] ; then +if [[ ! -d ${ED}${infodir} ]] ; then if [[ -n $1 ]] ; then vecho "${0##*/}: '${infodir}' does not exist!" exit 1 @@ -23,7 +25,7 @@ if [[ ! -d ${D}${infodir} ]] ; then fi fi -find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do +find "${ED}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do for f in "${x}"/.keepinfodir*; do [[ -e ${f} ]] && continue 2 done diff --git a/bin/ebuild-helpers/preplib b/bin/ebuild-helpers/preplib index 76aabe64c..8c6292101 100755 --- a/bin/ebuild-helpers/preplib +++ b/bin/ebuild-helpers/preplib @@ -1,11 +1,13 @@ #!/bin/bash -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh eqawarn "QA Notice: Deprecated call to 'preplib'" +case "$EAPI" in 0|1|2) ED=${D} ;; esac + LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then CONF_LIBDIR="${!LIBDIR_VAR}" @@ -18,9 +20,9 @@ if [ -z "${CONF_LIBDIR}" ]; then fi if [ -z "$1" ] ; then - z="${D}usr/${CONF_LIBDIR}" + z="${ED}usr/${CONF_LIBDIR}" else - z="${D}$1/${CONF_LIBDIR}" + z="${ED}$1/${CONF_LIBDIR}" fi if [ -d "${z}" ] ; then diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman index c9add8a30..8ea7607df 100755 --- a/bin/ebuild-helpers/prepman +++ b/bin/ebuild-helpers/prepman @@ -4,14 +4,16 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +case "$EAPI" in 0|1|2) ED=${D} ;; esac + if [[ -z $1 ]] ; then - mandir="${D}usr/share/man" + mandir="${ED}usr/share/man" else - mandir="${D}$1/man" + mandir="${ED}$1/man" fi if [[ ! -d ${mandir} ]] ; then - eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'" + eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED}}'" exit 0 fi @@ -27,6 +29,6 @@ for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do [[ -d ${subdir} ]] && really_is_mandir=1 && break done -[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}" +[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${ED}}" exit 0 diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index 8c2ca4839..fac20b24f 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -18,6 +18,8 @@ exp_tf() { exp_tf FEATURES installsources nostrip splitdebug exp_tf RESTRICT binchecks installsources strip +case "$EAPI" in 0|1|2) ED=${D} ;; esac + banner=false SKIP_STRIP=false if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then @@ -99,7 +101,7 @@ save_elf_debug() { ${FEATURES_splitdebug} || return 0 local x=$1 - local y="${D}usr/lib/debug/${x:${#D}}.debug" + local y="${ED}usr/lib/debug/${x:${#ED}}.debug" # dont save debug info twice [[ ${x} == *".debug" ]] && return 0 @@ -108,7 +110,7 @@ save_elf_debug() { local inode=$(inode_var_name "$x") if [[ -n ${!inode} ]] ; then - ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y" + ln "${ED}usr/lib/debug/${!inode:${#ED}}.debug" "$y" else eval $inode=\$x if [[ -e ${T}/prepstrip.split.debug ]] ; then @@ -129,18 +131,18 @@ save_elf_debug() { | awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; print $2 }') fi if [[ -n ${buildid} ]] ; then - local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}" + local buildid_dir="${ED}usr/lib/debug/.build-id/${buildid:0:2}" local buildid_file="${buildid_dir}/${buildid:2}" mkdir -p "${buildid_dir}" - ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug" - ln -s "/${x:${#D}}" "${buildid_file}" + ln -s "../../${x:${#ED}}.debug" "${buildid_file}.debug" + ln -s "/${x:${#ED}}" "${buildid_file}" fi } process_elf() { local x=$1 strip_flags=${*:2} - vecho " ${x:${#D}}" + vecho " ${x:${#ED}}" save_elf_sources "${x}" if ${strip_this} ; then @@ -165,7 +167,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then log=$T/scanelf-already-stripped.log qa_var="QA_PRESTRIPPED_${ARCH/-/_}" [[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}" - scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log" + scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "$log" if [[ -n $QA_PRESTRIPPED && -s $log && \ ${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then shopts=$- @@ -206,7 +208,7 @@ do set -o noglob strip_this=true for m in $(eval echo ${STRIP_MASK}) ; do - [[ /${x#${D}} == ${m} ]] && strip_this=false && break + [[ /${x#${ED}} == ${m} ]] && strip_this=false && break done set +o noglob else @@ -221,7 +223,7 @@ do buildid= if [[ ${f} == *"current ar archive"* ]] ; then - vecho " ${x:${#D}}" + vecho " ${x:${#ED}}" if ${strip_this} ; then # hmm, can we split debug/sources for .a ? ${STRIP} -g "${x}" @@ -239,10 +241,10 @@ if [[ -s ${T}/debug.sources ]] && \ ${debugedit_found} then vecho "installsources: rsyncing source files" - [[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}" + [[ -d ${ED}${prepstrip_sources_dir} ]] || mkdir -p "${ED}${prepstrip_sources_dir}" grep -zv '/<[^/>]*>$' "${T}"/debug.sources | \ (cd "${WORKDIR}"; LANG=C sort -z -u | \ - rsync -tL0 --files-from=- "${WORKDIR}/" "${D}${prepstrip_sources_dir}/" ) + rsync -tL0 --files-from=- "${WORKDIR}/" "${ED}${prepstrip_sources_dir}/" ) # Preserve directory structure. # Needed after running save_elf_sources. @@ -250,5 +252,5 @@ then while read -r -d $'\0' emptydir do >> "$emptydir"/.keepdir - done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0) + done < <(find "${ED}${prepstrip_sources_dir}/" -type d -empty -print0) fi -- cgit v1.2.3-1-g7c22