Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix
authorFabian Groffen <grobian@gentoo.org>
Tue, 13 Sep 2011 17:40:17 +0000 (19:40 +0200)
committerFabian Groffen <grobian@gentoo.org>
Tue, 13 Sep 2011 17:40:17 +0000 (19:40 +0200)
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

16 files changed:
1  2 
bin/ebuild
bin/ebuild.sh
bin/egencache
bin/isolated-functions.sh
bin/repoman
pym/_emerge/actions.py
pym/_emerge/depgraph.py
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/dbapi/vartree.py
pym/portage/elog/mod_save.py
pym/portage/getbinpkg.py
pym/portage/package/ebuild/config.py
pym/portage/package/ebuild/doebuild.py
pym/portage/package/ebuild/fetch.py
pym/portage/util/env_update.py

diff --cc bin/ebuild
Simple merge
diff --cc bin/ebuild.sh
index a5fc0ecb45def0310ab8ea8bcb91f205be544ccf,7b77c10771057eaa6780dc8d4859937e12e24017..79525154ff66a3626562b282edb1596528e4902d
@@@ -2,9 -2,51 +2,58 @@@
  # 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}"
  
 -PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
+ 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
+ source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
+ if [[ $EBUILD_PHASE != 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 scope\"; }"
+       done
+       unset x
+ fi
  if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then
        # Ensure that /dev/std* streams have appropriate sandbox permission for
        # bug #288863. This can be removed after sandbox is fixed and portage
                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
- ebuild_main() {
  
-       # 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=$BASHPID
-       trap 'exit 1' SIGTERM
-       if [[ $EBUILD_PHASE != depend ]] ; then
-               # Force configure scripts that automatically detect ccache to
-               # respect FEATURES="-ccache".
-               has ccache $FEATURES || export CCACHE_DISABLE=1
-               local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
-               [[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func"
-               unset phase_func
-       fi
-       source_all_bashrcs
-       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="0"
-               if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; 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 == 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} = 0 ]] ; then
-                       export SANDBOX_ON="1"
-               else
-                       export SANDBOX_ON="0"
-               fi
-               case "$EBUILD_SH_ARGS" in
-               configure|compile)
-                       local x
-                       for x in ASFLAGS CCACHE_DIR CCACHE_SIZE \
-                               CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
-                               [[ ${!x+set} = set ]] && export $x
-                       done
-                       unset x
-                       has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
-                               [[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \
-                               addwrite "$DISTCC_DIR"
-                       x=LIBDIR_$ABI
-                       [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \
-                               export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig
-                       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=noauto so I'll assume"
-                               echo "!!! that you know what you are doing..." \
-                                       "You have 5 seconds to abort..."
-                               echo
-                               local x
-                               for x in 1 2 3 4 5 6 7 8; do
-                                       LC_ALL=C sleep 0.25
-                               done
-                               sleep 3
-                       fi
-                       cd "$PORTAGE_BUILDDIR"
-                       if [ ! -d build-info ] ; then
-                               mkdir build-info
-                               cp "$EBUILD" "build-info/$PF.ebuild"
-                       fi
-                       #our custom version of libtool uses $S and $D to fix
-                       #invalid paths in .la files
-                       export S D
-                       ;;
-               esac
-               if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
-                       dyn_${EBUILD_SH_ARGS}
-               else
-                       set -x
-                       dyn_${EBUILD_SH_ARGS}
-                       set +x
-               fi
-               export SANDBOX_ON="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 to be created
-               #in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
-               export SANDBOX_ON="0"
-               if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
-                       dyn_${EBUILD_SH_ARGS}
-               else
-                       set -x
-                       dyn_${EBUILD_SH_ARGS}
-                       set +x
-               fi
-               ;;
-       depend)
-               export SANDBOX_ON="0"
-               set -f
-               if [ -n "${dbkey}" ] ; then
-                       if [ ! -d "${dbkey%/*}" ]; then
-                               install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
-                       fi
-                       # Make it group writable. 666&~002==664
-                       umask 002
-               fi
-               auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
-                       DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND PROVIDE EAPI
-                       PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
-                       UNUSED_03 UNUSED_02 UNUSED_01"
-               #the extra $(echo) commands remove newlines
-               [ -n "${EAPI}" ] || EAPI=0
-               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="1"
-               echo "Unrecognized EBUILD_SH_ARGS: '${EBUILD_SH_ARGS}'"
-               echo
-               dyn_help
-               exit 1
-               ;;
-       esac
- }
- 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=
-       if [[ -n SANDBOX_ON ]] ; then
-               x=$SANDBOX_ON
-               export SANDBOX_ON=0
+                       ebuild_main ${EBUILD_SH_ARGS}
+                       exit 0
+               )
+               exit $?
        fi
-       rm -f "$SANDBOX_LOG" || \
-               die "failed to remove stale sandbox log: '$SANDBOX_LOG'"
-       if [[ -n $x ]] ; then
-               export SANDBOX_ON=$x
-       fi
-       unset x
- fi
- if [[ $EBUILD_PHASE = 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>&-
-               ebuild_main
-               # 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/environment" &>/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
  
  # Do not exit when ebuild.sh is sourced by other scripts.
diff --cc bin/egencache
index 50cee6803e18fcabd942bbe4a2bb2546cfd273fb,7766e786e02381cfa294b5876a4525bd0db3bd71..ae76a3d6b1f97adc1ac8018b0bec4b7f5296862c
@@@ -791,8 -792,10 +793,12 @@@ def egencache_main(args)
        if options.portdir is not None:
                env['PORTDIR'] = options.portdir
  
-       settings = portage.config(config_root=config_root, _eprefix=EPREFIX,
-               target_root='/', local_config=False, env=env)
+       eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX")
++      if not eprefix:
++              eprefix = EPREFIX
+       settings = portage.config(config_root=config_root,
+               local_config=False, env=env, _eprefix=eprefix)
  
        default_opts = None
        if not options.ignore_default_opts:
index 69eb4dbcce253d73521354de059385a048d3ae25,733795aa1427da6e0c64d55a4d21eeb498a60f7c..12edfbcd9990221054e711bd3211b353d2f3d3a4
@@@ -487,31 -434,30 +436,36 @@@ RC_INDENTATION='
  RC_DEFAULT_INDENT=2
  RC_DOT_PATTERN=''
  
- case "${NOCOLOR:-false}" in
-       yes|true)
-               unset_colors
-               ;;
-       no|false)
-               set_colors
-               ;;
- esac
+ 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
  
 -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/repoman
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index a92159f26acf6cfd82c2e6381eb424708a8d3162,ba7ebc3ad2505a0f4b692bdc36ed387825213635..8fc5c411bf043a60e1639c2d0b9a68148a6c935d
@@@ -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
Simple merge
index d39bd39889c63dd4ac97d758dd697bd4df6ccd82,19c7666b99539afda555b2bfcc8a46163d2f114d..8a2ac57dbb1634b01f640f0ed3afda2362534b57
@@@ -52,7 -50,7 +50,7 @@@ def env_update(makelinks=1, target_root
        else:
                settings = env
  
--      eprefix = settings.get("EPREFIX", "")
++      eprefix = settings.get("EPREFIX", portage.const.EPREFIX)
        eprefix_lstrip = eprefix.lstrip(os.sep)
        envd_dir = os.path.join(target_root, eprefix_lstrip, "etc", "env.d")
        ensure_dirs(envd_dir, mode=0o755)