added RPM_CLEANUP_METHOD support

This commit is contained in:
Дмитрий Левин 2002-07-21 13:48:37 +00:00
parent 6cc2254a2e
commit 257e1bc1ab

View File

@ -21,6 +21,12 @@
PROG="${0##*/}" 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 using normal root, avoid changing anything.
if [ -z "$(echo "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then if [ -z "$(echo "$RPM_BUILD_ROOT" |tr -d ' /.')" ]; then
echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2 echo "$PROG: non-/ \$RPM_BUILD_ROOT expected" >&2
@ -29,6 +35,14 @@ fi
cd "$RPM_BUILD_ROOT" 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 \( \ find -type f \( \
-name '#*#' \ -name '#*#' \
-o -name '*~' \ -o -name '*~' \
@ -43,17 +57,19 @@ find -type f \( \
-o -name TAGS \ -o -name TAGS \
-o -name core \ -o -name core \
-o \( -path '*/.deps/*' -a -name '*.P' \) \ -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 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)" f="$(find -type f -name \*.bs)"
if [ -n "$f" ]; then if [ -n "$f" ]; then