commit: 244a62a4f275e4282dc040be3c049e593c36c0ce Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed Mar 7 15:00:10 2018 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Mon Mar 12 20:11:44 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=244a62a4
Fix uses of D/ED to account for no trailing slash Fix all uses of D/ED to account for trailing slash not being present in EAPI 7. While at it, also remove some duplicate slashes. Reviewed-by: Zac Medico <zmedico <AT> gentoo.org> bin/ebuild-helpers/dobin | 6 +++--- bin/ebuild-helpers/dodir | 4 ++-- bin/ebuild-helpers/dodoc | 2 +- bin/ebuild-helpers/doexe | 8 ++++---- bin/ebuild-helpers/dohard | 6 +++--- bin/ebuild-helpers/doinfo | 8 ++++---- bin/ebuild-helpers/doins | 2 +- bin/ebuild-helpers/dolib | 2 +- bin/ebuild-helpers/doman | 8 ++++---- bin/ebuild-helpers/domo | 6 +++--- bin/ebuild-helpers/dosbin | 6 +++--- bin/ebuild-helpers/dosed | 4 ++-- bin/ebuild-helpers/dosym | 8 ++++---- bin/ebuild-helpers/ecompressdir | 25 ++++++++++++----------- bin/ebuild-helpers/fowners | 4 ++-- bin/ebuild-helpers/fperms | 4 ++-- bin/ebuild-helpers/keepdir | 6 +++--- bin/ebuild-helpers/prepalldocs | 4 ++-- bin/ebuild-helpers/prepallinfo | 4 ++-- bin/ebuild-helpers/prepinfo | 12 +++++------ bin/ebuild-helpers/prepman | 10 ++++----- bin/ebuild-helpers/prepstrip | 17 +++++++-------- bin/install-qa-check.d/60udev | 6 +++--- bin/install-qa-check.d/80libraries | 22 ++++++++++---------- bin/misc-functions.sh | 24 +++++++++++----------- bin/phase-helpers.sh | 42 +++++++++++++++++++------------------- 26 files changed, 126 insertions(+), 124 deletions(-) diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin index f43871f49..975067fb1 100755 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@ -21,15 +21,15 @@ else _E_DESTTREE_=${DESTTREE} fi -if [[ ! -d ${ED}${_E_DESTTREE_}/bin ]] ; then - install -d "${ED}${_E_DESTTREE_}/bin" || { __helpers_die "${0##*/}: failed to install ${ED}${_E_DESTTREE_}/bin"; exit 2; } +if [[ ! -d ${ED%/}/${_E_DESTTREE_#/}/bin ]] ; then + install -d "${ED%/}/${_E_DESTTREE_#/}/bin" || { __helpers_die "${0##*/}: failed to install ${ED%/}/${_E_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}" "${ED}${_E_DESTTREE_}/bin" + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${_E_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 eed2c8b8f..9b376c73f 100755 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -8,7 +8,7 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -install -d ${DIROPTIONS} "${@/#/${ED}/}" +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 75029eb20..84936e400 100755 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@ -17,7 +17,7 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" +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 8c4b9e97c..152c13bf6 100755 --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -13,8 +13,8 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then - install -d "${ED}${_E_EXEDESTTREE_}" +if [[ ! -d ${ED%/}/${_E_EXEDESTTREE_#/} ]] ; then + install -d "${ED%/}/${_E_EXEDESTTREE_#/}" fi TMP=$(mktemp -d "${T}/.doexe_tmp_XXXXXX") @@ -32,7 +32,7 @@ for x in "$@" ; do mysrc="${x}" fi if [ -e "$mysrc" ] ; then - install $EXEOPTIONS "$mysrc" "$ED$_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 8a93fad4f..66e2604b0 100755 --- a/bin/ebuild-helpers/dohard +++ b/bin/ebuild-helpers/dohard @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -19,6 +19,6 @@ if ! ___eapi_has_prefix_variables; then fi destdir=${2%/*} -[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" +[[ ! -d ${ED%/}/${destdir#/} ]] && dodir "${destdir}" -exec ln -f "${ED}$1" "${ED}$2" +exec ln -f "${ED%/}/${1#/}" "${ED%/}/${2#/}" diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo index 24b5ddd89..30a38e055 100755 --- a/bin/ebuild-helpers/doinfo +++ b/bin/ebuild-helpers/doinfo @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -13,11 +13,11 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -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; } +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 "$@" "${ED}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 327d409a4..fb5fc7c7c 100755 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@ -83,7 +83,7 @@ fi DOINS_ARGS+=( "--helper=${helper}" - "--dest=${ED}${_E_INSDESTTREE_}" + "--dest=${ED%/}/${_E_INSDESTTREE_#/}" ) # Explicitly set PYTHONPATH to non empty. diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib index 2800fad76..bd8eebca7 100755 --- a/bin/ebuild-helpers/dolib +++ b/bin/ebuild-helpers/dolib @@ -29,7 +29,7 @@ fi unset LIBDIR_VAR # we need this to default to lib so that things dont break CONF_LIBDIR=${CONF_LIBDIR:-lib} -libdir="${ED}${_E_DESTTREE_}/${CONF_LIBDIR}" +libdir="${ED%/}/${_E_DESTTREE_#/}/${CONF_LIBDIR}" if [[ $# -lt 1 ]] ; then diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman index 43d29f22e..9cfc89df0 100755 --- a/bin/ebuild-helpers/doman +++ b/bin/ebuild-helpers/doman @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -49,11 +49,11 @@ for x in "$@" ; do if [[ ${mandir} == *man[0-9n] ]] ; then if [[ -s ${x} ]] ; then - if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then - install -d "${ED}/usr/share/man/${mandir}" + if [[ ! -d ${ED%/}/usr/share/man/${mandir} ]] ; then + install -d "${ED%/}/usr/share/man/${mandir}" fi - install -m0644 "${x}" "${ED}/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 70f93d61e..2e95eb751 100755 --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@ -27,8 +27,8 @@ if ! ___eapi_domo_respects_into; then _E_DESTTREE_=/usr fi -if [ ! -d "${ED}${_E_DESTTREE_}/share/locale" ] ; then - install -d "${ED}${_E_DESTTREE_}/share/locale/" +if [ ! -d "${ED%/}/${_E_DESTTREE_#/}/share/locale" ] ; then + install -d "${ED%/}/${_E_DESTTREE_#/}/share/locale/" fi ret=0 @@ -36,7 +36,7 @@ ret=0 for x in "$@" ; do if [ -e "${x}" ] ; then mytiny="${x##*/}" - mydir="${ED}${_E_DESTTREE_}/share/locale/${mytiny%.*}/LC_MESSAGES" + mydir="${ED%/}/${_E_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 f698f6fbb..ac0ab37ca 100755 --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@ -21,15 +21,15 @@ else _E_DESTTREE_=${DESTTREE} fi -if [[ ! -d ${ED}${_E_DESTTREE_}/sbin ]] ; then - install -d "${ED}${_E_DESTTREE_}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED}${_E_DESTTREE_}/sbin"; exit 2; } +if [[ ! -d ${ED%/}/${_E_DESTTREE_#/}/sbin ]] ; then + install -d "${ED%/}/${_E_DESTTREE_#/}/sbin" || { __helpers_die "${0##*/}: failed to install ${ED%/}/${_E_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}" "${ED}${_E_DESTTREE_}/sbin" + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${_E_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 1e10d129d..37c8a29d3 100755 --- a/bin/ebuild-helpers/dosed +++ b/bin/ebuild-helpers/dosed @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -23,7 +23,7 @@ file_found=0 mysed="s:${ED}::g" for x in "$@" ; do - y=$ED${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 e96039146..d5a651bf5 100755 --- a/bin/ebuild-helpers/dosym +++ b/bin/ebuild-helpers/dosym @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -13,13 +13,13 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -if [[ ${2} == */ ]] || [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then +if [[ ${2} == */ ]] || [[ -d ${ED%/}/${2#/} && ! -L ${ED%/}/${2#/} ]] ; then # implicit basename not allowed by PMS (bug #379899) __helpers_die "${0##*/}: dosym target omits basename: '${2}'" fi destdir=${2%/*} -[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" +[[ ! -d ${ED%/}/${destdir#/} ]] && dodir "${destdir}" target="${1}" # DEPRECATED HACK: when absolute, prefix with offset for Gentoo Prefix # (but only if ${EPREFIX} is not there already) @@ -29,7 +29,7 @@ if [[ ${target:0:1} == "/" && ${target}/ != "${EPREFIX}"/* ]]; then eqawarn " please fix the ebuild to use \${EPREFIX} explicitly." target="${EPREFIX}${target}" fi -ln -snf "${target}" "${ED}${2}" +ln -snf "${target}" "${ED%/}/${2#/}" ret=$? [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed" diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir index 4f57262e9..fb4c39f2b 100755 --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/helper-functions.sh || exit 1 @@ -19,15 +19,16 @@ while [[ $# -gt 0 ]] ; do --ignore) shift for skip in "$@" ; do - [[ -d ${ED}${skip} || -f ${ED}${skip} ]] \ - && >> "${ED}${skip}.ecompress.skip" + [[ -d ${ED%/}/${skip#/} || -f ${ED%/}/${skip#/} ]] \ + && >> "${ED%/}/${skip#/}.ecompress.skip" done exit 0 ;; --queue) shift + set -- "${@#/}" set -- "${@/%/.ecompress.dir}" - set -- "${@/#/${ED}}" + set -- "${@/#/${ED%/}/}" ret=0 for x in "$@" ; do # Stash the limit in the .dir file so we can reload it later. @@ -40,7 +41,7 @@ while [[ $# -gt 0 ]] ; do --dequeue) [[ -n $2 ]] && __vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2 find "${ED}" -name '*.ecompress.dir' -print0 \ - | sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \ + | sed -e 's:\.ecompress\.dir::g' -e "s:${ED%/}::g" \ | ${XARGS} -0 ecompressdir find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f exit 0 @@ -98,10 +99,10 @@ funk_up_dir() { # absolute symlinks to files that aren't merged # yet (bug #405327). if [[ ${olddest} == /* ]] ; then - [ -e "${D}${olddest}" ] && continue + [ -e "${D%/}${olddest}" ] && continue skip_dir_dest=${T}/ecompress-skip/${olddest#${EPREFIX}} else - skip_dir_dest=${T}/ecompress-skip/${actual_dir#${ED}}/${brokenlink%/*}/${olddest} + skip_dir_dest=${T}/ecompress-skip/${actual_dir#${ED%/}}/${brokenlink%/*}/${olddest} fi [[ -e ${skip_dir_dest} ]] && continue if [[ ${act} == "compress" ]] ; then @@ -111,7 +112,7 @@ funk_up_dir() { newdest=${olddest%${suffix}} fi if [[ "${newdest}" == /* ]] ; then - [[ -f "${D}${newdest}" ]] || continue + [[ -f "${D%/}${newdest}" ]] || continue else [[ -f "${dir}/${brokenlink%/*}/${newdest}" ]] || continue fi @@ -127,7 +128,7 @@ funk_up_dir() { if (( indirection >= 100 )) ; then # Protect against possibility of a bug triggering an endless loop. eerror "ecompressdir: too many levels of indirection for" \ - "'${actual_dir#${ED}}/${something_changed#./}'" + "'${actual_dir#${ED%/}}/${something_changed#./}'" break fi done @@ -171,9 +172,9 @@ __multijob_init for dir in "$@" ; do dir=${dir#/} - dir="${ED}${dir}" + dir="${ED%/}/${dir#/}" if [[ ! -d ${dir} ]] ; then - __vecho "${0##*/}: /${dir#${ED}} does not exist!" + __vecho "${0##*/}: /${dir#${ED%/}} does not exist!" continue fi cd "${dir}" @@ -212,7 +213,7 @@ for dir in "$@" ; do # now lets do our work if [[ -n ${suffix} ]] ; then - __vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}" + __vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED%/}}" funk_up_dir "compress" "${suffix}" "ecompress" "${size_limit}" : $(( ret |= $? )) fi diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners index 85f7fd614..68004210b 100755 --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -11,7 +11,7 @@ fi # we can't prefix all arguments because # chown takes random options slash="/" -chown "${@/#${slash}/${ED}${slash}}" +chown "${@/#${slash}/${ED%/}${slash}}" ret=$? [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed" diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms index 297679cd0..c63a6abc3 100755 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -11,7 +11,7 @@ fi # we can't prefix all arguments because # chmod takes random options slash="/" -chmod "${@/#${slash}/${ED}${slash}}" +chmod "${@/#${slash}/${ED%/}${slash}}" ret=$? [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed" exit $ret diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir index e0c852d08..a3c0c151c 100755 --- a/bin/ebuild-helpers/keepdir +++ b/bin/ebuild-helpers/keepdir @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -12,8 +12,8 @@ dodir "$@" ret=$? for x in "$@"; do - >> "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT%/*}" || \ - { echo "!!! ${0##*/}: cannot write .keep in ${ED}${x}" 1>&2; ret=1; } + >> "${ED%/}/${x#/}/.keep_${CATEGORY}_${PN}-${SLOT%/*}" || \ + { echo "!!! ${0##*/}: cannot write .keep in ${ED%/}/${x#/}" 1>&2; ret=1; } done [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed" diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs index cf63c64ed..6cdceb318 100755 --- a/bin/ebuild-helpers/prepalldocs +++ b/bin/ebuild-helpers/prepalldocs @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -17,7 +17,7 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -[[ -d ${ED}usr/share/doc ]] || exit 0 +[[ -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 cdf149e43..34d6a74b7 100755 --- a/bin/ebuild-helpers/prepallinfo +++ b/bin/ebuild-helpers/prepallinfo @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -8,6 +8,6 @@ if ! ___eapi_has_prefix_variables; then ED=${D} fi -[[ -d ${ED}usr/share/info ]] || exit 0 +[[ -d ${ED%/}/usr/share/info ]] || exit 0 exec prepinfo diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo index a64d144a3..eb1b6a7e3 100755 --- a/bin/ebuild-helpers/prepinfo +++ b/bin/ebuild-helpers/prepinfo @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 @@ -11,14 +11,14 @@ fi if [[ -z $1 ]] ; then infodir="/usr/share/info" else - if [[ -d ${ED}$1/share/info ]] ; then - infodir="$1/share/info" + if [[ -d ${ED%/}/${1#/}/share/info ]] ; then + infodir="${1#/}/share/info" else - infodir="$1/info" + infodir="${1#/}/info" fi fi -if [[ ! -d ${ED}${infodir} ]] ; then +if [[ ! -d ${ED%/}/${infodir#/} ]] ; then if [[ -n $1 ]] ; then __vecho "${0##*/}: '${infodir}' does not exist!" exit 1 @@ -27,7 +27,7 @@ if [[ ! -d ${ED}${infodir} ]] ; then fi fi -find "${ED}${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/prepman b/bin/ebuild-helpers/prepman index e64acc0b0..5e9fe45b6 100755 --- a/bin/ebuild-helpers/prepman +++ b/bin/ebuild-helpers/prepman @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Do not compress man pages which are smaller than this (in bytes). #169260 @@ -12,13 +12,13 @@ if ! ___eapi_has_prefix_variables; then fi if [[ -z $1 ]] ; then - mandir="${ED}usr/share/man" + mandir="${ED%/}/usr/share/man" else - mandir="${ED}$1/man" + mandir="${ED%/}/${1#/}/man" fi if [[ ! -d ${mandir} ]] ; then - eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED}}'" + eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED%/}}'" exit 0 fi @@ -34,6 +34,6 @@ for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do [[ -d ${subdir} ]] && really_is_mandir=1 && break done -[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --limit ${SIZE_LIMIT} --queue "${mandir#${ED}}" +[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --limit ${SIZE_LIMIT} --queue "${mandir#${ED%/}}" exit 0 diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip index 929547ae5..9b895c60b 100755 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 source "${PORTAGE_BIN_PATH}"/helper-functions.sh || exit 1 @@ -143,7 +143,8 @@ save_elf_debug() { local x=$1 local inode_debug=$2 local splitdebug=$3 - local y=${ED}usr/lib/debug/${x:${#D}}.debug + local d_noslash=${D%/} + local y=${ED%/}/usr/lib/debug/${x:${#d_noslash}}.debug # dont save debug info twice [[ ${x} == *".debug" ]] && return 0 @@ -177,7 +178,7 @@ save_elf_debug() { buildid=$(${READELF} -n "${x}" 2>/dev/null | awk '/Build ID:/{ print $NF; exit }') fi if [[ -n ${buildid} ]] ; then - local buildid_dir="${ED}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}" [ -L "${buildid_file}".debug ] || ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug" @@ -254,7 +255,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then # and start stripping the files ourselves. The log parsing can be done in # parallel though. log=${tmpdir}/scanelf-already-stripped.log - scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "${log}" + scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED%/}##" > "${log}" ( __multijob_child_init qa_var="QA_PRESTRIPPED_${ARCH/-/_}" @@ -324,7 +325,7 @@ do set -o noglob strip_this=true for m in $(eval echo ${STRIP_MASK}) ; do - [[ /${x#${ED}} == ${m} ]] && strip_this=false && break + [[ /${x#${ED%/}} == ${m} ]] && strip_this=false && break done set +o noglob else @@ -384,10 +385,10 @@ if [[ -s ${tmpdir}/debug.sources ]] && \ ${debugedit_found} then __vecho "installsources: rsyncing source files" - [[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}" + [[ -d ${D%/}/${prepstrip_sources_dir#/} ]] || mkdir -p "${D%/}/${prepstrip_sources_dir#/}" grep -zv '/<[^/>]*>$' "${tmpdir}"/debug.sources | \ (cd "${WORKDIR}"; LANG=C sort -z -u | \ - rsync -tL0 --chmod=ugo-st,a+r,go-w,Da+x,Fa-x --files-from=- "${WORKDIR}/" "${D}${prepstrip_sources_dir}/" ) + rsync -tL0 --chmod=ugo-st,a+r,go-w,Da+x,Fa-x --files-from=- "${WORKDIR}/" "${D%/}/${prepstrip_sources_dir#/}/" ) # Preserve directory structure. # Needed after running save_elf_sources. @@ -395,7 +396,7 @@ then while read -r -d $'\0' emptydir do >> "${emptydir}"/.keepdir - done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0) + done < <(find "${D%/}/${prepstrip_sources_dir#/}/" -type d -empty -print0) fi cd "${T}" diff --git a/bin/install-qa-check.d/60udev b/bin/install-qa-check.d/60udev index 4327d069d..c48d7d598 100644 --- a/bin/install-qa-check.d/60udev +++ b/bin/install-qa-check.d/60udev @@ -3,10 +3,10 @@ udev_check() { set +f local x f= - for x in "${ED}etc/udev/rules.d/"* "${ED}lib"*"/udev/rules.d/"* ; do + for x in "${ED%/}/etc/udev/rules.d/"* "${ED%/}/lib"*"/udev/rules.d/"* ; do [[ -e ${x} ]] || continue - [[ ${x} == ${ED}lib/udev/rules.d/* ]] && continue - f+=" ${x#${ED}}\n" + [[ ${x} == ${ED%/}/lib/udev/rules.d/* ]] && continue + f+=" ${x#${ED%/}}\n" done if [[ -n $f ]] ; then eqawarn "QA Notice: udev rules should be installed in /lib/udev/rules.d:" diff --git a/bin/install-qa-check.d/80libraries b/bin/install-qa-check.d/80libraries index e891b2d29..bbabc0eb9 100644 --- a/bin/install-qa-check.d/80libraries +++ b/bin/install-qa-check.d/80libraries @@ -6,7 +6,7 @@ scanelf_lib_check() { # Check for shared libraries lacking SONAMEs local qa_var="QA_SONAME_${ARCH/-/_}" eval "[[ -n \${!qa_var} ]] && QA_SONAME=(\"\${${qa_var}[@]}\")" - f=$(scanelf -ByF '%S %p' "${ED}"{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:") + f=$(scanelf -ByF '%S %p' "${ED%/}"/{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED%/}/:/:") if [[ -n ${f} ]] ; then echo "${f}" > "${T}"/scanelf-missing-SONAME.log if [[ "${QA_STRICT_SONAME-unset}" == unset ]] ; then @@ -40,7 +40,7 @@ scanelf_lib_check() { # Check for shared libraries lacking NEEDED entries qa_var="QA_DT_NEEDED_${ARCH/-/_}" eval "[[ -n \${!qa_var} ]] && QA_DT_NEEDED=(\"\${${qa_var}[@]}\")" - f=$(scanelf -ByF '%n %p' "${ED}"{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:") + f=$(scanelf -ByF '%n %p' "${ED%/}"/{,usr/}lib*/lib*.so* | awk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED%/}/:/:") if [[ -n ${f} ]] ; then echo "${f}" > "${T}"/scanelf-missing-NEEDED.log if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then @@ -81,16 +81,16 @@ lib_check() { # this should help to ensure that all (most?) shared libraries are executable # and that all libtool scripts / static libraries are not executable - for i in "${ED}"opt/*/lib* \ - "${ED}"lib* \ - "${ED}"usr/lib* ; do + for i in "${ED%/}"/opt/*/lib* \ + "${ED%/}"/lib* \ + "${ED%/}"/usr/lib* ; do [[ ! -d ${i} ]] && continue for j in "${i}"/*.so.* "${i}"/*.so ; do [[ ! -e ${j} ]] && continue [[ -L ${j} ]] && continue [[ -x ${j} ]] && continue - __vecho "making executable: ${j#${ED}}" + __vecho "making executable: ${j#${ED%/}}" chmod +x "${j}" done @@ -98,7 +98,7 @@ lib_check() { [[ ! -e ${j} ]] && continue [[ -L ${j} ]] && continue [[ ! -x ${j} ]] && continue - __vecho "removing executable bit: ${j#${ED}}" + __vecho "removing executable bit: ${j#${ED%/}}" chmod -x "${j}" done @@ -109,7 +109,7 @@ lib_check() { if [[ ${linkdest} == /* ]] ; then __vecho -ne '\n' eqawarn "QA Notice: Found an absolute symlink in a library directory:" - eqawarn " ${j#${D}} -> ${linkdest}" + eqawarn " ${j#${D%/}} -> ${linkdest}" eqawarn " It should be a relative symlink if in the same directory" eqawarn " or a linker script if it crosses the /usr boundary." fi @@ -122,7 +122,7 @@ lib_check() { # https://bugs.gentoo.org/4411 local abort="no" local a s - for a in "${ED}"usr/lib*/*.a ; do + for a in "${ED%/}"/usr/lib*/*.a ; do s=${a%.a}.so if [[ ! -e ${s} ]] ; then s=${s%usr/*}${s##*/usr/} @@ -136,7 +136,7 @@ lib_check() { [[ ${abort} == "yes" ]] && die "add those ldscripts" # Make sure people don't store libtool files or static libs in /lib - f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null) + f=$(ls "${ED%/}"/lib*/*.{a,la} 2>/dev/null) if [[ -n ${f} ]] ; then __vecho -ne '\n' eqawarn "QA Notice: Excessive files found in the / partition" @@ -147,7 +147,7 @@ lib_check() { # Verify that the libtool files don't contain bogus $D entries. local abort=no gentoo_bug=no always_overflow=no - for a in "${ED}"usr/lib*/*.la ; do + for a in "${ED%/}"/usr/lib*/*.la ; do s=${a##*/} if grep -qs "${ED}" "${a}" ; then __vecho -ne '\n' diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index a02aa3bfd..7643af7b5 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # Miscellaneous shell functions that make use of the ebuild env but don't need @@ -87,7 +87,7 @@ prepcompress() { # Canonicalize path names and check for their existence. real_d=$(canonicalize "${ED}") for (( i = 0; i < ${#PORTAGE_DOCOMPRESS[@]}; i++ )); do - real_f=$(canonicalize "${ED}${PORTAGE_DOCOMPRESS[i]}") + real_f=$(canonicalize "${ED%/}/${PORTAGE_DOCOMPRESS[i]#/}") f=${real_f#"${real_d}"} if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]] then @@ -98,7 +98,7 @@ prepcompress() { fi done for (( i = 0; i < ${#PORTAGE_DOCOMPRESS_SKIP[@]}; i++ )); do - real_f=$(canonicalize "${ED}${PORTAGE_DOCOMPRESS_SKIP[i]}") + real_f=$(canonicalize "${ED%/}/${PORTAGE_DOCOMPRESS_SKIP[i]#/}") f=${real_f#"${real_d}"} if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]] then @@ -147,7 +147,7 @@ prepcompress() { # Split the include list into directories and files for f in "${include[@]}"; do - if [[ -d ${ED}${f} ]]; then + if [[ -d ${ED%/}/${f#/} ]]; then incl_d[${#incl_d[@]}]=${f} else incl_f[${#incl_f[@]}]=${f} @@ -157,7 +157,7 @@ prepcompress() { # Queue up for compression. # ecompress{,dir} doesn't like to be called with empty argument lists. [[ ${#incl_d[@]} -gt 0 ]] && ecompressdir --limit ${PORTAGE_DOCOMPRESS_SIZE_LIMIT:-0} --queue "${incl_d[@]}" - [[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${ED}}" + [[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${ED%/}}" [[ ${#exclude[@]} -gt 0 ]] && ecompressdir --ignore "${exclude[@]}" return 0 } @@ -253,7 +253,7 @@ install_qa_check() { fi # Portage regenerates this on the installed system. - rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!" + rm -f "${ED%/}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!" } preinst_qa_check() { @@ -387,7 +387,7 @@ preinst_mask() { # remove share dir if unnessesary if has nodoc $FEATURES || has noman $FEATURES || has noinfo $FEATURES; then - rmdir "${ED}usr/share" &> /dev/null + rmdir "${ED%/}/usr/share" &> /dev/null fi } @@ -407,11 +407,11 @@ preinst_sfperms() { find "${ED}" -type f -perm -4000 -print0 | \ while read -r -d $'\0' i ; do if [ -n "$(find "$i" -perm -2000)" ] ; then - ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${ED}}" + ebegin ">>> SetUID and SetGID: [chmod o-r] ${i#${ED%/}}" chmod o-r "$i" eend $? else - ebegin ">>> SetUID: [chmod go-r] /${i#${ED}}" + ebegin ">>> SetUID: [chmod go-r] ${i#${ED%/}}" chmod go-r "$i" eend $? fi @@ -423,7 +423,7 @@ preinst_sfperms() { # by the SetUID check above. true else - ebegin ">>> SetGID: [chmod o-r] /${i#${ED}}" + ebegin ">>> SetGID: [chmod o-r] ${i#${ED%/}}" chmod o-r "$i" eend $? fi @@ -452,7 +452,7 @@ preinst_suid_scan() { __vecho ">>> Performing suid scan in ${ED}" for i in $(find "${ED}" -type f \( -perm -4000 -o -perm -2000 \) ); do if [ -s "${sfconf}" ]; then - install_path=/${i#${ED}} + install_path=${i#${ED%/}} if grep -q "^${install_path}\$" "${sfconf}" ; then __vecho "- ${install_path} is an approved suid file" else @@ -462,7 +462,7 @@ preinst_suid_scan() { chmod ugo-s "${i}" grep "^#${install_path}$" "${sfconf}" > /dev/null || { __vecho ">>> Appending commented out entry to ${sfconf} for ${PF}" - echo "## ${ls_ret%${ED}*}${install_path}" >> "${sfconf}" + echo "## ${ls_ret%${ED%/}*}${install_path}" >> "${sfconf}" echo "#${install_path}" >> "${sfconf}" # no delwrite() eh? # delwrite ${sconf} diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 3a2138636..5eeecfef7 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -29,8 +29,8 @@ into() { if ! ___eapi_has_prefix_variables; then local ED=${D} fi - if [ ! -d "${ED}${_E_DESTTREE_}" ]; then - install -d "${ED}${_E_DESTTREE_}" + if [ ! -d "${ED%/}/${_E_DESTTREE_#/}" ]; then + install -d "${ED%/}/${_E_DESTTREE_#/}" local ret=$? if [[ $ret -ne 0 ]] ; then __helpers_die "${FUNCNAME[0]} failed" @@ -52,8 +52,8 @@ insinto() { if ! ___eapi_has_prefix_variables; then local ED=${D} fi - if [ ! -d "${ED}${_E_INSDESTTREE_}" ]; then - install -d "${ED}${_E_INSDESTTREE_}" + if [ ! -d "${ED%/}/${_E_INSDESTTREE_#/}" ]; then + install -d "${ED%/}/${_E_INSDESTTREE_#/}" local ret=$? if [[ $ret -ne 0 ]] ; then __helpers_die "${FUNCNAME[0]} failed" @@ -75,8 +75,8 @@ exeinto() { if ! ___eapi_has_prefix_variables; then local ED=${D} fi - if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then - install -d "${ED}${_E_EXEDESTTREE_}" + if [ ! -d "${ED%/}/${_E_EXEDESTTREE_#/}" ]; then + install -d "${ED%/}/${_E_EXEDESTTREE_#/}" local ret=$? if [[ $ret -ne 0 ]] ; then __helpers_die "${FUNCNAME[0]} failed" @@ -94,8 +94,8 @@ docinto() { if ! ___eapi_has_prefix_variables; then local ED=${D} fi - if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then - install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" + if [ ! -d "${ED%/}/usr/share/doc/${PF}/${_E_DOCDESTTREE_#/}" ]; then + install -d "${ED%/}/usr/share/doc/${PF}/${_E_DOCDESTTREE_#/}" local ret=$? if [[ $ret -ne 0 ]] ; then __helpers_die "${FUNCNAME[0]} failed" @@ -707,7 +707,7 @@ einstall() { fi unset LIBDIR_VAR if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then - EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}" + EI_DESTLIBDIR="${D%/}/${CONF_PREFIX}/${CONF_LIBDIR}" EI_DESTLIBDIR="$(__strip_duplicate_slashes "${EI_DESTLIBDIR}")" LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}" unset EI_DESTLIBDIR @@ -715,22 +715,22 @@ einstall() { if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then if [ "${PORTAGE_DEBUG}" == "1" ]; then - ${MAKE:-make} -n prefix="${ED}usr" \ - datadir="${ED}usr/share" \ - infodir="${ED}usr/share/info" \ - localstatedir="${ED}var/lib" \ - mandir="${ED}usr/share/man" \ - sysconfdir="${ED}etc" \ + ${MAKE:-make} -n prefix="${ED%/}/usr" \ + datadir="${ED%/}/usr/share" \ + infodir="${ED%/}/usr/share/info" \ + localstatedir="${ED%/}/var/lib" \ + mandir="${ED%/}/usr/share/man" \ + sysconfdir="${ED%/}/etc" \ ${LOCAL_EXTRA_EINSTALL} \ ${MAKEOPTS} -j1 \ "$@" ${EXTRA_EMAKE} install fi - if ! ${MAKE:-make} prefix="${ED}usr" \ - datadir="${ED}usr/share" \ - infodir="${ED}usr/share/info" \ - localstatedir="${ED}var/lib" \ - mandir="${ED}usr/share/man" \ - sysconfdir="${ED}etc" \ + if ! ${MAKE:-make} prefix="${ED%/}/usr" \ + datadir="${ED%/}/usr/share" \ + infodir="${ED%/}/usr/share/info" \ + localstatedir="${ED%/}/var/lib" \ + mandir="${ED%/}/usr/share/man" \ + sysconfdir="${ED%/}/etc" \ ${LOCAL_EXTRA_EINSTALL} \ ${MAKEOPTS} -j1 \ "$@" ${EXTRA_EMAKE} install