AM_TAP_LOG_DRIVER_FLAGS = --merge
-EXTRA_DIST += t/README t/ax/is t/ax/is_newest
+EXTRA_DIST += t/README t/ax/is t/ax/is_newest t/ax/deltree.pl
## Will be updated later.
TESTS =
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-## Directories candidate to be test directories match this wildcard.
- @globs='t/*.dir t/*/*.dir */t/*.dir */t/*/*.dir'; \
-## The 'nullglob' bash option is not portable, so use perl.
- dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \
- if test -n "$$dirs"; then \
-## Errors in find are acceptable, errors in rm are not.
- find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
- echo " rm -rf $$dirs"; \
- rm -rf $$dirs || exit 1; \
- fi
+ $(AM_V_GEN)$(PERL) $(srcdir)/t/ax/deltree.pl t/*.dir t/*/*.dir */t/*.dir
## ---------------- ##
--- /dev/null
+#!/usr/bin/env perl
+# deltree: recursively removes file and directory,
+# trying to handle permissions and other complications.
+
+use strict;
+use warnings FATAL => 'all';
+use File::Path qw/rmtree/;
+
+my $exit_status = 0;
+local $SIG{__WARN__} = sub { warn "@_"; $exit_status = 1; };
+
+foreach my $path (@ARGV) {
+ local $@ = undef;
+ rmtree ($path);
+}
+
+exit $exit_status;
+
+# vim: ft=perl ts=4 sw=4 et
rm_rf_ ()
{
test $# -gt 0 || return 0
- # Ignore failures in find, we are only interested in failures of the
- # final rm.
- find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
- rm -rf "$@"
+ $PERL "$am_testaux_srcdir"/deltree.pl "$@"
}
commented_sed_unindent_prog='