diff --git a/scripts/brp-cleanup b/scripts/brp-cleanup index 3215526..2c3b92f 100755 --- a/scripts/brp-cleanup +++ b/scripts/brp-cleanup @@ -21,6 +21,12 @@ PROG="${0##*/}" +echo "Cleaning files in $RPM_BUILD_ROOT ($RPM_CLEANUP_METHOD)" + +if [ "$RPM_CLEANUP_METHOD" = skip ]; then + exit 0 +fi + # If using normal root, avoid changing anything. if [ -z "$(echo "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2 @@ -29,6 +35,14 @@ fi cd "$RPM_BUILD_ROOT" +if [ "$RPM_CLEANUP_METHOD" = none ]; then + exit 0 +fi + +if [ -n "$RPM_CLEANUP_METHOD" -a "$RPM_CLEANUP_METHOD" != auto ]; then + exec "$RPM_CLEANUP_METHOD" +fi + find -type f \( \ -name '#*#' \ -o -name '*~' \ @@ -43,17 +57,19 @@ find -type f \( \ -o -name TAGS \ -o -name core \ -o \( -path '*/.deps/*' -a -name '*.P' \) \ - \) -print0 |xargs -r0 rm -vf + \) -print0 | + xargs -r0 rm -vf -- -find -type d -name CVS -print0 |xargs -r0 rm -vrf +find -type d -name CVS -print0 | + xargs -r0 rm -vrf -- cd usr/lib/perl5 &>/dev/null || exit 0 -echo "Cleaning in $PWD" +find -type f -name .packlist -print0 | + xargs -r0 rm -vf -- -find -type f -name .packlist -print0 |xargs -r0 rm -vf - -find -type f -name \*.bs -size 0 -print0 |xargs -r0 rm -vf +find -type f -name \*.bs -size 0 -print0 | + xargs -r0 rm -vf -- f="$(find -type f -name \*.bs)" if [ -n "$f" ]; then