Merged from trunk -r14615:14625
authorFabian Groffen <grobian@gentoo.org>
Sun, 18 Oct 2009 13:24:30 +0000 (13:24 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 18 Oct 2009 13:24:30 +0000 (13:24 -0000)
   | 14616   | Bug #273648 - EAPI 3 - the following condtions must be met:  |
   | zmedico | 1. The A variable contains no items. 2. The phase function   |
   |         | in question is not in DEFINED_PHASES. 3. None of the phase   |
   |         | functions unpack, prepare, configure, compile or install, if |
   |         | supported by the EAPI in question and occurring prior to the |
   |         | phase about to be executed, are in DEFINED_PHASES. Thanks to |
   |         | Jonathan Callen <abcd@g.o> for this patch.                   |

   | 14617   | Simplify the conditionals from bug #273648. Thanks to        |
   | zmedico | Jonathan Callen <abcd@g.o> for this patch.                   |

   | 14618   | Make phase variable local in has_phase_defined_up_to().      |
   | zmedico |                                                              |

   | 14619   | In dyn_unpack, check mtimes on $A instead of $AA. Thanks to  |
   | zmedico | Jonathan Callen <abcd@g.o> for reporting.                    |

   | 14620   | Fix WorldHandler to use the "selected" set.                  |
   | zmedico |                                                              |

   | 14621   | Use [ "${foo+set}" = set ] instead of "${foo-unset}" !=      |
   | zmedico | unset ], to avoid any possility of ambiguity. Thanks to      |
   |         | Jonathan Callen <abcd@g.o> for the suggestion.               |

   | 14622   | Fix einstall() change from previous commit, for              |
   | zmedico | compatibility with empty but set CONF_PREFIX. Thanks to      |
   |         | Jonathan Callen <abcd@g.o> for reporting.                    |

   | 14623   | Use short substitution syntax in use_with() and              |
   | zmedico | use_enable(). Thanks to Jonathan Callen <abcd@g.o> for this  |
   |         | patch.                                                       |

   | 14624   | Bug #273643 - Don't export AA in EAPI 3. Thanks to Jonathan  |
   | zmedico | Callen <abcd@g.o> for the initial patch (I moved the code    |
   |         | from spawnebuild to config.environ).                         |

   | 14625   | Bug #273636 - Add doins and newins support for symlink       |
   | zmedico | preservation in EAPI 3. Thanks to Jonathan Callen <abcd@g.o> |
   |         | for the initial patch (I added EAPI conditionals in order to |
   |         | share code between all EAPIs).                               |

svn path=/main/branches/prefix/; revision=14669

bin/ebuild-helpers/doins
bin/ebuild-helpers/newins
bin/ebuild.sh
bin/emaint
bin/isolated-functions.sh
pym/portage/__init__.py

index ae91ff5ae55dc246ecab5bed8daab1bb4c10285a..73d95e5cbfde33207c984ebd7ad0f28f2a65bc7d 100755 (executable)
@@ -1,5 +1,5 @@
 #!@PORTAGE_BASH@
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -25,6 +25,15 @@ if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
        exit 1
 fi
 
+case "$EAPI" in
+       0|1|2)
+               PRESERVE_SYMLINKS=n
+               ;;
+       *)
+               PRESERVE_SYMLINKS=y
+               ;;
+esac
+
 export TMP=$T/.doins_tmp
 # Use separate directories to avoid potential name collisions.
 mkdir -p "$TMP"/{1,2}
@@ -43,9 +52,15 @@ _doins() {
        local mysrc="$1" mydir="$2" cleanup="" rval
 
        if [ -L "$mysrc" ] ; then
-               cp "$mysrc" "$TMP/2"
-               mysrc="$TMP/2/${mysrc##*/}"
-               cleanup=${mysrc}
+               if [ $PRESERVE_SYMLINKS = y ] ; then
+                       rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
+                       cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
+                       return $?
+               else
+                       cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
+                       mysrc="$TMP/2/${mysrc##*/}"
+                       cleanup=$mysrc
+               fi
        fi
 
        install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
@@ -64,7 +79,8 @@ _xdoins() {
 success=0
 
 for x in "$@" ; do
-       if [ -d "$x" ] ; then
+       if [[ $PRESERVE_SYMLINKS = n && -d $x ]] || \
+               [[ $PRESERVE_SYMLINKS = y && -d $x && ! -L $x ]] ; then
                if [ "${DOINSRECUR}" == "n" ] ; then
                        continue
                fi
index f3ce74cbc7d81b97e4b5f1742921e66718f88658..500db457c71fdff31cd632136e0a29278dcc79dd 100755 (executable)
@@ -1,5 +1,5 @@
 #!@PORTAGE_BASH@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -14,7 +14,14 @@ if [ ! -e "$1" ] ; then
 fi
 
 rm -rf "${T}/${2}" || exit $?
-cp -f "${1}" "${T}/${2}" || exit $?
+case "$EAPI" in
+       0|1|2)
+               cp "$1" "$T/$2" || exit $?
+               ;;
+       *)
+               cp -P "$1" "$T/$2" || exit $?
+               ;;
+esac
 doins "${T}/${2}"
 ret=$?
 rm -rf "${T}/${2}"
index 35da07f2c0beb6742b07454e2faedb2b6dac69ad..57f25b2f570a162c136f996f34ab3a8246798f19 100755 (executable)
@@ -242,15 +242,8 @@ use_with() {
                return 1
        fi
 
-       local UW_SUFFIX=""
-       if [ ! -z "${3}" ]; then
-               UW_SUFFIX="=${3}"
-       fi
-
-       local UWORD="$2"
-       if [ -z "${UWORD}" ]; then
-               UWORD="$1"
-       fi
+       local UW_SUFFIX=${3:+=$3}
+       local UWORD=${2:-$1}
 
        if useq $1; then
                echo "--with-${UWORD}${UW_SUFFIX}"
@@ -267,15 +260,8 @@ use_enable() {
                return 1
        fi
 
-       local UE_SUFFIX=""
-       if [ ! -z "${3}" ]; then
-               UE_SUFFIX="=${3}"
-       fi
-
-       local UWORD="$2"
-       if [ -z "${UWORD}" ]; then
-               UWORD="$1"
-       fi
+       local UE_SUFFIX=${3:+=$3}
+       local UWORD=${2:-$1}
 
        if useq $1; then
                echo "--enable-${UWORD}${UE_SUFFIX}"
@@ -567,7 +553,7 @@ einstall() {
                CONF_LIBDIR="${!LIBDIR_VAR}"
        fi
        unset LIBDIR_VAR
-       if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:-unset}" != "unset" ]; then
+       if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then
                EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}"
                EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})"
                LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}"
@@ -716,7 +702,7 @@ dyn_unpack() {
        if [ -e "${WORKDIR}" ]; then
                local x
                local checkme
-               for x in ${AA}; do
+               for x in $A ; do
                        vecho ">>> Checking ${x}'s mtime..."
                        if [ "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/${x}" -nt "${WORKDIR}" ]; then
                                vecho ">>> ${x} has been updated; recreating WORKDIR..."
@@ -916,6 +902,16 @@ abort_install() {
        exit 1
 }
 
+has_phase_defined_up_to() {
+       local phase
+       for phase in unpack prepare configure compile install; do
+               has ${phase} ${DEFINED_PHASES} && return 0
+               [[ ${phase} == $1 ]] && return 1
+       done
+       # We shouldn't actually get here
+       return 1
+}
+
 dyn_prepare() {
 
        if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then
@@ -924,13 +920,15 @@ dyn_prepare() {
                return 0
        fi
 
-       local srcdir
        if [[ -d $S ]] ; then
-               srcdir=$S
+               cd "${S}"
+       elif hasq $EAPI 0 1 2; then
+               cd "${WORKDIR}"
+       elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
+               cd "${WORKDIR}"
        else
-               srcdir=$WORKDIR
+               die "The source directory '${S}' doesn't exist"
        fi
-       cd "$srcdir"
 
        trap abort_prepare SIGINT SIGQUIT
 
@@ -953,6 +951,16 @@ dyn_configure() {
                return 0
        fi
 
+       if [[ -d $S ]] ; then
+               cd "${S}"
+       elif hasq $EAPI 0 1 2; then
+               cd "${WORKDIR}"
+       elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
+               cd "${WORKDIR}"
+       else
+               die "The source directory '${S}' doesn't exist"
+       fi
+
        trap abort_configure SIGINT SIGQUIT
 
        [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
@@ -976,6 +984,16 @@ dyn_compile() {
                return 0
        fi
 
+       if [[ -d $S ]] ; then
+               cd "${S}"
+       elif hasq $EAPI 0 1 2; then
+               cd "${WORKDIR}"
+       elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
+               cd "${WORKDIR}"
+       else
+               die "The source directory '${S}' doesn't exist"
+       fi
+
        trap abort_compile SIGINT SIGQUIT
 
        [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
@@ -1008,6 +1026,7 @@ dyn_test() {
        else
                cd "${WORKDIR}"
        fi
+
        if ! hasq test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
                vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
        elif hasq test $RESTRICT; then
@@ -1042,11 +1061,17 @@ dyn_install() {
        ebuild_phase pre_src_install
        rm -rf "${PORTAGE_BUILDDIR}/image"
        mkdir "${PORTAGE_BUILDDIR}/image"
-       if [ -d "${S}" ]; then
+       local srcdir
+       if [[ -d $S ]] ; then
                cd "${S}"
-       else
+       elif hasq $EAPI 0 1 2; then
+               cd "${WORKDIR}"
+       elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
                cd "${WORKDIR}"
+       else
+               die "The source directory '${S}' doesn't exist"
        fi
+
        vecho
        vecho ">>> Install ${PF} into ${ED} category ${CATEGORY}"
        #our custom version of libtool uses $S and $ED to fix
@@ -1292,10 +1317,10 @@ inherit() {
 
                # Retain the old data and restore it later.
                unset B_IUSE B_DEPEND B_RDEPEND B_PDEPEND
-               [ "${IUSE-unset}"    != "unset" ] && B_IUSE="${IUSE}"
-               [ "${DEPEND-unset}"  != "unset" ] && B_DEPEND="${DEPEND}"
-               [ "${RDEPEND-unset}" != "unset" ] && B_RDEPEND="${RDEPEND}"
-               [ "${PDEPEND-unset}" != "unset" ] && B_PDEPEND="${PDEPEND}"
+               [ "${IUSE+set}"       = set ] && B_IUSE="${IUSE}"
+               [ "${DEPEND+set}"     = set ] && B_DEPEND="${DEPEND}"
+               [ "${RDEPEND+set}"    = set ] && B_RDEPEND="${RDEPEND}"
+               [ "${PDEPEND+set}"    = set ] && B_PDEPEND="${PDEPEND}"
                unset IUSE DEPEND RDEPEND PDEPEND
                #turn on glob expansion
                set +f
@@ -1307,22 +1332,22 @@ inherit() {
 
                # If each var has a value, append it to the global variable E_* to
                # be applied after everything is finished. New incremental behavior.
-               [ "${IUSE-unset}"    != "unset" ] && export E_IUSE="${E_IUSE} ${IUSE}"
-               [ "${DEPEND-unset}"  != "unset" ] && export E_DEPEND="${E_DEPEND} ${DEPEND}"
-               [ "${RDEPEND-unset}" != "unset" ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}"
-               [ "${PDEPEND-unset}" != "unset" ] && export E_PDEPEND="${E_PDEPEND} ${PDEPEND}"
+               [ "${IUSE+set}"       = set ] && export E_IUSE="${E_IUSE} ${IUSE}"
+               [ "${DEPEND+set}"     = set ] && export E_DEPEND="${E_DEPEND} ${DEPEND}"
+               [ "${RDEPEND+set}"    = set ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}"
+               [ "${PDEPEND+set}"    = set ] && export E_PDEPEND="${E_PDEPEND} ${PDEPEND}"
 
-               [ "${B_IUSE-unset}"    != "unset" ] && IUSE="${B_IUSE}"
-               [ "${B_IUSE-unset}"    != "unset" ] || unset IUSE
+               [ "${B_IUSE+set}"     = set ] && IUSE="${B_IUSE}"
+               [ "${B_IUSE+set}"     = set ] || unset IUSE
 
-               [ "${B_DEPEND-unset}"  != "unset" ] && DEPEND="${B_DEPEND}"
-               [ "${B_DEPEND-unset}"  != "unset" ] || unset DEPEND
+               [ "${B_DEPEND+set}"   = set ] && DEPEND="${B_DEPEND}"
+               [ "${B_DEPEND+set}"   = set ] || unset DEPEND
 
-               [ "${B_RDEPEND-unset}" != "unset" ] && RDEPEND="${B_RDEPEND}"
-               [ "${B_RDEPEND-unset}" != "unset" ] || unset RDEPEND
+               [ "${B_RDEPEND+set}"  = set ] && RDEPEND="${B_RDEPEND}"
+               [ "${B_RDEPEND+set}"  = set ] || unset RDEPEND
 
-               [ "${B_PDEPEND-unset}" != "unset" ] && PDEPEND="${B_PDEPEND}"
-               [ "${B_PDEPEND-unset}" != "unset" ] || unset PDEPEND
+               [ "${B_PDEPEND+set}"  = set ] && PDEPEND="${B_PDEPEND}"
+               [ "${B_PDEPEND+set}"  = set ] || unset PDEPEND
 
                #turn on glob expansion
                set +f
@@ -2000,7 +2025,7 @@ ebuild_main() {
 
                        for x in ASFLAGS CCACHE_DIR CCACHE_SIZE \
                                CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
-                               [[ ${!x-unset} != unset ]] && export $x
+                               [[ ${!x+set} = set ]] && export $x
                        done
 
                        hasq distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
@@ -2037,13 +2062,6 @@ ebuild_main() {
                                cp "$EBUILD" "build-info/$PF.ebuild"
                        fi
 
-                       local srcdir
-                       if [[ -d $S ]] ; then
-                               srcdir=$S
-                       else
-                               srcdir=$WORKDIR
-                       fi
-                       cd "$srcdir"
                        #our custom version of libtool uses $S and $D to fix
                        #invalid paths in .la files
                        export S D
index 0e598380a34cf7c33f37a71bd757b136e52b8221..c4003636715eff917c003d66d75be2fa7e0012df 100755 (executable)
@@ -48,7 +48,7 @@ class WorldHandler(object):
 
                from portage.sets import SETPREFIX
                sets = self._sets
-               world_atoms = list(sets["world"])
+               world_atoms = list(sets["selected"])
                maxval = len(world_atoms)
                if onProgress:
                        onProgress(maxval, 0)
@@ -90,7 +90,7 @@ class WorldHandler(object):
                return errors
 
        def fix(self, onProgress=None):
-               world_set = self._sets["world"]
+               world_set = self._sets["selected"]
                world_set.lock()
                try:
                        world_set.load() # maybe it's changed on disk
index 501f57d0d324342e15d2743cae6bf0c32ea08276..0198552422190cbebedc7b8f01ceb0965da2cbb3 100755 (executable)
@@ -533,6 +533,7 @@ save_ebuild_env() {
                unset -f dump_trace die diefunc quiet_mode vecho elog_base eqawarn elog \
                        esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \
                        KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
+                       has_phase_defined_up_to \
                        hasg hasgq hasv hasq qa_source qa_call \
                        addread addwrite adddeny addpredict _sb_append_var \
                        lchown lchgrp esyslog use usev useq has_version portageq \
index 255ba32cd43c257cecb2eb43d0709dfc649a9008..95915e034f822b9da7e5e8c170385fe6636f2458 100644 (file)
@@ -3714,6 +3714,7 @@ class config(object):
                mydict={}
                environ_filter = self._environ_filter
 
+               eapi = self.get('EAPI')
                phase = self.get('EBUILD_PHASE')
                filter_calling_env = False
                if phase not in ('clean', 'cleanrm', 'depend'):
@@ -3758,6 +3759,10 @@ class config(object):
                # Filtered by IUSE and implicit IUSE.
                mydict["USE"] = self.get("PORTAGE_USE", "")
 
+               # Don't export AA to the ebuild environment in EAPIs that forbid it
+               if eapi not in ("0", "1", "2"):
+                       mydict.pop("AA", None)
+
                # sandbox's bashrc sources /etc/profile which unsets ROOTPATH,
                # so we have to back it up and restore it.
                rootpath = mydict.get("ROOTPATH")