depend.apache.eclass: Let APXS point to the new location of the binary.
[gentoo.git] / eclass / eutils.eclass
index 13bf1e6cc6374d90079d1335b3851ef1f079b749..aaf195b43c98a9b442b1a3c95889470759684cd0 100644 (file)
@@ -39,7 +39,7 @@ fi
 # Remove CVS directories recursiveley.  Useful when a source tarball contains
 # internal CVS directories.  Defaults to $PWD.
 ecvs_clean() {
-       [[ -z $* ]] && set -- .
+       [[ $# -eq 0 ]] && set -- .
        find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf
        find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
 }
@@ -50,10 +50,20 @@ ecvs_clean() {
 # Remove .svn directories recursiveley.  Useful when a source tarball contains
 # internal Subversion directories.  Defaults to $PWD.
 esvn_clean() {
-       [[ -z $* ]] && set -- .
+       [[ $# -eq 0 ]] && set -- .
        find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
 }
 
+# @FUNCTION: egit_clean
+# @USAGE: [list of dirs]
+# @DESCRIPTION:
+# Remove .git* directories/files recursiveley.  Useful when a source tarball
+# contains internal Git directories.  Defaults to $PWD.
+egit_clean() {
+       [[ $# -eq 0 ]] && set -- .
+       find "$@" -type d -name '.git*' -prune -print0 | xargs -0 rm -rf
+}
+
 # @FUNCTION: estack_push
 # @USAGE: <stack> [items to push]
 # @DESCRIPTION:
@@ -585,6 +595,8 @@ epatch() {
                        : $(( count++ ))
                done
 
+               (( EPATCH_N_APPLIED_PATCHES++ ))
+
                # if we had to decompress the patch, delete the temp one
                if [[ -n ${PIPE_CMD} ]] ; then
                        rm -f "${PATCH_TARGET}"
@@ -679,7 +691,7 @@ edos2unix() {
 #           a full path to an icon
 # type:     what kind of application is this?
 #           for categories:
-#           http://standards.freedesktop.org/menu-spec/latest/apa.html
+#           https://specifications.freedesktop.org/menu-spec/latest/apa.html
 #           if unset, function tries to guess from package's category
 # fields:      extra fields to append to the desktop file; a printf string
 # @CODE
@@ -1721,18 +1733,22 @@ epatch_user() {
 
        # don't clobber any EPATCH vars that the parent might want
        local EPATCH_SOURCE check
-       for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}}; do
+       for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT%/*}}; do
                EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CTARGET}/${check}
                [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check}
                [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check}
                if [[ -d ${EPATCH_SOURCE} ]] ; then
+                       local old_n_applied_patches=${EPATCH_N_APPLIED_PATCHES:-0}
                        EPATCH_SOURCE=${EPATCH_SOURCE} \
                        EPATCH_SUFFIX="patch" \
                        EPATCH_FORCE="yes" \
                        EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \
                        epatch
                        echo "${EPATCH_SOURCE}" > "${applied}"
-                       has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice"
+                       if [[ ${old_n_applied_patches} -lt ${EPATCH_N_APPLIED_PATCHES} ]]; then
+                               has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || \
+                                       EBUILD_DEATH_HOOKS+=" epatch_user_death_notice"
+                       fi
                        return 0
                fi
        done