From: Fabian Groffen Date: Fri, 2 Dec 2011 19:14:03 +0000 (+0100) Subject: Merge commit 'v2.2.0_alpha74' into prefix X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8546a58d3ce8359538c6847d3b7330322fb2c133;p=portage.git Merge commit 'v2.2.0_alpha74' into prefix Most important, fix the _doebuild_path function for Prefix Conflicts: bin/dohtml.py bin/ebuild-helpers/dobin bin/ebuild-helpers/dodir bin/ebuild-helpers/dodoc bin/ebuild-helpers/doexe bin/ebuild-helpers/dohard bin/ebuild-helpers/doinfo bin/ebuild-helpers/doins bin/ebuild-helpers/dolib bin/ebuild-helpers/domo bin/ebuild-helpers/dosbin bin/ebuild-helpers/dosed bin/ebuild-helpers/dosym bin/ebuild-helpers/ecompressdir bin/ebuild-helpers/fowners bin/ebuild-helpers/fperms bin/ebuild-helpers/prepalldocs bin/ebuild-helpers/prepallinfo bin/ebuild-helpers/prepallman bin/ebuild-helpers/prepallstrip bin/ebuild-helpers/prepinfo bin/ebuild-helpers/preplib bin/ebuild-helpers/prepstrip bin/ebuild.sh bin/misc-functions.sh bin/phase-helpers.sh pym/portage/dbapi/bintree.py --- 8546a58d3ce8359538c6847d3b7330322fb2c133 diff --cc bin/dohtml.py index bf9bcc836,122daf3f5..546e6989d --- a/bin/dohtml.py +++ b/bin/dohtml.py @@@ -91,8 -91,10 +91,13 @@@ class OptionsClass if "PF" in os.environ: self.PF = os.environ["PF"] - if os.environ.has_key("ED"): - self.ED = os.environ["ED"] - if os.environ.get("EAPI", "0") in ("0", "1", "2"): - self.ED = os.environ.get("D", "") - else: ++ # PREFIX LOCAL: always retrieve ED ++ #if os.environ.get("EAPI", "0") in ("0", "1", "2"): ++ # self.ED = os.environ.get("D", "") ++ #else: ++ if True: + self.ED = os.environ.get("ED", "") ++ # END PREFIX LOCAL if "_E_DOCDESTTREE_" in os.environ: self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"] diff --cc bin/ebuild-helpers/dobin index e158a7176,af3af0d84..8adc65d48 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@@ -9,6 -9,8 +9,10 @@@ if [[ $# -lt 1 ]] ; the exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; } fi diff --cc bin/ebuild-helpers/dodir index 7da507aee,7db7cafb1..06dd2fe72 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@@ -1,9 -1,11 +1,13 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + install -d ${DIROPTIONS} "${@/#/${ED}/}" ret=$? [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" diff --cc bin/ebuild-helpers/dodoc index 41fc8f5ac,37bbc79d0..d1bcb4f26 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@@ -1,5 -1,4 +1,4 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - #!/bin/bash # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@@ -10,7 -9,9 +9,11 @@@ if [ $# -lt 1 ] ; the exit 1 fi - dir="${ED}/usr/share/doc/${PF}/${_E_DOCDESTTREE_}" -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + + dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" if [ ! -d "${dir}" ] ; then install -d "${dir}" fi diff --cc bin/ebuild-helpers/doexe index 4f4040283,a5b9af0eb..ecf0b9a4c --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@@ -1,14 -1,16 +1,18 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then helpers_die "${0##*/}: at least one argument needed" exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then install -d "${ED}${_E_EXEDESTTREE_}" fi diff --cc bin/ebuild-helpers/dohard index c7c568ce2,cf6fb112d..b5f8f70e4 --- a/bin/ebuild-helpers/dohard +++ b/bin/ebuild-helpers/dohard @@@ -1,5 -1,5 +1,5 @@@ -#!/bin/bash +#!@PORTAGE_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,6 -7,8 +7,10 @@@ exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + destdir=${2%/*} [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" diff --cc bin/ebuild-helpers/doinfo index 3cfbe6f32,a922ef1be..56d9821d8 --- a/bin/ebuild-helpers/doinfo +++ b/bin/ebuild-helpers/doinfo @@@ -1,5 -1,5 +1,5 @@@ -#!/bin/bash +#!@PORTAGE_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,6 -9,8 +9,10 @@@ if [[ -z $1 ]] ; the exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + 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 diff --cc bin/ebuild-helpers/doins index c91883ba7,b9189d5ed..46796cb3b --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@@ -32,16 -34,9 +34,16 @@@ if [[ ${INSDESTTREE#${ED}} != "${INSDES 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 +if [[ ${INSDESTTREE#${EPREFIX}} != "${INSDESTTREE}" ]]; then + vecho "-------------------------------------------------------" 1>&2 + vecho "You should not use \${EPREFIX} with helpers." 1>&2 + vecho " --> ${INSDESTTREE}" 1>&2 + vecho "-------------------------------------------------------" 1>&2 + exit 1 +fi case "$EAPI" in 0|1|2|3|3_pre2) diff --cc bin/ebuild-helpers/dolib index 53805ea30,9dd11d857..5b1b1be28 --- a/bin/ebuild-helpers/dolib +++ b/bin/ebuild-helpers/dolib @@@ -1,9 -1,11 +1,13 @@@ -#!/bin/bash +#!@PORTAGE_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 ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + # Setup ABI cruft LIBDIR_VAR="LIBDIR_${ABI}" if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then diff --cc bin/ebuild-helpers/domo index f8a7bb94a,0e3656d58..33af83ed6 --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@@ -1,5 -1,5 +1,5 @@@ -#!/bin/bash +#!@PORTAGE_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,6 -9,9 +9,11 @@@ if [ ${mynum} -lt 1 ] ; the helpers_die "${0}: at least one argument needed" exit 1 fi + -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then install -d "${ED}${DESTTREE}/share/locale/" fi diff --cc bin/ebuild-helpers/dosbin index d1400f44e,d0783ed33..e52df7173 --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@@ -1,14 -1,16 +1,18 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then helpers_die "${0##*/}: at least one argument needed" exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; } fi diff --cc bin/ebuild-helpers/dosed index 40cf39a05,00cf5da17..5e234b317 --- a/bin/ebuild-helpers/dosed +++ b/bin/ebuild-helpers/dosed @@@ -1,5 -1,5 +1,5 @@@ -#!/bin/bash +#!@PORTAGE_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,6 -7,8 +7,10 @@@ exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + ret=0 file_found=0 mysed="s:${ED}::g" diff --cc bin/ebuild-helpers/dosym index 16e0df059,8b7b304ee..e5da3332f --- a/bin/ebuild-helpers/dosym +++ b/bin/ebuild-helpers/dosym @@@ -1,14 -1,16 +1,18 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ $# -ne 2 ]] ; then helpers_die "${0##*/}: two arguments needed" exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + if [[ ${2} == */ ]] || \ [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then # implicit basename not allowed by PMS (bug #379899) @@@ -18,9 -20,7 +22,11 @@@ f destdir=${2%/*} [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" -ln -snf "$1" "${ED}$2" ++# PREFIX LOCAL: when absolute, prefix with offset +target="${1}" +[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}" - ln -snf "${target}" "${ED}/${2}" ++ln -snf "${target}" "${ED}${2}" ++# END PREFIX LOCAL ret=$? [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed" exit $ret diff --cc bin/ebuild-helpers/ecompressdir index 3d5af2d95,f9a846a90..32196695a --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@@ -1,14 -1,16 +1,18 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ -z $1 ]] ; then helpers_die "${0##*/}: at least one argument needed" exit 1 fi -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + case $1 in --ignore) shift diff --cc bin/ebuild-helpers/fowners index 0c5295b78,3f51b4e54..5c1ecac8b --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@@ -1,14 -1,11 +1,18 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac +if hasq prefix ${USE} && [[ $EUID != 0 ]] ; then + ewarn "fowners ignored in Prefix with non-privileged user" + exit 0 +fi + ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + # we can't prefix all arguments because # chown takes random options slash="/" diff --cc bin/ebuild-helpers/fperms index dec0b4294,9a2971ae5..25f77a9b7 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@@ -1,9 -1,10 +1,12 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL # we can't prefix all arguments because # chmod takes random options slash="/" diff --cc bin/ebuild-helpers/prepall index a765756cc,611c4ce79..c4e9ffccd --- a/bin/ebuild-helpers/prepall +++ b/bin/ebuild-helpers/prepall @@@ -2,10 -2,10 +2,12 @@@ # 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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + +[[ -d ${ED} ]] || exit 0 + 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 "${ED}" -k flags > "${T}/bsdflags.mtree" diff --cc bin/ebuild-helpers/prepalldocs index ab4166efe,540d02500..67a3d8f3a --- a/bin/ebuild-helpers/prepalldocs +++ b/bin/ebuild-helpers/prepalldocs @@@ -1,15 -1,16 +1,18 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ -n $1 ]] ; then vecho "${0##*/}: invalid usage; takes no arguments" 1>&2 fi - cd "${D}" - [[ -d ${EPREFIX}usr/share/doc ]] || exit 0 -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + + [[ -d ${ED}usr/share/doc ]] || exit 0 ecompressdir --ignore /usr/share/doc/${PF}/html ecompressdir --queue /usr/share/doc diff --cc bin/ebuild-helpers/prepallinfo index 249e897a2,e351f878b..2b1b5b48e --- a/bin/ebuild-helpers/prepallinfo +++ b/bin/ebuild-helpers/prepallinfo @@@ -1,7 -1,11 +1,13 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 1999-2006 Gentoo Foundation + # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - [[ ! -d ${ED}usr/share/info ]] && exit 0 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BIN_PATH@}"/isolated-functions.sh + -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + + [[ -d ${ED}usr/share/info ]] || exit 0 exec prepinfo diff --cc bin/ebuild-helpers/prepallman index 19437dd00,be7f19453..a7bb30b55 --- a/bin/ebuild-helpers/prepallman +++ b/bin/ebuild-helpers/prepallman @@@ -7,10 -7,10 +7,16 @@@ source "${PORTAGE_BIN_PATH:-@PORTAGE_BA # replaced by controllable compression in EAPI 4 has "${EAPI}" 0 1 2 3 || exit 0 -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + ret=0 ++# PREFIX LOCAL: ED needs not to exist, wheras D does +[[ -d ${ED} ]] || exit ${ret} ++# END PREFIX LOCAL + find "${ED}" -type d -name man > "${T}"/prepallman.filelist while read -r mandir ; do mandir=${mandir#${ED}} diff --cc bin/ebuild-helpers/prepallstrip index 18ce4cc3c,e9f5f8e3e..b03c05318 --- a/bin/ebuild-helpers/prepallstrip +++ b/bin/ebuild-helpers/prepallstrip @@@ -1,5 -1,7 +1,9 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 1999-2006 Gentoo Foundation + # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + exec prepstrip "${ED}" diff --cc bin/ebuild-helpers/prepinfo index c350fba0f,afe214c6b..c0ab9c9fb --- a/bin/ebuild-helpers/prepinfo +++ b/bin/ebuild-helpers/prepinfo @@@ -2,15 -2,17 +2,19 @@@ # 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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + if [[ -z $1 ]] ; then - infodir="${EPREFIX}/usr/share/info" + infodir="/usr/share/info" else if [[ -d ${ED}$1/share/info ]] ; then - infodir="${EPREFIX}$1/share/info" + infodir="$1/share/info" else - infodir="${EPREFIX}$1/info" + infodir="$1/info" fi fi diff --cc bin/ebuild-helpers/preplib index 8b9e04d48,8c6292101..7090d0c25 --- a/bin/ebuild-helpers/preplib +++ b/bin/ebuild-helpers/preplib @@@ -1,11 -1,13 +1,15 @@@ -#!/bin/bash +#!@PORTAGE_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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh eqawarn "QA Notice: Deprecated call to 'preplib'" -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then CONF_LIBDIR="${!LIBDIR_VAR}" diff --cc bin/ebuild-helpers/prepman index f8c670fec,8ea7607df..2c10b26f9 --- a/bin/ebuild-helpers/prepman +++ b/bin/ebuild-helpers/prepman @@@ -2,8 -2,10 +2,10 @@@ # 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 +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + case "$EAPI" in 0|1|2) ED=${D} ;; esac + if [[ -z $1 ]] ; then mandir="${ED}usr/share/man" else diff --cc bin/ebuild-helpers/prepstrip index 0305f0a3a,fac20b24f..927078aee --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@@ -18,6 -18,8 +18,10 @@@ exp_tf() exp_tf FEATURES installsources nostrip splitdebug exp_tf RESTRICT binchecks installsources strip -case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# PREFIX LOCAL: always support ED ++#case "$EAPI" in 0|1|2) ED=${D} ;; esac ++# END PREFIX LOCAL + banner=false SKIP_STRIP=false if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then @@@ -99,7 -101,7 +103,9 @@@ save_elf_debug() ${FEATURES_splitdebug} || return 0 local x=$1 - local y="${ED}usr/lib/debug/${x:${#ED}}.debug" ++ # PREFIX LOCAL: keep offset path in debug location file + local y="${ED}usr/lib/debug/${x:${#D}}.debug" ++ # END PREFIX LOCAL # dont save debug info twice [[ ${x} == *".debug" ]] && return 0 @@@ -108,7 -110,7 +114,9 @@@ local inode=$(inode_var_name "$x") if [[ -n ${!inode} ]] ; then - ln "${ED}usr/lib/debug/${!inode:${#ED}}.debug" "$y" ++ # PREFIX LOCAL: keep offset path in debug location file + ln "${ED}usr/lib/debug/${!inode:${#D}}.debug" "$y" ++ # END PREFIX LOCAL else eval $inode=\$x if [[ -e ${T}/prepstrip.split.debug ]] ; then diff --cc bin/ebuild.sh index 79525154f,f39e5362a..2ec34cd96 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@@ -2,23 -2,9 +2,9 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" -PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" +PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}" +PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym}" - ROOTPATH=${ROOTPATH##:} - ROOTPATH=${ROOTPATH%%:} - PREROOTPATH=${PREROOTPATH##:} - PREROOTPATH=${PREROOTPATH%%:} - #PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH - # PREFIX: our DEFAULT_PATH is equal to the above when not using an - # offset prefix. With such prefix, the usr/local bits are excluded, and - # the prefixed variants of {usr/,}{s,}bin are taken. The additional - # paths given during configure, always come as last thing since they - # should never override anything from the prefix itself. - PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}" - export PATH - - # Prevent aliases from causing portage to act inappropriately. # Make sure it's before everything so we don't mess aliases that follow. unalias -a diff --cc bin/isolated-functions.sh index 12edfbcd9,d2ea319bd..d9e46493a --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@@ -436,36 -438,25 +440,31 @@@ RC_INDENTATION=' RC_DEFAULT_INDENT=2 RC_DOT_PATTERN='' - if [[ $EBUILD_PHASE == depend ]] ; then - # avoid unneeded stty call in set_colors during "depend" phase - unset_colors - else - case "${NOCOLOR:-false}" in - yes|true) - unset_colors - ;; - no|false) - set_colors - ;; - esac - fi + case "${NOCOLOR:-false}" in + yes|true) + unset_colors + ;; + no|false) + set_colors + ;; + esac -if [[ -z ${USERLAND} ]] ; then - case $(uname -s) in - *BSD|DragonFly) - export USERLAND="BSD" - ;; - *) - export USERLAND="GNU" - ;; - esac -fi +# In Prefix every platform has USERLAND=GNU, even FreeBSD. Since I +# don't know how to reliably "figure out" we are in a Prefix instance of +# portage here, I for now disable this check, and hardcode it to GNU. +# Somehow it appears stange to me that this code is in this file, +# non-ebuilds/eclasses should never rely on USERLAND and XARGS, don't they? +#if [[ -z ${USERLAND} ]] ; then +# case $(uname -s) in +# *BSD|DragonFly) +# export USERLAND="BSD" +# ;; +# *) +# export USERLAND="GNU" +# ;; +# esac +#fi +[[ -z ${USERLAND} ]] && USERLAND="GNU" if [[ -z ${XARGS} ]] ; then case ${USERLAND} in diff --cc bin/misc-functions.sh index b0933825f,1c11dc51a..58f5bc8e6 mode 100644,100755..100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@@ -14,12 -14,11 +14,16 @@@ MISC_FUNCTIONS_ARGS="$@" shift $# -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh" +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}/ebuild.sh" install_symlink_html_docs() { - cd "${D}" || die "cd failed" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL ++ # PREFIX LOCAL: ED need not to exist, whereas D does + [[ ! -d ${ED} ]] && dodir / - cd "${ED}" || die "cd shouldn't have failed" ++ # END PREFIX LOCAL + cd "${ED}" || die "cd failed" #symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf) if [ -n "${DOC_SYMLINKS_DIR}" ] ; then local mydocdir docdir @@@ -147,8 -147,9 +152,13 @@@ prepcompress() install_qa_check() { local f i x - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL - cd "${ED}" || die "cd failed" ++ # PREFIX LOCAL: ED needs not to exist, whereas D does + cd "${D}" || die "cd failed" ++ # END PREFIX LOCAL export STRIP_MASK prepall @@@ -177,40 -181,6 +190,37 @@@ sleep 1 fi + # anything outside the prefix should be caught by the Prefix QA + # check, so if there's nothing in ED, we skip searching for QA + # checks there, the specific QA funcs can hence rely on ED existing + if [[ -d ${ED} ]] ; then + case ${CHOST} in + *-darwin*) + # Mach-O platforms (NeXT, Darwin, OSX) + install_qa_check_macho + ;; + *-interix*|*-winnt*) + # PECOFF platforms (Windows/Interix) + install_qa_check_pecoff + ;; + *-aix*) + # XCOFF platforms (AIX) + install_qa_check_xcoff + ;; + *) + # because this is the majority: ELF platforms (Linux, + # Solaris, *BSD, IRIX, etc.) + install_qa_check_elf + ;; + esac + fi + + # this is basically here such that the diff with trunk remains just + # offsetted and not out of order + install_qa_check_misc - - # Prefix specific checks - [[ -n ${EPREFIX} ]] && install_qa_check_prefix +} + +install_qa_check_elf() { if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT}; then local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET} local x @@@ -339,8 -309,6 +349,7 @@@ if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then qa_var="QA_DT_HASH_${ARCH/-/_}" eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")" - # use ED here, for the rest of the checks of scanelf's - # output, scanelf is silent on non-existing ED ++ f=$(scanelf -qyRF '%k %p' -k .hash "${ED}" | sed -e "s:\.hash ::") if [[ -n ${f} ]] ; then echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log @@@ -457,7 -425,7 +466,9 @@@ # 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* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ED}:/:") ++ # PREFIX LOCAL: keep offset prefix in the recorded files + f=$(scanelf -ByF '%n %p' "${ED}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:") ++ # END PREFIX LOCAL if [[ -n ${f} ]] ; then echo "${f}" > "${T}"/scanelf-missing-NEEDED.log if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then @@@ -490,10 -458,8 +501,12 @@@ PORTAGE_QUIET=${tmp_quiet} fi +} - local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${ED}:/:") +install_qa_check_misc() { - local unsafe_files=$(find "${D}" -type f '(' -perm -2002 -o -perm -4002 ')') ++ # PREFIX LOCAL: keep offset prefix in the reported files ++ local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${D}:/:") ++ # END PREFIX LOCAL if [[ -n ${unsafe_files} ]] ; then eqawarn "QA Notice: Unsafe files detected (set*id and world writable)" eqawarn "${unsafe_files}" @@@ -566,9 -534,7 +579,11 @@@ abort="no" local a s for a in "${ED}"usr/lib*/*.a ; do - s=${a%.a}.so ++ # PREFIX LOCAL: support MachO objects + [[ ${CHOST} == *-darwin* ]] \ + && s=${a%.a}.dylib \ + || s=${a%.a}.so ++ # END PREFIX LOCAL if [[ ! -e ${s} ]] ; then s=${s%usr/*}${s##*/usr/} if [[ -e ${s} ]] ; then @@@ -581,11 -547,7 +596,12 @@@ [[ ${abort} == "yes" ]] && die "add those ldscripts" # Make sure people don't store libtool files or static libs in /lib - # on AIX, "dynamic libs" have extension .a, so don't get false - # positives - f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null) ++ # PREFIX LOCAL: on AIX, "dynamic libs" have extension .a, so don't ++ # get false positives + [[ ${CHOST} == *-aix* ]] \ + && f=$(ls "${ED}"lib*/*.la 2>/dev/null || true) \ + || f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null) ++ # END PREFIX LOCAL if [[ -n ${f} ]] ; then vecho -ne '\n' eqawarn "QA Notice: Excessive files found in the / partition" @@@ -894,372 -856,6 +910,371 @@@ install_qa_check_prefix() fi } +install_qa_check_macho() { + if ! has binchecks ${RESTRICT} ; then + # on Darwin, dynamic libraries are called .dylibs instead of + # .sos. In addition the version component is before the + # extension, not after it. Check for this, and *only* warn + # about it. Some packages do ship .so files on Darwin and make + # it work (ugly!). + rm -f "${T}/mach-o.check" + find ${ED%/} -name "*.so" -or -name "*.so.*" | \ + while read i ; do + [[ $(file $i) == *"Mach-O"* ]] && \ + echo "${i#${D}}" >> "${T}/mach-o.check" + done + if [[ -f ${T}/mach-o.check ]] ; then + f=$(< "${T}/mach-o.check") + vecho -ne '\a\n' + eqawarn "QA Notice: Found .so dynamic libraries on Darwin:" + eqawarn " ${f//$'\n'/\n }" + fi + rm -f "${T}/mach-o.check" + + # The naming for dynamic libraries is different on Darwin; the + # version component is before the extention, instead of after + # it, as with .sos. Again, make this a warning only. + rm -f "${T}/mach-o.check" + find ${ED%/} -name "*.dylib.*" | \ + while read i ; do + echo "${i#${D}}" >> "${T}/mach-o.check" + done + if [[ -f "${T}/mach-o.check" ]] ; then + f=$(< "${T}/mach-o.check") + vecho -ne '\a\n' + eqawarn "QA Notice: Found wrongly named dynamic libraries on Darwin:" + eqawarn " ${f// /\n }" + fi + rm -f "${T}/mach-o.check" + fi + + # While we generate the NEEDED files, check that we don't get kernel + # traps at runtime because of broken install_names on Darwin. + rm -f "${T}"/.install_name_check_failed + scanmacho -qyRF '%a;%p;%S;%n' "${D}" | { while IFS= read l ; do + arch=${l%%;*}; l=${l#*;} + obj="/${l%%;*}"; l=${l#*;} + install_name=${l%%;*}; l=${l#*;} + needed=${l%%;*}; l=${l#*;} + + # See if the self-reference install_name points to an existing + # and to be installed file. This usually is a symlink for the + # major version. + if [[ ! -e ${D}${install_name} ]] ; then + eqawarn "QA Notice: invalid self-reference install_name ${install_name} in ${obj}" + # remember we are in an implicit subshell, that's + # why we touch a file here ... ideally we should be + # able to die correctly/nicely here + touch "${T}"/.install_name_check_failed + fi + + # this is ugly, paths with spaces won't work + reevaluate=0 + for lib in ${needed//,/ } ; do + if [[ ${lib} == ${D}* ]] ; then + eqawarn "QA Notice: install_name references \${D}: ${lib} in ${obj}" + touch "${T}"/.install_name_check_failed + elif [[ ${lib} == ${S}* ]] ; then + eqawarn "QA Notice: install_name references \${S}: ${lib} in ${obj}" + touch "${T}"/.install_name_check_failed + elif [[ ! -e ${lib} && ! -e ${D}${lib} && ${lib} != "@executable_path/"* && ${lib} != "@loader_path/"* ]] ; then + # try to "repair" this if possible, happens because of + # gen_usr_ldscript tactics + s=${lib%usr/*}${lib##*/usr/} + if [[ -e ${D}${s} ]] ; then + ewarn "correcting install_name from ${lib} to ${s} in ${obj}" + install_name_tool -change \ + "${lib}" "${s}" "${D}${obj}" + reevaluate=1 + else + eqawarn "QA Notice: invalid reference to ${lib} in ${obj}" + # remember we are in an implicit subshell, that's + # why we touch a file here ... ideally we should be + # able to die correctly/nicely here + touch "${T}"/.install_name_check_failed + fi + fi + done + if [[ ${reevaluate} == 1 ]]; then + # install_name(s) have been changed, refresh data so we + # store the correct meta data + l=$(scanmacho -qyF '%a;%p;%S;%n' ${D}${obj}) + arch=${l%%;*}; l=${l#*;} + obj="/${l%%;*}"; l=${l#*;} + install_name=${l%%;*}; l=${l#*;} + needed=${l%%;*}; l=${l#*;} + fi + + # backwards compatability + echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED + # what we use + echo "${arch};${obj};${install_name};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.MACHO.3 + done } + if [[ -f ${T}/.install_name_check_failed ]] ; then + # secret switch "allow_broken_install_names" to get + # around this and install broken crap (not a good idea) + has allow_broken_install_names ${FEATURES} || \ + die "invalid install_name found, your application or library will crash at runtime" + fi +} + +install_qa_check_pecoff() { + local _pfx_scan="readpecoff ${CHOST}" + + # this one uses readpecoff, which supports multiple prefix platforms! + # this is absolutely _not_ optimized for speed, and there may be plenty + # of possibilities by introducing one or the other cache! + if ! has binchecks ${RESTRICT}; then + # copied and adapted from the above scanelf code. + local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET} + local f x + + # display warnings when using stricter because we die afterwards + if has stricter ${FEATURES} ; then + unset PORTAGE_QUIET + fi + + local _exec_find_opt="-executable" + [[ ${CHOST} == *-winnt* ]] && _exec_find_opt='-name *.dll -o -name *.exe' + + # Make sure we disallow insecure RUNPATH/RPATH's + # Don't want paths that point to the tree where the package was built + # (older, broken libtools would do this). Also check for null paths + # because the loader will search $PWD when it finds null paths. + + f=$( + find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs -0 ${_pfx_scan} | \ + while IFS=";" read arch obj soname rpath needed ; do \ + echo "${rpath}" | grep -E "(${PORTAGE_BUILDDIR}|: |::|^:|^ )" > /dev/null 2>&1 \ + && echo "${obj}"; done; + ) + # Reject set*id binaries with $ORIGIN in RPATH #260331 + x=$( + find "${ED}" -type f '(' -perm -u+s -o -perm -g+s ')' -print0 | \ + xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; do \ + echo "${rpath}" | grep '$ORIGIN' > /dev/null 2>&1 && echo "${obj}"; done; + ) + if [[ -n ${f}${x} ]] ; then + vecho -ne '\a\n' + eqawarn "QA Notice: The following files contain insecure RUNPATH's" + eqawarn " Please file a bug about this at http://bugs.gentoo.org/" + eqawarn " with the maintaining herd of the package." + eqawarn "${f}${f:+${x:+\n}}${x}" + vecho -ne '\a\n' + if [[ -n ${x} ]] || has stricter ${FEATURES} ; then + insecure_rpath=1 + else + eqawarn "cannot automatically fix runpaths on interix platforms!" + fi + fi + + rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED + rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1 + + # Save NEEDED information after removing self-contained providers + find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs -0 ${_pfx_scan} | { while IFS=';' read arch obj soname rpath needed; do + # need to strip image dir from object name. + obj="/${obj#${D}}" + if [ -z "${rpath}" -o -n "${rpath//*ORIGIN*}" ]; then + # object doesn't contain $ORIGIN in its runpath attribute + echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED + echo "${arch};${obj};${soname};${rpath};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1 + else + dir=${obj%/*} + # replace $ORIGIN with the dirname of the current object for the lookup + opath=$(echo :${rpath}: | sed -e "s#.*:\(.*\)\$ORIGIN\(.*\):.*#\1${dir}\2#") + sneeded=$(echo ${needed} | tr , ' ') + rneeded="" + for lib in ${sneeded}; do + found=0 + for path in ${opath//:/ }; do + [ -e "${ED}/${path}/${lib}" ] && found=1 && break + done + [ "${found}" -eq 0 ] && rneeded="${rneeded},${lib}" + done + rneeded=${rneeded:1} + if [ -n "${rneeded}" ]; then + echo "${obj} ${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED + echo "${arch};${obj};${soname};${rpath};${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1 + fi + fi + done } + + if [[ ${insecure_rpath} -eq 1 ]] ; then + die "Aborting due to serious QA concerns with RUNPATH/RPATH" + elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then + die "Aborting due to QA concerns: ${die_msg}" + fi + + local _so_ext='.so*' + + case "${CHOST}" in + *-winnt*) _so_ext=".dll" ;; # no "*" intentionally! + esac + + # Run some sanity checks on shared libraries + for d in "${ED}"lib* "${ED}"usr/lib* ; do + [[ -d "${d}" ]] || continue + f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \ + xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; \ + do [[ -z "${soname}" ]] && echo "${obj}"; done) + if [[ -n ${f} ]] ; then + vecho -ne '\a\n' + eqawarn "QA Notice: The following shared libraries lack a SONAME" + eqawarn "${f}" + vecho -ne '\a\n' + sleep 1 + fi + + f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \ + xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; \ + do [[ -z "${needed}" ]] && echo "${obj}"; done) + if [[ -n ${f} ]] ; then + vecho -ne '\a\n' + eqawarn "QA Notice: The following shared libraries lack NEEDED entries" + eqawarn "${f}" + vecho -ne '\a\n' + sleep 1 + fi + done + + PORTAGE_QUIET=${tmp_quiet} + fi +} + +install_qa_check_xcoff() { + if ! has binchecks ${RESTRICT}; then + local tmp_quiet=${PORTAGE_QUIET} + local queryline deplib + local insecure_rpath_list= undefined_symbols_list= + + # display warnings when using stricter because we die afterwards + if has stricter ${FEATURES} ; then + unset PORTAGE_QUIET + fi + + rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1 + + local neededfd + for neededfd in {3..1024} none; do ( : <&${neededfd} ) 2>/dev/null || break; done + [[ ${neededfd} != none ]] || die "cannot find free file descriptor handle" + + eval "exec ${neededfd}>\"${PORTAGE_BUILDDIR}\"/build-info/NEEDED.XCOFF.1" || die "cannot open ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1" + + ( # work around a problem in /usr/bin/dump (used by aixdll-query) + # dumping core when path names get too long. + cd "${ED}" >/dev/null && + find . -not -type d -exec \ + aixdll-query '{}' FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS ';' + ) > "${T}"/needed 2>/dev/null + + # Symlinking shared archive libraries is not a good idea on aix, + # as there is nothing like "soname" on pure filesystem level. + # So we create a copy instead of the symlink. + local prev_FILE= + local FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS + while read queryline + do + FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS= + eval ${queryline} + FILE=${FILE#./} + + if [[ ${prev_FILE} != ${FILE} ]]; then + if [[ " ${FLAGS} " == *" SHROBJ "* && -h ${ED}${FILE} ]]; then + prev_FILE=${FILE} + local target=$(readlink "${ED}${FILE}") + if [[ ${target} == /* ]]; then + target=${D}${target} + else + target=${FILE%/*}/${target} + fi + rm -f "${ED}${FILE}" || die "cannot prune ${FILE}" + cp -f "${ED}${target}" "${ED}${FILE}" || die "cannot copy ${target} to ${FILE}" + fi + fi + done <"${T}"/needed + + prev_FILE= + while read queryline + do + FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS= + eval ${queryline} + FILE=${FILE#./} + + if [[ -n ${MEMBER} && ${prev_FILE} != ${FILE} ]]; then + # Save NEEDED information for each archive library stub + # even if it is static only: the already installed archive + # may contain shared objects to be preserved. + echo "${FORMAT##* }${FORMAT%%-*};${EPREFIX}/${FILE};${FILE##*/};;" >&${neededfd} + fi + prev_FILE=${FILE} + + # shared objects have both EXEC and SHROBJ flags, + # while executables have EXEC flag only. + [[ " ${FLAGS} " == *" EXEC "* ]] || continue + + # Make sure we disallow insecure RUNPATH's + # Don't want paths that point to the tree where the package was built + # (older, broken libtools would do this). Also check for null paths + # because the loader will search $PWD when it finds null paths. + # And we really want absolute paths only. + if [[ -n $(echo ":${RUNPATH}:" | grep -E "(${PORTAGE_BUILDDIR}|::|:[^/])") ]]; then + insecure_rpath_list="${insecure_rpath_list}\n${FILE}${MEMBER:+[${MEMBER}]}" + fi + + local needed= + [[ -n ${MEMBER} ]] && needed=${FILE##*/} + for deplib in ${DEPLIBS}; do + eval deplib=${deplib} + if [[ ${deplib} == '.' || ${deplib} == '..' ]]; then + # Although we do have runtime linking, we don't want undefined symbols. + # AIX does indicate this by needing either '.' or '..' + undefined_symbols_list="${undefined_symbols_list}\n${FILE}" + else + needed="${needed}${needed:+,}${deplib}" + fi + done + + FILE=${EPREFIX}/${FILE} + + [[ -n ${MEMBER} ]] && MEMBER="[${MEMBER}]" + # Save NEEDED information + echo "${FORMAT##* }${FORMAT%%-*};${FILE}${MEMBER};${FILE##*/}${MEMBER};${RUNPATH};${needed}" >&${neededfd} + done <"${T}"/needed + + eval "exec ${neededfd}>&-" || die "cannot close handle to ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1" + + if [[ -n ${undefined_symbols_list} ]]; then + vecho -ne '\a\n' + eqawarn "QA Notice: The following files contain undefined symbols." + eqawarn " Please file a bug about this at http://bugs.gentoo.org/" + eqawarn " with 'prefix' as the maintaining herd of the package." + eqawarn "${undefined_symbols_list}" + vecho -ne '\a\n' + fi + + if [[ -n ${insecure_rpath_list} ]] ; then + vecho -ne '\a\n' + eqawarn "QA Notice: The following files contain insecure RUNPATH's" + eqawarn " Please file a bug about this at http://bugs.gentoo.org/" + eqawarn " with 'prefix' as the maintaining herd of the package." + eqawarn "${insecure_rpath_list}" + vecho -ne '\a\n' + if has stricter ${FEATURES} ; then + insecure_rpath=1 + fi + fi + + if [[ ${insecure_rpath} -eq 1 ]] ; then + die "Aborting due to serious QA concerns with RUNPATH/RPATH" + elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then + die "Aborting due to QA concerns: ${die_msg}" + fi + + PORTAGE_QUIET=${tmp_quiet} + fi +} + - install_mask() { local root="$1" shift diff --cc bin/phase-helpers.sh index 04cc291de,04cf35aa4..ad469edd5 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@@ -19,6 -19,7 +19,9 @@@ into() export DESTTREE="" else export DESTTREE=$1 - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL if [ ! -d "${ED}${DESTTREE}" ]; then install -d "${ED}${DESTTREE}" local ret=$? @@@ -35,6 -36,7 +38,9 @@@ insinto() export INSDESTTREE="" else export INSDESTTREE=$1 - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL if [ ! -d "${ED}${INSDESTTREE}" ]; then install -d "${ED}${INSDESTTREE}" local ret=$? @@@ -51,6 -53,7 +57,9 @@@ exeinto() export _E_EXEDESTTREE_="" else export _E_EXEDESTTREE_="$1" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then install -d "${ED}${_E_EXEDESTTREE_}" local ret=$? @@@ -67,6 -70,7 +76,9 @@@ docinto() export _E_DOCDESTTREE_="" else export _E_DOCDESTTREE_="$1" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" local ret=$? @@@ -133,6 -137,7 +145,9 @@@ docompress() keepdir() { dodir "$@" local x - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then shift find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \ @@@ -369,6 -374,8 +384,10 @@@ unpack() econf() { local x - case "$EAPI" in 0|1|2) local EPREFIX= ;; esac ++ # PREFIX LOCAL: always support EPREFIX ++ #case "$EAPI" in 0|1|2) local EPREFIX= ;; esac ++ # END PREFIX LOCAL + _hasg() { local x s=$1 shift @@@ -463,6 -470,7 +482,9 @@@ einstall() { # CONF_PREFIX is only set if they didn't pass in libdir above. local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}" - case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # PREFIX LOCAL: always support ED ++ #case "$EAPI" in 0|1|2) local ED=${D} ;; esac ++ # END PREFIX LOCAL LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then CONF_LIBDIR="${!LIBDIR_VAR}" @@@ -581,15 -589,28 +603,30 @@@ _eapi4_src_install() fi } + # @FUNCTION: has_version + # @USAGE: + # @DESCRIPTION: # Return true if given package is installed. Otherwise return false. - # Takes single depend-type atoms. + # Callers may override the ROOT variable in order to match packages from an + # alternative ROOT. has_version() { + local eroot + case "$EAPI" in - 0|1|2) - eroot=${ROOT} - ;; ++ # PREFIX LOCAL: always support ED ++ #0|1|2) ++ # eroot=${ROOT} ++ # ;; ++ # END PREFIX LOCAL + *) + eroot=${ROOT%/}${EPREFIX}/ + ;; + esac if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" + "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "$1" else PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1" - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${eroot}" "$1" ++ "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" has_version "${eroot}" "$1" fi local retval=$? case "${retval}" in @@@ -602,15 -623,28 +639,30 @@@ esac } + # @FUNCTION: best_version + # @USAGE: + # @DESCRIPTION: # Returns the best/most-current match. - # Takes single depend-type atoms. + # Callers may override the ROOT variable in order to match packages from an + # alternative ROOT. best_version() { + local eroot + case "$EAPI" in - 0|1|2) - eroot=${ROOT} - ;; ++ # PREFIX LOCAL: always support ED ++ #0|1|2) ++ # eroot=${ROOT} ++ # ;; ++ # END PREFIX LOCAL + *) + eroot=${ROOT%/}${EPREFIX}/ + ;; + esac if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" + "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "$1" else PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" best_version "${ROOT}" "$1" - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" best_version "${eroot}" "$1" ++ "${PORTAGE_PYTHON:-@PORTAGE_PREFIX_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" best_version "${eroot}" "$1" fi local retval=$? case "${retval}" in diff --cc pym/_emerge/main.py index e9eb025cb,a2995e2b7..97a4b48e2 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@@ -98,9 -97,24 +98,24 @@@ shortmapping= "v":"--verbose", "V":"--version" } + COWSAY_MOO = """ + + Larry loves Gentoo (%s) + + _______________________ + < Have you mooed today? > + ----------------------- + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || + + """ + def chk_updated_info_files(root, infodirs, prev_mtimes, retval): - if os.path.exists("/usr/bin/install-info"): + if os.path.exists(EPREFIX + "/usr/bin/install-info"): out = portage.output.EOutput() regen_infodirs=[] for z in infodirs: diff --cc pym/portage/dbapi/bintree.py index 48c075f29,31ba364a4..5f46dad6e --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@@ -69,7 -68,7 +69,7 @@@ class bindbapi(fakedbapi) ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES", - "REQUIRED_USE", "EPREFIX"]) - ]) ++ "EPREFIX"]) self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys) self._aux_cache = {} @@@ -291,7 -290,7 +291,7 @@@ class binarytree(object) ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES", - "REQUIRED_USE", "BASE_URI", "EPREFIX"] - "BASE_URI"] ++ "BASE_URI", "EPREFIX"] self._pkgindex_aux_keys = list(self._pkgindex_aux_keys) self._pkgindex_use_evaluated_keys = \ ("LICENSE", "RDEPEND", "DEPEND", @@@ -317,9 -316,8 +317,8 @@@ "SLOT" : "0", "USE" : "", "DEFINED_PHASES" : "", - "REQUIRED_USE" : "" } - self._pkgindex_inherited_keys = ["CHOST", "repository"] + self._pkgindex_inherited_keys = ["CHOST", "repository", "EPREFIX"] # Populate the header with appropriate defaults. self._pkgindex_default_header_data = {