For bug #157369, clean when cleanup has been triggered by changed timestamps. ...
authorZac Medico <zmedico@gentoo.org>
Sat, 9 Dec 2006 20:45:48 +0000 (20:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 9 Dec 2006 20:45:48 +0000 (20:45 -0000)
svn path=/main/trunk/; revision=5244

bin/ebuild.sh

index 697ef494e17e435d6d8207df6c95f3926e17bb79..fcb7438ed3a174f9c5fbea1506478efc8edcb003 100755 (executable)
@@ -679,18 +679,25 @@ dyn_unpack() {
                        if [ "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/${x}" -nt "${WORKDIR}" ]; then
                                vecho ">>> ${x} has been updated; recreating WORKDIR..."
                                newstuff="yes"
-                               rm -rf "${WORKDIR}"
                                break
                        fi
                done
-               if [ "${EBUILD}" -nt "${WORKDIR}" ]; then
+               if [ "${EBUILD}" -nt "${WORKDIR}" ] && ! hasq keepwork ${FEATURES} ; then
                        vecho ">>> ${EBUILD} has been updated; recreating WORKDIR..."
                        newstuff="yes"
-                       rm -rf "${WORKDIR}"
                elif [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then
                        vecho ">>> Not marked as unpacked; recreating WORKDIR..."
                        newstuff="yes"
-                       rm -rf "${WORKDIR}"
+               fi
+       fi
+       if [ "${newstuff}" == "yes" ]; then
+               # We don't necessarily have privileges to do a full dyn_clean here.
+               rm -rf "${WORKDIR}"
+               if [ -d "${T}" ] && ! hasq keeptemp ${FEATURES} ; then
+                       rm -rf "${T}" && mkdir "${T}"
+               else
+                       [ -e "${T}/environment" ] && \
+                               mv "${T}/environment" "${T}/environment.keeptemp"
                fi
        fi
        if [ -e "${WORKDIR}" ]; then