[debhelper-devel] [debhelper] 02/02: dh_clean: Support removal of dirs when suffixed with a slash
Niels Thykier
nthykier at moszumanska.debian.org
Fri Nov 6 20:50:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 2be5f72679c4ad6397273c21793d85cafa0b7002
Author: Niels Thykier <niels at thykier.net>
Date: Fri Nov 6 21:41:51 2015 +0100
dh_clean: Support removal of dirs when suffixed with a slash
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debian/changelog | 3 +++
dh_clean | 26 +++++++++++++++++++-------
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 7ddcd42..8d03016 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,9 @@ debhelper (9.20151005) unstable; urgency=medium
* dh_clean: Avoid cleaning up debian/.debhelper when
passed the "-d" flag.
* Dh_Lib.pm: Reject compat levels earlier than 3.
+ * dh_clean: Support removal of directory (plus contents)
+ when they are marked with a trailing slash.
+ (Closes: #511048)
[ Translations ]
* Update German translation (Chris Leick)
diff --git a/dh_clean b/dh_clean
index 34b3d1a..266d5a1 100755
--- a/dh_clean
+++ b/dh_clean
@@ -12,7 +12,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_clean> [S<I<debhelper options>>] [B<-k>] [B<-d>] [B<-X>I<item>] [S<I<file> ...>]
+B<dh_clean> [S<I<debhelper options>>] [B<-k>] [B<-d>] [B<-X>I<item>] [S<I<path> ...>]
=head1 DESCRIPTION
@@ -35,7 +35,10 @@ B<clean> target in F<debian/rules>.
=item F<debian/clean>
-Can list other files to be removed.
+Can list other paths to be removed.
+
+Note directories listed in this file B<must> end with a trailing
+slash. Any content in these directories will be removed as well.
=back
@@ -58,9 +61,12 @@ Exclude files that contain I<item> anywhere in their filename from being
deleted, even if they would normally be deleted. You may use this option
multiple times to build up a list of things to exclude.
-=item I<file> ...
+=item I<path> ...
+
+Delete these I<path>s too.
-Delete these I<file>s too.
+Note directories passed as arguments B<must> end with a trailing
+slash. Any content in these directories will be removed as well.
=back
@@ -103,21 +109,27 @@ if (! $dh{D_FLAG} && ! $dh{K_FLAG}) {
}
if (! $dh{D_FLAG}) {
+ my (@clean_files, @clean_dirs);
if (@ARGV) {
- doit("rm","-f","--", at ARGV);
+ push(@clean_files, grep { !m@/$@ } @ARGV);
+ push(@clean_dirs, grep { m@/$@ } @ARGV);
}
if (! $dh{K_FLAG}) {
if (!compat(6) && -e "debian/clean") {
my @clean=grep { ! excludefile($_) }
- filearray("debian/clean", ".");
- doit("rm","-f","--", at clean) if @clean;
+ filearray("debian/clean", ".");
+ push(@clean_files, grep { !m@/$@ } @clean);
+ push(@clean_dirs, grep { m@/$@ } @clean);
}
doit("rm","-f","debian/files")
unless excludefile("debian/files");
}
+ doit('rm', '-f', '--', @clean_files) if @clean_files;
+ doit('rm', '-fr', '--', @clean_dirs) if @clean_dirs;
+
# See if some files that would normally be deleted are excluded.
my $find_options='';
if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list