[debhelper-devel] Bug#511048: dh_clean: please add support for removing directories
Axel Beckert
abe at debian.org
Mon May 26 00:11:29 UTC 2014
Hi,
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.
Seconded, too. I would have written that bug-report if it wouldn't
have existed yet. :-)
gregor herrmann wrote:
> On Thu, 08 Dec 2011 22:51:14 -0400, Joey Hess wrote:
> > gregor herrmann wrote:
> > > 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.
> > I see dh_clean's lack of support for recursive removal a bit of a
> > feature.
>
> I was afraid you would say that :)
And I expected something like that because it was a too obvious idea
to not have been implemented a long time ago.
> > It's a little unusual to need it,
I disagree here. I have quite some packages where that feature would
be very neat and avoid an override. Evolvotron is one of these
packages. I worked on it today and hence I checked once again if that
feature has been implemented in the meanwhile.
> > This ensures that recursive removal is only done explicitly, which
> > avoids it being done by accident.
>
> I see your points, and I agree that the workaround is not difficult,
> and that there's a certain risk. -- Still, I think the "-rf"
> feature would be more positive than negative. Maybe also because I'm
> used to 2-line d/rules file plus adding specific instructions in
> d/foo files, and having to write a manual "rm" into an
> override_dh_clean target just feels weird :)
I have a suggestion how this could be solved without compromising the
security against accidential directory deletion:
What if it would be implemented as follows:
* debian/clean and dh_clean with parameters behave as before, i.e.
bail out if a listed parameter is a directory
* A new file debian/cleandirs is introduced where directories can be
listed which should be removed recursively by dh_clean.
* dh_clean gets a new option, e.g. "-r" and only removes directories
given as parameter on the commandline if they're are listed after
that option (or alternatively only if that option is present
anywhere on the commandline).
JFTR: I actually don't mind about dh_clean parameters, hence I
wouldn't need that -r option and would already be happy if
debian/cleandirs would be introduced. I just mentioned the parameter
to offer the same features on the commandline as with files.
Regards, Axel
--
,''`. | Axel Beckert <abe at debian.org>, http://people.debian.org/~abe/
: :' : | Debian Developer, ftp.ch.debian.org Admin
`. `' | 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE
`- | 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5
More information about the debhelper-devel
mailing list