[debhelper-devel] Bug#788098: Bug#788098: [patch] Re: dh_usrlocal leaves directories behind
Niels Thykier
niels at thykier.net
Wed Jun 10 14:10:37 UTC 2015
On 2015-06-10 15:49, Thibaut Paumard wrote:
> Control: tag -1 + patch
> Control: found -1 9.20150501
> Control: notfound -1 9.20150101
> Control: thanks
>
> Hi,
>
Hi,
Did you intend to add a found version only to remove it again?
> The attached path sorts the directories in reverse order for prerm. This
> has the effect that subdirectories are removed first, so that "trunk"
> directories have a chance of being empty when we try to remove them.
>
> Kind regards, Thibaut.
>
>
Thanks, only one remark (see interleaved)
> dh_usrlocal-remove-directories-in-reverse-order.patch
>
>
> diff --git a/dh_usrlocal b/dh_usrlocal
> index 193d70d..94940a3 100755
> --- a/dh_usrlocal
> +++ b/dh_usrlocal
> @@ -103,7 +103,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
> # is parsed by the shell in double-quotes
> my $dirs = join("$ebs\n", sort @dirs);
> pop @justdirs; # don't remove directories directly in /usr/local
> - my $justdirs = join("$ebs\n", sort @justdirs);
> + my $justdirs = join("$ebs\n", sort {$b cmp $a} @justdirs);
There is a better idiom for reversed sorts in perl, which is:
reverse sort @justdirs;
"Recent" versions of perl already optimise it to avoid doing two
separate list operations.
With that changed, it looks good to go.
~Niels
More information about the debhelper-devel
mailing list