From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RZ78O-00031p-HL for garchives@archives.gentoo.org; Fri, 09 Dec 2011 20:33:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 22F4021C04F; Fri, 9 Dec 2011 20:33:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id BC74D21C04F for ; Fri, 9 Dec 2011 20:33:24 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2F77A1B4008 for ; Fri, 9 Dec 2011 20:33:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AD54F80042 for ; Fri, 9 Dec 2011 20:33:23 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <868bcc349966d957d51b302b530f3299dd8fb5c8.grobian@gentoo> Subject: [gentoo-commits] proj/portage:prefix commit in: / X-VCS-Repository: proj/portage X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 868bcc349966d957d51b302b530f3299dd8fb5c8 Date: Fri, 9 Dec 2011 20:33:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 54995fd2-4d62-4bbd-8db1-ccb05dd8abf1 X-Archives-Hash: 5ff131613c9fbde973aaa7e5df0db0cf commit: 868bcc349966d957d51b302b530f3299dd8fb5c8 Author: Fabian Groffen gentoo org> AuthorDate: Fri Dec 9 20:32:39 2011 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Dec 9 20:32:39 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D868bcc34 Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix Conflicts: bin/dispatch-conf 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/emerge-webrsync bin/etc-update bin/misc-functions.sh bin/phase-functions.sh bin/phase-helpers.sh cnf/dispatch-conf.conf cnf/make.conf cnf/make.globals pym/portage/data.py pym/portage/dispatch_conf.py pym/portage/package/ebuild/_config/special_env_vars.py pym/portage/package/ebuild/config.py bin/dispatch-conf | 5 +- bin/ebuild-helpers/dobin | 7 +- bin/ebuild-helpers/dodir | 5 +- bin/ebuild-helpers/dodoc | 5 +- bin/ebuild-helpers/doexe | 5 +- bin/ebuild-helpers/dohard | 5 +- bin/ebuild-helpers/doinfo | 5 +- bin/ebuild-helpers/doins | 7 +- bin/ebuild-helpers/dolib | 5 +- bin/ebuild-helpers/doman | 3 +- bin/ebuild-helpers/domo | 5 +- bin/ebuild-helpers/dosbin | 5 +- bin/ebuild-helpers/dosed | 5 +- bin/ebuild-helpers/dosym | 5 +- bin/ebuild-helpers/ecompressdir | 5 +- bin/ebuild-helpers/fowners | 7 +- bin/ebuild-helpers/fperms | 6 +- bin/ebuild-helpers/prepall | 3 +- bin/ebuild-helpers/prepalldocs | 5 +- bin/ebuild-helpers/prepallinfo | 5 +- bin/ebuild-helpers/prepallman | 5 +- bin/ebuild-helpers/prepallstrip | 5 +- bin/ebuild-helpers/prepinfo | 5 +- bin/ebuild-helpers/preplib | 5 +- bin/ebuild-helpers/prepman | 3 +- bin/ebuild-helpers/prepstrip | 9 +- bin/ebuild.sh | 23 ++- bin/egencache | 2 +- bin/emerge-webrsync | 9 +- bin/etc-update | 12 +- bin/misc-functions.sh | 47 ++--- bin/phase-functions.sh | 28 +++- bin/phase-helpers.sh | 53 +++--- bin/portageq | 4 + bin/repoman | 6 +- cnf/dispatch-conf.conf | 2 +- cnf/make.conf | 17 +- cnf/make.globals | 14 +- doc/config/sets.docbook | 2 +- man/emerge.1 | 21 ++- man/fixpackages.1 | 15 ++ man/make.conf.5 | 6 + pym/_emerge/actions.py | 43 +++-- pym/_emerge/depgraph.py | 15 ++- pym/portage/_legacy_globals.py | 1 + pym/portage/const.py | 20 ++- pym/portage/data.py | 196 +++++++++++++-= ------ pym/portage/dbapi/porttree.py | 38 +---- pym/portage/dispatch_conf.py | 12 +- .../package/ebuild/_config/special_env_vars.py | 2 +- pym/portage/package/ebuild/config.py | 28 ++- pym/portage/package/ebuild/doebuild.py | 10 +- pym/portage/repository/config.py | 24 ++- pym/portage/tests/bin/setup_env.py | 6 +- pym/portage/tests/util/test_getconfig.py | 2 +- 55 files changed, 461 insertions(+), 332 deletions(-) diff --cc bin/dispatch-conf index 6a77f7b,1cad9e0..e639b66 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@@ -92,7 -85,7 +92,7 @@@ class dispatch confs =3D [] count =3D 0 =20 - config_root =3D EPREFIX - config_root =3D os.environ.get("__PORTAGE_TEST_EPREFIX", "/") ++ config_root =3D os.environ.get("__PORTAGE_TEST_EPREFIX", EPREFI= X) self.options =3D portage.dispatch_conf.read_config(MANDATORY_OP= TS) =20 if "log-file" in self.options: diff --cc bin/ebuild-helpers/dobin index 8adc65d,f90d893..922e600 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@@ -1,8 -1,8 +1,8 @@@ -#!/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 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh =20 if [[ $# -lt 1 ]] ; then helpers_die "${0##*/}: at least one argument needed" diff --cc bin/ebuild-helpers/dodir index 06dd2fe,90a3efe..f7a9c39 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@@ -2,11 -2,10 +2,10 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh =20 - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) ED=3D${D} ;; esac - # END PREFIX LOCAL + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac =20 install -d ${DIROPTIONS} "${@/#/${ED}/}" ret=3D$? diff --cc bin/ebuild-helpers/doins index 0eafced,443bfdb..b9c95ed --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@@ -39,13 -38,6 +38,15 @@@ if [[ ${INSDESTTREE#${ED}} !=3D "${INSDES helpers_die "${0##*/} used with \${D} or \${ED}" exit 1 fi ++# PREFIX LOCAL: check for usage with EPREFIX +if [[ ${INSDESTTREE#${EPREFIX}} !=3D "${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 ++# END PREFIX LOCAL =20 case "$EAPI" in 0|1|2|3|3_pre2) diff --cc bin/ebuild-helpers/fowners index 5c1ecac,a5a28f2..9815d2e --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@@ -2,17 -2,11 +2,18 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + ++# PREFIX LOCAL: ignore otherwise failing call +if hasq prefix ${USE} && [[ $EUID !=3D 0 ]] ; then + ewarn "fowners ignored in Prefix with non-privileged user" + exit 0 +fi -=20 - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) ED=3D${D} ;; esac +# END PREFIX LOCAL =20 + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac +=20 # we can't prefix all arguments because # chown takes random options slash=3D"/" diff --cc bin/ebuild-helpers/fperms index 25f77a9,a2f77ea..23b5361 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@@ -2,11 -2,11 +2,11 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh =20 - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) ED=3D${D} ;; esac - # END PREFIX LOCAL + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac +=20 # we can't prefix all arguments because # chmod takes random options slash=3D"/" diff --cc bin/ebuild-helpers/prepall index c4e9ffc,49e646c..3aacb7f --- a/bin/ebuild-helpers/prepall +++ b/bin/ebuild-helpers/prepall @@@ -2,11 -2,10 +2,12 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + +[[ -d ${ED} ]] || exit 0 =20 - case "$EAPI" in 0|1|2) ED=3D${D} ;; esac + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac =20 if has chflags $FEATURES ; then # Save all the file flags for restoration at the end of prepall. diff --cc bin/ebuild-helpers/prepallinfo index de52098,db9bbfa..00e1fc4 --- a/bin/ebuild-helpers/prepallinfo +++ b/bin/ebuild-helpers/prepallinfo @@@ -2,11 -2,10 +2,10 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh =20 - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) ED=3D${D} ;; esac - # END PREFIX LOCAL + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac =20 [[ -d ${ED}usr/share/info ]] || exit 0 =20 diff --cc bin/ebuild-helpers/prepinfo index c0ab9c9,ffe2ece..ffd5049 --- a/bin/ebuild-helpers/prepinfo +++ b/bin/ebuild-helpers/prepinfo @@@ -2,11 -2,10 +2,10 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh =20 - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) ED=3D${D} ;; esac - # END PREFIX LOCAL + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac =20 if [[ -z $1 ]] ; then infodir=3D"/usr/share/info" diff --cc bin/ebuild-helpers/prepman index 2c10b26,f96b641..1411499 --- a/bin/ebuild-helpers/prepman +++ b/bin/ebuild-helpers/prepman @@@ -2,9 -2,10 +2,10 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.s= h +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh =20 - case "$EAPI" in 0|1|2) ED=3D${D} ;; esac + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) ED=3D${D} ;; esac =20 if [[ -z $1 ]] ; then=20 mandir=3D"${ED}usr/share/man" diff --cc bin/ebuild-helpers/prepstrip index 927078a,15eed84..84e2edc --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@@ -221,15 -216,6 +220,17 @@@ d strip_this=3Dfalse fi =20 ++ # PREFIX LOCAL: + # In Prefix we are usually an unprivileged user, so we can't strip + # unwritable objects. Make them temporarily writable for the + # stripping. + was_not_writable=3Dfalse + if [[ ! -w ${x} ]] ; then + was_not_writable=3Dtrue + chmod u+w "${x}" + fi ++ # END PREFIX LOCAL + # only split debug info for final linked objects # or kernel modules as debuginfo for intermediatary # files (think crt*.o from gcc/glibc) is useless and @@@ -248,10 -234,6 +249,12 @@@ elif [[ ${f} =3D=3D *"SB relocatable"* ]] ; then process_elf "${x}" ${SAFE_STRIP_FLAGS} fi + ++ # PREFIX LOCAL: see above + if [[ ${was_not_writable} =3D=3D "true" ]] ; then + chmod u-w "${x}" + fi ++ # END PREFIX LOCAL done =20 if [[ -s ${T}/debug.sources ]] && \ diff --cc bin/ebuild.sh index 2ec34cd,1f95adb..7511532 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@@ -669,11 -670,11 +670,13 @@@ els declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS case "$EAPI" in 0|1|2) + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] && \ + declare -r ED EPREFIX EROOT ;; *) - declare -r ED EPREFIX EROOT + # PREFIX LOCAL: allow prefix vars in any EAPI + #declare -r ED EPREFIX EROOT + # PREFIX LOCAL ;; esac =20 diff --cc bin/emerge-webrsync index c5809cc,e6749f2..c41eb79 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@@ -39,10 -38,6 +39,11 @@@ eval $(portageq envvar -v FEATURES FETC DISTDIR=3D"${PORTAGE_TMPDIR}/emerge-webrsync" export http_proxy ftp_proxy =20 - # PREFIX HACK: use Prefix servers, just because we want this and infra ++# PREFIX LOCAL: use Prefix servers, just because we want this and infra +# just can't support us yet +GENTOO_MIRRORS=3D"http://gentoo-mirror1.prefix.freens.org http://gentoo= -mirror2.prefix.freens.org" ++# END PREFIX LOCAL + # If PORTAGE_NICENESS is overriden via the env then it will # still pass through the portageq call and override properly. if [ -n "${PORTAGE_NICENESS}" ]; then @@@ -183,8 -178,8 +184,10 @@@ sync_local()=20 vecho "Syncing local tree ..." =20 if type -P tarsync > /dev/null ; then - local chown_opts=3D"-o portage -g portage" - chown portage:portage portage > /dev/null 2>&1 || chown_opts=3D"" ++ # PREFIX LOCAL: use PORTAGE_USER and PORTAGE_GROUP + local chown_opts=3D"-o ${PORTAGE_USER:-portage} -g ${PORTAGE_GROUP:-p= ortage}" + chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} portage > /d= ev/null 2>&1 || chown_opts=3D"" ++ # END PREFIX LOCAL if ! tarsync $(vvecho -v) -s 1 ${chown_opts} \ -e /distfiles -e /packages -e /local "${file}" "${PORTDIR}"; then eecho "tarsync failed; tarball is corrupt? (${file})" @@@ -200,8 -195,8 +203,10 @@@ # Free disk space rm -f "${file}" =20 - chown portage:portage portage > /dev/null 2>&1 && \ - chown -R portage:portage portage ++ # PREFIX LOCAL: use PORTAGE_USER and PORTAGE_GROUP + chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} portage > /d= ev/null 2>&1 && \ + chown -R ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} portage ++ # END PREFIX LOCAL cd portage rsync -av --progress --stats --delete --delete-after \ --exclude=3D'/distfiles' --exclude=3D'/packages' \ @@@ -216,7 -211,9 +221,9 @@@ vecho "Updating cache ..." emerge --metadata fi - [ -x /etc/portage/bin/post_sync ] && /etc/portage/bin/post_sync + [ -x "${EPREFIX}"/etc/portage/bin/post_sync ] && "${EPREFIX}"/etc/port= age/bin/post_sync + # --quiet suppresses output if there are no relevant news items + has news ${FEATURES} && emerge --check-news --quiet return 0 } =20 diff --cc bin/etc-update index c735076,731b648..b3877fb --- a/bin/etc-update +++ b/bin/etc-update @@@ -555,16 -555,12 +555,12 @@@ rm -rf "${TMP}" 2> /dev/nul mkdir "${TMP}" || die "failed to create temp dir" 1 # make sure we have a secure directory to work in chmod 0700 "${TMP}" || die "failed to set perms on temp dir" 1 - # GID need not to be available, and group 0 is not cool when not being - # root, hence just rely on mkdir to have created a dir which is owned b= y - # the user - if [[ -z ${UID} || ${UID} =3D=3D 0 ]] ; then - chown ${UID:-0}:${GID:-0} "${TMP}" || die "failed to set ownership on = temp dir" 1 - fi + chown ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${TMP}" || \ + die "failed to set ownership on temp dir" 1 =20 # I need the CONFIG_PROTECT value -#CONFIG_PROTECT=3D$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT= ) -#CONFIG_PROTECT_MASK=3D$(/usr/lib/portage/bin/portageq envvar CONFIG_PR= OTECT_MASK) +#CONFIG_PROTECT=3D$(@PORTAGE_BASE@/bin/portageq envvar CONFIG_PROTECT) +#CONFIG_PROTECT_MASK=3D$(@PORTAGE_BASE@/bin/portageq envvar CONFIG_PROT= ECT_MASK) =20 # load etc-config's configuration CLEAR_TERM=3D$(get_config clear_term) diff --cc bin/misc-functions.sh index 20d52a7,3582889..1e3785c mode 100644,100755..100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@@ -14,15 -14,11 +14,14 @@@ MISC_FUNCTIONS_ARGS=3D"$@" shift $# =20 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh" +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}/ebuild.sh" =20 install_symlink_html_docs() { - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) local ED=3D${D} ;; esac - # END PREFIX LOCAL - # PREFIX LOCAL: ED need not to exist, whereas D does - [[ ! -d ${ED} ]] && dodir / + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=3D${D} ;; esac ++ # PREFIX LOCAL: ED needs not to exist, whereas D does ++ [[ ! -d ${ED} && -d ${D} ]] && dodir / + # END PREFIX LOCAL cd "${ED}" || die "cd failed" #symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.co= nf) if [ -n "${DOC_SYMLINKS_DIR}" ] ; then @@@ -154,13 -149,10 +152,12 @@@ prepcompress()=20 =20 install_qa_check() { local f i x - # PREFIX LOCAL: always support ED - #case "$EAPI" in 0|1|2) local ED=3D${D} ;; esac - # END PREFIX LOCAL + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] || \ + case "$EAPI" in 0|1|2) local ED=3D${D} ;; esac =20 - cd "${ED}" || die "cd failed" + # PREFIX LOCAL: ED needs not to exist, whereas D does + cd "${D}" || die "cd failed" + # END PREFIX LOCAL =20 export STRIP_MASK prepall @@@ -192,37 -184,6 +189,39 @@@ sleep 1 fi =20 ++ # PREFIX LOCAL: + # 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 ++ # END PREFIX LOCAL +} + +install_qa_check_elf() { if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT}; then local qa_var insecure_rpath=3D0 tmp_quiet=3D${PORTAGE_QUIET} local x diff --cc bin/phase-functions.sh index 97111f5,482b5b1..75f1664 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@@ -28,7 -28,7 +28,7 @@@ PORTAGE_READONLY_VARS=3D"D EBUILD EBUILD_ PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \ PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR PORTDIR_OVERLAY \ PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \ - ED EROOT" - __PORTAGE_TEST_EPREFIX" ++ __PORTAGE_TEST_EPREFIX ED EROOT" =20 PORTAGE_SAVED_READONLY_VARS=3D"A CATEGORY P PF PN PR PV PVR" =20 @@@ -558,7 -559,20 +559,24 @@@ dyn_install()=20 fi echo "${USE}" > USE echo "${EAPI:-0}" > EAPI ++<<<<<<< HEAD + echo "${EPREFIX}" > EPREFIX ++=3D=3D=3D=3D=3D=3D=3D +=20 + # Save EPREFIX, since it makes it easy to use chpathtool to + # adjust the content of a binary package so that it will + # work in a different EPREFIX from the one is was built for. + case "${EAPI:-0}" in + 0|1|2) + [[ " ${FEATURES} " =3D=3D *" force-prefix "* ]] && \ + [ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX + ;; + *) + [ -n "${EPREFIX}" ] && echo "${EPREFIX}" > EPREFIX + ;; + esac +=20 ++>>>>>>> overlays-gentoo-org/master set +f =20 # local variables can leak into the saved environment. diff --cc cnf/make.conf index 25488d3,ef570bc..5134188 --- a/cnf/make.conf +++ b/cnf/make.conf @@@ -138,20 -137,16 +137,16 @@@ # at \${DISTDIR}/\${FILE}. # # Default fetch command (3 tries, passive ftp for firewall compatibilit= y) - #FETCHCOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/wget -t 3 -T 60 --passive-ft= p -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" - #RESUMECOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/wget -c -t 3 -T 60 --passiv= e-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" + #FETCHCOMMAND=3D"wget -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE= }\" \"\${URI}\"" + #RESUMECOMMAND=3D"wget -c -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${= FILE}\" \"\${URI}\"" # # Using wget, ratelimiting downloads - #FETCHCOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/wget -t 3 -T 60 --passive-ft= p --limit-rate=3D200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" - #RESUMECOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/wget -c -t 3 -T 60 --passiv= e-ftp --limit-rate=3D200k -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" - # - # curl groks urls - #FETCHCOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/curl -f --connect-timeout 15= -# -o \${DISTDIR}/\${FILE} \${URI}" - #RESUMECOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/curl -f --connect-timeout 1= 5 -# -C - -o \${DISTDIR}/\${FILE} \${URI}" + #FETCHCOMMAND=3D"wget -t 3 -T 60 --passive-ftp --limit-rate=3D200k -O \= "\${DISTDIR}/\${FILE}\" \"\${URI}\"" + #RESUMECOMMAND=3D"wget -c -t 3 -T 60 --passive-ftp --limit-rate=3D200k = -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # # Lukemftp (BSD ftp): - #FETCHCOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/lukemftp -s -a -o \"\${DISTD= IR}/\${FILE}\" \"\${URI}\"" - #RESUMECOMMAND=3D"@PORTAGE_EPREFIX@/usr/bin/lukemftp -s -a -R -o \"\${D= ISTDIR}/\${FILE}\" \"\${URI}\"" -#FETCHCOMMAND=3D"/usr/bin/lukemftp -s -a -o \"\${DISTDIR}/\${FILE}\" \"= \${URI}\"" -#RESUMECOMMAND=3D"/usr/bin/lukemftp -s -a -R -o \"\${DISTDIR}/\${FILE}\= " \"\${URI}\"" ++#FETCHCOMMAND=3D"lukemftp -s -a -o \"\${DISTDIR}/\${FILE}\" \"\${URI}\"= " ++#RESUMECOMMAND=3D"lukemftp -s -a -R -o \"\${DISTDIR}/\${FILE}\" \"\${UR= I}\"" # # Portage uses GENTOO_MIRRORS to specify mirrors to use for source retr= ieval. # The list is a space separated list which is read left to right. If yo= u use diff --cc pym/portage/const.py index 63e7c67,5eeebe1..336c005 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@@ -134,9 -90,8 +134,9 @@@ SUPPORTED_FEATURES =3D frozenset( "ccache", "chflags", "clean-logs", "collision-protect", "compress-build-logs", "digest", "distcc", "distcc-pump", "distlock= s", "ebuild-locks", "fakeroot", - "fail-clean", "force-mirror", "getbinpkg", + "fail-clean", "force-mirror", "force-prefix"= , "getbinpkg", "installsources", "keeptemp", "keepwork", "f= ixlafiles", "lmirror", + "macossandbox", "macosprefixsandbox", "maco= susersandbox", "metadata-transfer", "mirror", "multilib-str= ict", "news", "noauto", "noclean", "nodoc", "noinfo", "nom= an", "nostrip", "notitles", "parallel-fetch", "pa= rallel-install", diff --cc pym/portage/data.py index 354fc9c,fa6970c..e8a0a3a --- a/pym/portage/data.py +++ b/pym/portage/data.py @@@ -77,71 -66,117 +75,131 @@@ try except KeyError: pass =20 - # Allow the overriding of the user used for 'userpriv' and 'userfetch' - _portage_uname =3D os.environ.get('PORTAGE_USERNAME', PORTAGE_USERNAME) - _portage_grpname =3D os.environ.get('PORTAGE_GRPNAME', PORTAGE_GROUPNAM= E) -=20 - #Discover the uid and gid of the portage user/group - try: - portage_gid =3D grp.getgrnam(_portage_grpname)[2] - except KeyError: - # some sysadmins are insane, bug #344307 - if _portage_grpname.isdigit(): - portage_gid =3D int(_portage_grpname) + # The portage_uid and portage_gid global constants, and others that + # depend on them are initialized lazily, in order to allow configuratio= n + # via make.conf. Eventually, these constants may be deprecated in favor + # of config attributes, since it's conceivable that multiple + # configurations with different constants could be used simultaneously. + _initialized_globals =3D set() +=20 + def _get_global(k): + if k in _initialized_globals: + return globals()[k] +=20 + if k in ('portage_gid', 'portage_uid', 'secpass'): + global portage_gid, portage_uid, secpass + secpass =3D 0 + if uid =3D=3D 0: + secpass =3D 2 + elif "__PORTAGE_TEST_EPREFIX" in os.environ: + secpass =3D 2 + #Discover the uid and gid of the portage user/group + try: - portage_uid =3D pwd.getpwnam(_get_global('_portage_uname'))[2] + portage_gid =3D grp.getgrnam(_get_global('_portage_grpname'))[2] ++ except KeyError: ++ # some sysadmins are insane, bug #344307 ++ if _get_global('_portage_grpname').isdigit(): ++ portage_gid =3D int(_get_global('_portage_grpname')) ++ else: ++ portage_gid =3D None ++ try: ++ portage_uid =3D pwd.getpwnam(_get_global('_portage_uname'))[2] + if secpass < 1 and portage_gid in os.getgroups(): + secpass =3D 1 + except KeyError: ++ portage_uid =3D None ++ ++ if portage_uid is None or portage_gid is None: + portage_uid =3D 0 + portage_gid =3D 0 ++ # PREFIX LOCAL: we need to fix this one day to distinguish prefix vs= non-prefix ++ writemsg(colorize("BAD", ++ _("portage: '%s' user or '%s' group missing." % (_get_global('_port= age_uname'), _get_global('_portage_grpname')))) + "\n", noiselevel=3D-1) ++ writemsg(colorize("BAD", ++ _(" In Prefix Portage this is quite dramatic")) + "\n", noi= selevel=3D-1) + writemsg(colorize("BAD", - _("portage: 'portage' user or group missing.")) + "\n", noiselevel=3D= -1) - writemsg(_( - " For the defaults, line 1 goes into passwd, " - "and 2 into group.\n"), noiselevel=3D-1) - writemsg(colorize("GOOD", - " portage:x:250:250:portage:/var/tmp/portage:/bin/false") \ - + "\n", noiselevel=3D-1) - writemsg(colorize("GOOD", " portage::250:portage") + "\n", - noiselevel=3D-1) ++ _(" since it means you have thrown away yourself.")) + "\n"= , noiselevel=3D-1) ++ writemsg(colorize("BAD", ++ _(" Re-add yourself or re-bootstrap Gentoo Prefix.")) + "\n= ", noiselevel=3D-1) ++ # END PREFIX LOCAL + portage_group_warning() +=20 + _initialized_globals.add('portage_gid') + _initialized_globals.add('portage_uid') + _initialized_globals.add('secpass') +=20 + if k =3D=3D 'portage_gid': + return portage_gid + elif k =3D=3D 'portage_uid': + return portage_uid + elif k =3D=3D 'secpass': + return secpass + else: + raise AssertionError('unknown name: %s' % k) +=20 + elif k =3D=3D 'userpriv_groups': + v =3D [portage_gid] + if secpass >=3D 2: + # Get a list of group IDs for the portage user. Do not use + # grp.getgrall() since it is known to trigger spurious + # SIGPIPE problems with nss_ldap. + mystatus, myoutput =3D \ + portage.subprocess_getstatusoutput("id -G %s" % _portage_uname) + if mystatus =3D=3D os.EX_OK: + for x in myoutput.split(): + try: + v.append(int(x)) + except ValueError: + pass + v =3D sorted(set(v)) +=20 + elif k =3D=3D '_portage_grpname': + env =3D getattr(portage, 'settings', os.environ) - v =3D env.get('PORTAGE_GRPNAME', 'portage') ++ # PREFIX LOCAL: use var iso hardwired 'portage' ++ v =3D env.get('PORTAGE_GRPNAME', PORTAGE_GROUPNAME) ++ # END PREFIX LOCAL + elif k =3D=3D '_portage_uname': - env =3D getattr(portage, 'settings', os.environ) ++ # PREFIX LOCAL: use var iso hardwired 'portage' ++ env =3D getattr(portage, 'settings', PORTAGE_USERNAME) ++ # END PREFIX LOCAL + v =3D env.get('PORTAGE_USERNAME', 'portage') else: - portage_gid =3D None - try: - portage_uid =3D pwd.getpwnam(_portage_uname)[2] - except KeyError: - portage_uid =3D None -=20 - if portage_uid is None or portage_gid is None: - portage_uid=3D0 - portage_gid=3D0 - userpriv_groups =3D [portage_gid] - writemsg(colorize("BAD", - "portage: "+_portage_uname+" user or "+_portage_grpname+" group missi= ng.") + "\n", noiselevel=3D-1) - writemsg(colorize("BAD", - " In Prefix Portage this is quite dramatic") + "\n", noiselev= el=3D-1) - writemsg(colorize("BAD", - " since it means you have thrown away yourself.") + "\n", noi= selevel=3D-1) - writemsg(colorize("BAD", - " Re-add yourself or re-bootstrap Gentoo Prefix.") + "\n", no= iselevel=3D-1) - # we need to fix this one day to distinguish prefix vs non-prefix - # _("portage: 'portage' user or group missing.")) + "\n", noiselevel=3D= -1) - # writemsg(_( - # " For the defaults, line 1 goes into passwd, " - # "and 2 into group.\n"), noiselevel=3D-1) - # writemsg(colorize("GOOD", - # " portage:x:250:250:portage:/var/tmp/portage:/bin/false") \ - # + "\n", noiselevel=3D-1) - # writemsg(colorize("GOOD", " portage::250:portage") + "\n", - # noiselevel=3D-1) - portage_group_warning() - else: - if secpass < 1 and portage_gid in os.getgroups(): - secpass=3D1 - userpriv_groups =3D [portage_gid] - if secpass >=3D 2: - class _LazyUserprivGroups(portage.proxy.objectproxy.ObjectProxy): - def _get_target(self): - global userpriv_groups - if userpriv_groups is not self: - return userpriv_groups - userpriv_groups =3D _userpriv_groups - # Get a list of group IDs for the portage user. Do not use - # grp.getgrall() since it is known to trigger spurious - # SIGPIPE problems with nss_ldap. - mystatus, myoutput =3D \ - portage.subprocess_getstatusoutput("id -G %s" % _portage_uname) - if mystatus =3D=3D os.EX_OK: - for x in myoutput.split(): - try: - userpriv_groups.append(int(x)) - except ValueError: - pass - userpriv_groups[:] =3D sorted(set(userpriv_groups)) - return userpriv_groups -=20 - _userpriv_groups =3D userpriv_groups - userpriv_groups =3D _LazyUserprivGroups() + raise AssertionError('unknown name: %s' % k) +=20 + globals()[k] =3D v + _initialized_globals.add(k) + return v +=20 + class _GlobalProxy(portage.proxy.objectproxy.ObjectProxy): +=20 + __slots__ =3D ('_name',) +=20 + def __init__(self, name): + portage.proxy.objectproxy.ObjectProxy.__init__(self) + object.__setattr__(self, '_name', name) +=20 + def _get_target(self): + return _get_global(object.__getattribute__(self, '_name')) +=20 + for k in ('portage_gid', 'portage_uid', 'secpass', 'userpriv_groups', + '_portage_grpname', '_portage_uname'): + globals()[k] =3D _GlobalProxy(k) + del k +=20 + def _init(settings): + """ + Use config variables like PORTAGE_GRPNAME and PORTAGE_USERNAME to + initialize global variables. This allows settings to come from make.co= nf + instead of requiring them to be set in the calling environment. + """ + if '_portage_grpname' not in _initialized_globals: + v =3D settings.get('PORTAGE_GRPNAME') + if v is not None: + globals()['_portage_grpname'] =3D v + _initialized_globals.add('_portage_grpname') +=20 + if '_portage_uname' not in _initialized_globals: + v =3D settings.get('PORTAGE_USERNAME') + if v is not None: + globals()['_portage_uname'] =3D v + _initialized_globals.add('_portage_uname') diff --cc pym/portage/dispatch_conf.py index d35be0a,abd3ac1..bfd6517 --- a/pym/portage/dispatch_conf.py +++ b/pym/portage/dispatch_conf.py @@@ -13,7 -13,7 +13,8 @@@ import os, sys, shuti import portage from portage.env.loaders import KeyValuePairFileLoader from portage.localization import _ + from portage.util import varexpand +from portage.const import EPREFIX =20 RCS_BRANCH =3D '1.1.1' RCS_LOCK =3D 'rcs -ko -M -l' @@@ -39,11 -39,12 +40,12 @@@ def diffstatusoutput_len(cmd) return (1, 1) =20 def read_config(mandatory_opts): - loader =3D KeyValuePairFileLoader( - EPREFIX + '/etc/dispatch-conf.conf', None) - eprefix =3D os.environ.get("__PORTAGE_TEST_EPREFIX", "/") ++ eprefix =3D os.environ.get("__PORTAGE_TEST_EPREFIX", EPREFIX) + config_path =3D os.path.join(eprefix, "etc/dispatch-conf.conf") + loader =3D KeyValuePairFileLoader(config_path, None) opts, errors =3D loader.load() if not opts: - print(_('dispatch-conf: Error reading %s/etc/dispatch-conf.conf= ; fatal') % (EPREFIX,), file=3Dsys.stderr) - print(_('dispatch-conf: Error reading /etc/dispatch-conf.conf; = fatal'), file=3Dsys.stderr) ++ print(_('dispatch-conf: Error reading %s/etc/dispatch-conf.conf= ; fatal') % (eprefix,), file=3Dsys.stderr) sys.exit(1) =20 # Handle quote removal here, since KeyValuePairFileLoader doesn't do t= hat. diff --cc pym/portage/package/ebuild/_config/special_env_vars.py index b729c6a,9ac37fb..d07f68b --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@@ -66,9 -66,7 +66,9 @@@ environ_whitelist +=3D=20 "REPLACING_VERSIONS", "REPLACED_BY_VERSION", "ROOT", "ROOTPATH", "T", "TMP", "TMPDIR", "USE_EXPAND", "USE_ORDER", "WORKDIR", - "XARGS", + "XARGS", "__PORTAGE_TEST_EPREFIX", + "BPREFIX", "DEFAULT_PATH", "EXTRA_PATH", + "PORTAGE_GROUP", "PORTAGE_USER", ] =20 # user config variables