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 <gentoo-commits+bounces-381977-garchives=archives.gentoo.org@lists.gentoo.org>) id 1R3Wzg-00064u-Ur for garchives@archives.gentoo.org; Tue, 13 Sep 2011 17:42:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4B0E021C200; Tue, 13 Sep 2011 17:41:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CD80821C200 for <gentoo-commits@lists.gentoo.org>; Tue, 13 Sep 2011 17:41:41 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 308171B4036 for <gentoo-commits@lists.gentoo.org>; Tue, 13 Sep 2011 17:41:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 80A1380042 for <gentoo-commits@lists.gentoo.org>; Tue, 13 Sep 2011 17:41:40 +0000 (UTC) From: "Fabian Groffen" <grobian@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org> Message-ID: <74fec93ae94c0149cac8a6e2af49ee2492c97cce.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: 74fec93ae94c0149cac8a6e2af49ee2492c97cce Date: Tue, 13 Sep 2011 17:41:40 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 6617919f70fd56eefc2a707f85d3e738 commit: 74fec93ae94c0149cac8a6e2af49ee2492c97cce Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Tue Sep 13 17:40:17 2011 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Tue Sep 13 17:40:17 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D74fec93a Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix Conflicts: bin/ebuild.sh bin/egencache bin/isolated-functions.sh pym/portage/dbapi/vartree.py pym/portage/elog/mod_save.py pym/portage/elog/mod_save_summary.py pym/portage/package/ebuild/doebuild.py pym/portage/util/env_update.py bin/bashrc-functions.sh | 140 ++ bin/ebuild | 25 +- bin/ebuild.sh | 1963 ++------------= ------ bin/egencache | 46 +- bin/isolated-functions.sh | 166 +-- bin/phase-functions.sh | 970 ++++++++++ bin/phase-helpers.sh | 624 +++++++ bin/repoman | 47 +- bin/save-ebuild-env.sh | 97 + man/portage.5 | 4 + pym/_emerge/BlockerCache.py | 10 +- pym/_emerge/EbuildFetcher.py | 6 +- pym/_emerge/actions.py | 21 +- pym/_emerge/depgraph.py | 125 +- pym/_emerge/main.py | 11 +- pym/_emerge/search.py | 4 +- pym/portage/__init__.py | 36 +- pym/portage/cache/volatile.py | 8 +- pym/portage/dbapi/porttree.py | 41 +- pym/portage/dbapi/vartree.py | 53 +- pym/portage/dep/__init__.py | 8 + pym/portage/elog/mod_echo.py | 13 + pym/portage/elog/mod_save.py | 3 +- pym/portage/elog/mod_save_summary.py | 4 +- pym/portage/getbinpkg.py | 17 +- pym/portage/manifest.py | 149 +- pym/portage/package/ebuild/config.py | 13 + pym/portage/package/ebuild/digestcheck.py | 6 +- pym/portage/package/ebuild/digestgen.py | 3 +- pym/portage/package/ebuild/doebuild.py | 50 +- pym/portage/package/ebuild/fetch.py | 3 +- pym/portage/repository/config.py | 216 ++- pym/portage/tests/ebuild/test_config.py | 48 + pym/portage/tests/ebuild/test_pty_eof.py | 13 + pym/portage/tests/emerge/test_simple.py | 205 ++- pym/portage/tests/repoman/test_simple.py | 19 +- pym/portage/tests/resolver/ResolverPlayground.py | 71 +- pym/portage/tests/resolver/test_virtual_slot.py | 93 + .../util/_dyn_libs/PreservedLibsRegistry.py | 14 +- pym/portage/util/env_update.py | 6 +- pym/portage/util/mtimedb.py | 8 +- pym/portage/xml/metadata.py | 34 +- pym/repoman/checks.py | 1 + 43 files changed, 3038 insertions(+), 2356 deletions(-) diff --cc bin/ebuild.sh index a5fc0ec,7b77c10..7952515 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@@ -2,9 -2,51 +2,58 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 -PORTAGE_BIN_PATH=3D"${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" -PORTAGE_PYM_PATH=3D"${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" +PORTAGE_BIN_PATH=3D"${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}" +PORTAGE_PYM_PATH=3D"${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym}" =20 + ROOTPATH=3D${ROOTPATH##:} + ROOTPATH=3D${ROOTPATH%%:} + PREROOTPATH=3D${PREROOTPATH##:} + PREROOTPATH=3D${PREROOTPATH%%:} -PATH=3D$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/u= sr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$= ROOTPATH ++#PATH=3D$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, an= d ++# 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=3D"$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}$= {DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}" + export PATH +=20 ++ + # Prevent aliases from causing portage to act inappropriately. + # Make sure it's before everything so we don't mess aliases that follow= . + unalias -a +=20 + source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1 +=20 + if [[ $EBUILD_PHASE !=3D depend ]] ; then + source "${PORTAGE_BIN_PATH}/phase-functions.sh" || die + source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || die + source "${PORTAGE_BIN_PATH}/phase-helpers.sh" || die + source "${PORTAGE_BIN_PATH}/bashrc-functions.sh" || die + else + # These dummy functions are for things that are likely to be called + # in global scope, even though they are completely useless during + # the "depend" phase. + for x in diropts docompress exeopts get_KV insopts \ + keepdir KV_major KV_micro KV_minor KV_to_int \ + libopts register_die_hook register_success_hook \ + remove_path_entry set_unless_changed strip_duplicate_slashes \ + unset_unless_changed use_with use_enable ; do + eval "${x}() { : ; }" + done + # These dummy functions return false, in order to ensure that + # `use multislot` is false for the "depend" phase. + for x in use useq usev ; do + eval "${x}() { return 1; }" + done + # These functions die because calls to them during the "depend" phase + # are considered to be severe QA violations. + for x in best_version has_version portageq ; do + eval "${x}() { die \"\${FUNCNAME} calls are not allowed in global sco= pe\"; }" + done + unset x + fi +=20 if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then # Ensure that /dev/std* streams have appropriate sandbox permission fo= r # bug #288863. This can be removed after sandbox is fixed and portage @@@ -2178,232 -698,20 +707,22 @@@ els 0|1|2) ;; *) - declare -r ED EPREFIX EROOT + # PREFIX LOCAL: allow prefix vars in any EAPI + #declare -r ED EPREFIX EROOT + # PREFIX LOCAL ;; esac - fi -=20 - ebuild_main() { =20 - # Subshell/helper die support (must export for the die helper). - # Since this function is typically executed in a subshell, - # setup EBUILD_MASTER_PID to refer to the current $BASHPID, - # which seems to give the best results when further - # nested subshells call die. - export EBUILD_MASTER_PID=3D$BASHPID - trap 'exit 1' SIGTERM -=20 - if [[ $EBUILD_PHASE !=3D depend ]] ; then - # Force configure scripts that automatically detect ccache to - # respect FEATURES=3D"-ccache". - has ccache $FEATURES || export CCACHE_DISABLE=3D1 -=20 - local phase_func=3D$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") - [[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func" - unset phase_func - fi -=20 - source_all_bashrcs -=20 - case ${EBUILD_SH_ARGS} in - nofetch) - ebuild_phase_with_hooks pkg_nofetch - ;; - prerm|postrm|postinst|config|info) - if has "$EBUILD_SH_ARGS" config info && \ - ! declare -F "pkg_$EBUILD_SH_ARGS" >/dev/null ; then - ewarn "pkg_${EBUILD_SH_ARGS}() is not defined: '${EBUILD##*/}'" - fi - export SANDBOX_ON=3D"0" - if [ "${PORTAGE_DEBUG}" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; then - ebuild_phase_with_hooks pkg_${EBUILD_SH_ARGS} - else - set -x - ebuild_phase_with_hooks pkg_${EBUILD_SH_ARGS} - set +x - fi - if [[ $EBUILD_PHASE =3D=3D postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]= ]; then - # Update environment.bz2 in case installation phases - # need to pass some variables to uninstallation phases. - save_ebuild_env --exclude-init-phases | \ - filter_readonly_variables --filter-path \ - --filter-sandbox --allow-extra-vars \ - | ${PORTAGE_BZIP2_COMMAND} -c -f9 > "$PORTAGE_UPDATE_ENV" - assert "save_ebuild_env failed" - fi - ;; - unpack|prepare|configure|compile|test|clean|install) - if [[ ${SANDBOX_DISABLED:-0} =3D 0 ]] ; then - export SANDBOX_ON=3D"1" - else - export SANDBOX_ON=3D"0" - fi -=20 - case "$EBUILD_SH_ARGS" in - configure|compile) -=20 - local x - for x in ASFLAGS CCACHE_DIR CCACHE_SIZE \ - CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do - [[ ${!x+set} =3D set ]] && export $x - done - unset x -=20 - has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \ - [[ ${SANDBOX_WRITE/$DISTCC_DIR} =3D $SANDBOX_WRITE ]] && \ - addwrite "$DISTCC_DIR" -=20 - x=3DLIBDIR_$ABI - [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \ - export PKG_CONFIG_PATH=3D/usr/${!x}/pkgconfig -=20 - if has noauto $FEATURES && \ - [[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then - echo - echo "!!! We apparently haven't unpacked..." \ - "This is probably not what you" - echo "!!! want to be doing... You are using" \ - "FEATURES=3Dnoauto so I'll assume" - echo "!!! that you know what you are doing..." \ - "You have 5 seconds to abort..." - echo -=20 - local x - for x in 1 2 3 4 5 6 7 8; do - LC_ALL=3DC sleep 0.25 - done -=20 - sleep 3 - fi -=20 - cd "$PORTAGE_BUILDDIR" - if [ ! -d build-info ] ; then - mkdir build-info - cp "$EBUILD" "build-info/$PF.ebuild" - fi -=20 - #our custom version of libtool uses $S and $D to fix - #invalid paths in .la files - export S D -=20 - ;; - esac -=20 - if [ "${PORTAGE_DEBUG}" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; then - dyn_${EBUILD_SH_ARGS} - else - set -x - dyn_${EBUILD_SH_ARGS} - set +x - fi - export SANDBOX_ON=3D"0" - ;; - help|pretend|setup|preinst) - #pkg_setup needs to be out of the sandbox for tmp file creation; - #for example, awking and piping a file in /tmp requires a temp file t= o be created - #in /etc. If pkg_setup is in the sandbox, both our lilo and apache e= builds break. - export SANDBOX_ON=3D"0" - if [ "${PORTAGE_DEBUG}" !=3D "1" ] || [ "${-/x/}" !=3D "$-" ]; then - dyn_${EBUILD_SH_ARGS} - else - set -x - dyn_${EBUILD_SH_ARGS} - set +x - fi - ;; - depend) - export SANDBOX_ON=3D"0" - set -f -=20 - if [ -n "${dbkey}" ] ; then - if [ ! -d "${dbkey%/*}" ]; then - install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}" - fi - # Make it group writable. 666&~002=3D=3D664 - umask 002 - fi -=20 - auxdbkeys=3D"DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE - DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAP= I - PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04 - UNUSED_03 UNUSED_02 UNUSED_01" -=20 - #the extra $(echo) commands remove newlines - [ -n "${EAPI}" ] || EAPI=3D0 -=20 - if [ -n "${dbkey}" ] ; then - > "${dbkey}" - for f in ${auxdbkeys} ; do - echo $(echo ${!f}) >> "${dbkey}" || exit $? - done - else - for f in ${auxdbkeys} ; do - echo $(echo ${!f}) 1>&9 || exit $? - done + if [[ -n $EBUILD_SH_ARGS ]] ; then + ( + # Don't allow subprocesses to inherit the pipe which + # emerge uses to monitor ebuild.sh. exec 9>&- - fi - set +f - ;; - _internal_test) - ;; - *) - export SANDBOX_ON=3D"1" - echo "Unrecognized EBUILD_SH_ARGS: '${EBUILD_SH_ARGS}'" - echo - dyn_help - exit 1 - ;; - esac - } -=20 - if [[ -s $SANDBOX_LOG ]] ; then - # We use SANDBOX_LOG to check for sandbox violations, - # so we ensure that there can't be a stale log to - # interfere with our logic. - x=3D - if [[ -n SANDBOX_ON ]] ; then - x=3D$SANDBOX_ON - export SANDBOX_ON=3D0 + ebuild_main ${EBUILD_SH_ARGS} + exit 0 + ) + exit $? fi -=20 - rm -f "$SANDBOX_LOG" || \ - die "failed to remove stale sandbox log: '$SANDBOX_LOG'" -=20 - if [[ -n $x ]] ; then - export SANDBOX_ON=3D$x - fi - unset x - fi -=20 - if [[ $EBUILD_PHASE =3D depend ]] ; then - ebuild_main - elif [[ -n $EBUILD_SH_ARGS ]] ; then - ( - # Don't allow subprocesses to inherit the pipe which - # emerge uses to monitor ebuild.sh. - exec 9>&- -=20 - ebuild_main -=20 - # Save the env only for relevant phases. - if ! has "$EBUILD_SH_ARGS" clean help info nofetch ; then - umask 002 - save_ebuild_env | filter_readonly_variables \ - --filter-features > "$T/environment" - assert "save_ebuild_env failed" - chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "$T/environ= ment" &>/dev/null - chmod g+w "$T/environment" &>/dev/null - fi - [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE" - if [[ -n $PORTAGE_IPC_DAEMON ]] ; then - [[ ! -s $SANDBOX_LOG ]] - "$PORTAGE_BIN_PATH"/ebuild-ipc exit $? - fi - exit 0 - ) - exit $? fi =20 # Do not exit when ebuild.sh is sourced by other scripts. diff --cc bin/egencache index 50cee68,7766e78..ae76a3d --- a/bin/egencache +++ b/bin/egencache @@@ -791,8 -792,10 +793,12 @@@ def egencache_main(args) if options.portdir is not None: env['PORTDIR'] =3D options.portdir =20 - settings =3D portage.config(config_root=3Dconfig_root, _eprefix=3DEPRE= FIX, - target_root=3D'/', local_config=3DFalse, env=3Denv) + eprefix =3D os.environ.get("__PORTAGE_TEST_EPREFIX") ++ if not eprefix: ++ eprefix =3D EPREFIX +=20 + settings =3D portage.config(config_root=3Dconfig_root, + local_config=3DFalse, env=3Denv, _eprefix=3Deprefix) =20 default_opts =3D None if not options.ignore_default_opts: diff --cc bin/isolated-functions.sh index 69eb4db,733795a..12edfbc --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@@ -487,31 -434,30 +436,36 @@@ RC_INDENTATION=3D' RC_DEFAULT_INDENT=3D2 RC_DOT_PATTERN=3D'' =20 - case "${NOCOLOR:-false}" in - yes|true) - unset_colors - ;; - no|false) - set_colors - ;; - esac + if [[ $EBUILD_PHASE =3D=3D 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 =20 -if [[ -z ${USERLAND} ]] ; then - case $(uname -s) in - *BSD|DragonFly) - export USERLAND=3D"BSD" - ;; - *) - export USERLAND=3D"GNU" - ;; - esac -fi +# In Prefix every platform has USERLAND=3DGNU, even FreeBSD. Since I +# don't know how to reliably "figure out" we are in a Prefix instance o= f +# 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 t= hey? +#if [[ -z ${USERLAND} ]] ; then +# case $(uname -s) in +# *BSD|DragonFly) +# export USERLAND=3D"BSD" +# ;; +# *) +# export USERLAND=3D"GNU" +# ;; +# esac +#fi +[[ -z ${USERLAND} ]] && USERLAND=3D"GNU" =20 if [[ -z ${XARGS} ]] ; then case ${USERLAND} in diff --cc pym/portage/package/ebuild/doebuild.py index a92159f,ba7ebc3..8fc5c41 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@@ -35,8 -35,7 +35,8 @@@ from portage import auxdbkeys, bsd_chfl unmerge, _encodings, _parse_eapi_ebuild_head, _os_merge, \ _shell_quote, _unicode_decode, _unicode_encode from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \ - EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY + EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, \ - EPREFIX, EPREFIX_LSTRIP, MACOSSANDBOX_PROFILE ++ EPREFIX, MACOSSANDBOX_PROFILE from portage.data import portage_gid, portage_uid, secpass, \ uid, userpriv_groups from portage.dbapi.porttree import _parse_uri_map diff --cc pym/portage/util/env_update.py index d39bd39,19c7666..8a2ac57 --- a/pym/portage/util/env_update.py +++ b/pym/portage/util/env_update.py @@@ -52,7 -50,7 +50,7 @@@ def env_update(makelinks=3D1, target_root else: settings =3D env =20 -- eprefix =3D settings.get("EPREFIX", "") ++ eprefix =3D settings.get("EPREFIX", portage.const.EPREFIX) eprefix_lstrip =3D eprefix.lstrip(os.sep) envd_dir =3D os.path.join(target_root, eprefix_lstrip, "etc", "env.d") ensure_dirs(envd_dir, mode=3D0o755)