[debhelper-devel] Bug#781131: dh_compress: please improve "--exclude" (-X) option
Dmitry Smirnov
onlyjob at debian.org
Tue Mar 24 23:12:05 UTC 2015
Package: debhelper
Version: 9.20150101
Severity: minor
Tags: patch
I'm working on package where I install "*.cfg" files as examples.
Because those files are used as configuration templates I do not want to
compress them so I added the following to "debian/rules":
override_dh_compress:
dh_compress --exclude=.cfg
Unfortunately this also prevents compression of "*.cfg.5" man pages and cause
lintian error "manpage-not-compressed".
I was not able to find how to exclude "*.cfg" files from compression without
affecting "*.cfg.5" files. The only thing I could probably do is to hard code
file name and path as follows:
dh_compress --exclude="examples/myconfigfile.cfg"
but that's ugly for more than one file. IMHO the problem is that "\Q...\E"
constraints (see dh_compress line 137) do not allow me to use regex in the
exclude pattern.
Another problem is that excluded substring is not anchored so unexpected
matches occur if exclude string is present anywhere in the file name.
IMHO the minimum workaround would be to anchor exclusion pattern to the end of
the file name as follows:
~~~~
--- dh_compress
+++ dh_compress
@@ -133,9 +133,9 @@
my @new=();
foreach (@files) {
my $ok=1;
foreach my $x (@{$dh{EXCLUDE}}) {
- if (/\Q$x\E/) {
+ if (/\Q$x\E\Z/) {
$ok='';
last;
}
}
~~~~
More robust and flexible solution would be to add new "--rexclude" option to
allow regex exclusion patterns.
--
Best wishes,
Dmitry Smirnov
GPG key : 4096R/53968D1B
---
Free speech is the bedrock of liberty and a free society. And yes, it
includes the right to blaspheme and offend.
-- Ayaan Hirsi Ali, 2010
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/debhelper-devel/attachments/20150325/5bd87240/attachment.sig>
More information about the debhelper-devel
mailing list