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.
---
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
Control: tags -1 -patch Hi, Unfortunately, the proposed change (anchoring the exclusion pattern) could break any number of packages, where the maintainer only used a substring as parameter for --exclude. Also, --exclude is used in a number of different tools that would need a similar change (with the same possible breakage). A new argument is a much safer choice from my PoV. ~Niels
True but since old "--exclude" argument is somewhat broken, perhaps it could be fixed with next compatibility level bump? Just a thought...--- Continuous effort - not strength or intelligence - is the key to unlocking our potential. -- Winston Churchill
¡Hola Dmitry y Niels! El 2015-03-25 a las 17:11 +1100, Dmitry Smirnov escribió: I'm not really sure whether to retitle this bug or to submit a new one, but the issue is about the same, it would be nice to have some improvements in debhelper's exclude option. The current implementation ends up using the values in a find -regex after escaping some shell chars. Making it unnecessarily hard to exclude a file in a multiarch path (for example, excluding plugins in dh_makeshlibs). Just to make the behaviour more bizarre, if the item contains a space then the list of chars that are escaped are much shorter, thus it's possible but quite awful to use exclude values such as: -X' ?usr/lib/[^/]*/?plugins/' (Which is close to what I ended up using, because of the lintian's pkg-has-shlibs-control-file-but-no-actual-shared-libs check that now produces an error on signon-kwallet-extension if not.) Happy hacking,