tag 511048 + patch thanks On Tue, 11 Aug 2009 00:46:24 +0100, Colin Watson wrote:
> On Wed, Jan 07, 2009 at 02:07:25AM +0100, gregor herrmann wrote: > > Sometimes it's necessary to delete a created directory in > > debian/rules' clean target; being able to just pass it to dh_clean / > > add it to debian/clean would be nice. > Seconded. I've run across several cases now where this was the only > reason I needed to add a dh_clean override or similar. I've prepared and tested a patch against current git now that implements removing of directories (i.e. '-rf') from the command line or via d/clean, if the compat level is at least 9. Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key ID: 0x8649AA06 : :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of Free Software Foundation Europe `- NP: Beatles
From 803669ad2c74b491931fca0c16e07efde525df83 Mon Sep 17 00:00:00 2001 From: gregor herrmann <gre...@debian.org> Date: Thu, 8 Dec 2011 23:08:14 +0100 Subject: [PATCH 1/2] dh_clean: in compatibility level 9, remove also directories. Call rm with -rf on arguments on the command line or listed in debian/clean, if compat level >= 9. Closes: #511048 --- dh_clean | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dh_clean b/dh_clean index 15cdc66..35a3e9f 100755 --- a/dh_clean +++ b/dh_clean @@ -36,6 +36,8 @@ B<clean> target in F<debian/rules>. Can list other files to be removed. +Starting with compatibility level 9 this also includes directories. + =back =head1 OPTIONS @@ -61,6 +63,8 @@ multiple times to build up a list of things to exclude. Delete these I<file>s too. +Starting with compatibility level 9 this also includes directories. + =back =cut @@ -70,6 +74,9 @@ init(options => { }); inhibit_log(); +# remove recursively starting with v9 +my $rmflags=(compat(8) ? "-f" : "-rf"); + if ($dh{K_FLAG}) { # dh_prep will be emulated (mostly) by the code below. warning("dh_clean -k is deprecated; use dh_prep instead"); @@ -102,14 +109,14 @@ if (! $dh{D_FLAG} && ! $dh{K_FLAG}) { if (! $dh{D_FLAG}) { if (@ARGV) { - doit("rm","-f","--",@ARGV); + doit("rm",$rmflags,"--",@ARGV); } if (! $dh{K_FLAG}) { if (!compat(6) && -e "debian/clean") { my @clean=grep { ! excludefile($_) } filearray("debian/clean", "."); - doit("rm","-f","--",@clean) if @clean; + doit("rm",$rmflags,"--",@clean) if @clean; } doit("rm","-f","debian/files") -- 1.7.7.3
signature.asc
Description: Digital signature