summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debhelper.pod5
-rw-r--r--debian/changelog3
-rwxr-xr-xdh_compress4
-rwxr-xr-xt/dh_compress.t35
4 files changed, 29 insertions, 18 deletions
diff --git a/debhelper.pod b/debhelper.pod
index fc236c2d..5a17502b 100644
--- a/debhelper.pod
+++ b/debhelper.pod
@@ -774,6 +774,11 @@ The B<dh_missing> tool will now default to B<--list-missing>.
The B<dh_makeshlibs> tool will now only pass libraries to L<dpkg-gensymbols(1)>
if the ELF binary has a SONAME (containing ".so").
+=item -
+
+The B<dh_compress> tool no longer compresses examples (i.e. anything installed
+in F<</usr/share/doc/I<package>/examples>>.)
+
=back
=back
diff --git a/debian/changelog b/debian/changelog
index 77386620..ba293ffd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,9 @@ debhelper (11.1) UNRELEASED; urgency=medium
* dh_makeshlibs: In compat 12, stop passing ELF binaries without
a SONAME to dpkg-gensymbols. Thanks to Steve Langasek for the
report. (Closes: #653640)
+ * dh_compress: In compat 12, stop compressing any thing in
+ /usr/share/doc/$pkg/examples. Thanks to Piotr Ożarowski for
+ the suggestion. (Closes: #593382)
-- Niels Thykier <niels@thykier.net> Sun, 17 Dec 2017 07:59:18 +0000
diff --git a/dh_compress b/dh_compress
index c1756150..78c89c94 100755
--- a/dh_compress
+++ b/dh_compress
@@ -90,6 +90,8 @@ on_pkgs_in_parallel {
# Run the file name gathering commands from within the directory
# structure that will be effected.
next unless -d $tmp;
+ my $ignore_doc_dirs = '-name _sources';
+ $ignore_doc_dirs .= qq{ -o -path "usr/share/doc/$package/examples"} if not compat(11);
$olddir = getcwd() if not defined $olddir;
verbose_print("cd $tmp");
chdir($tmp) || error("Can't cd to $tmp: $!");
@@ -117,7 +119,7 @@ on_pkgs_in_parallel {
! -iname "*.jpeg" \\
2>/dev/null || true;
find usr/share/doc \\
- \\( -type d -name _sources -prune -false \\) -o \\
+ \\( -type d \\( $ignore_doc_dirs \\) -prune -false \\) -o \\
-type f \\( -size +4k -o -name "changelog*" -o -name "NEWS*" \\) \\
\\( -name changelog.html -o ! -iname "*.htm*" \\) \\
! -iname "*.xhtml" \\
diff --git a/t/dh_compress.t b/t/dh_compress.t
index b2055f0c..1eb61567 100755
--- a/t/dh_compress.t
+++ b/t/dh_compress.t
@@ -13,7 +13,7 @@ use Debian::Debhelper::Dh_Lib qw(!dirname);
my $PREFIX = 'debian/debhelper/usr/share/doc/debhelper';
-plan tests => 1;
+plan tests => 2;
each_compat_subtest {
# we are testing compressing doc txt files
@@ -82,27 +82,28 @@ each_compat_subtest {
rm_test_dir();
};
+each_compat_from_and_above_subtest(12, sub {
+ make_path("${PREFIX}/examples");
+ create_file_of_size("${PREFIX}/examples/foo.py", 5120);
+ ok(run_dh_tool('dh_compress'));
+ ok(-f "${PREFIX}/examples/foo.py", "${PREFIX}/examples/foo.py is not compressed");
+ ok(! -f "${PREFIX}/examples/foo.py.gz", "${PREFIX}/examples/foo.py is not compressed");
+});
+
+sub create_file_of_size {
+ my ($filename, $size) = @_;
+ open(my $fh, '>', $filename) or error("open($filename) failed: $!");
+ print {$fh} 'X' x $size;
+ close($fh) or error("close($filename) failed: $!");
+}
sub mk_test_dir {
rm_test_dir();
- make_path('debian/debhelper/usr/share/doc/debhelper');
-
- my $fh;
-
- # write 2k to foo.txt
- open $fh, '>', 'debian/debhelper/usr/share/doc/debhelper/foo.txt'
- or die "Could not write to debian/debhelper/usr/share/doc/debhelper/foo.txt: $!";
- print $fh 'X' x 2048;
- close $fh
- or die "Could not write to debian/debhelper/usr/share/doc/debhelper/bar.txt: $!";
+ make_path($PREFIX);
- # write 5k to bar.txt
- open $fh, '>', 'debian/debhelper/usr/share/doc/debhelper/bar.txt'
- or die "Could not write to debian/debhelper/usr/share/doc/debhelper/bar.txt: $!";
- print $fh 'X' x 5120;
- close $fh
- or die "Could not write to debian/debhelper/usr/share/doc/debhelper/bar.txt: $!";
+ create_file_of_size("${PREFIX}/foo.txt", 2048);
+ create_file_of_size("${PREFIX}/bar.txt", 5120);
}
sub rm_test_dir {