[debhelper-devel] [debhelper] 02/02: dh_compress: Avoid compressing examples [c12]
Niels Thykier
nthykier at moszumanska.debian.org
Sun Dec 31 18:26:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 1c61dca25a950d3807f90aecaaa4154e5823e697
Author: Niels Thykier <niels at thykier.net>
Date: Sun Dec 31 18:25:25 2017 +0000
dh_compress: Avoid compressing examples [c12]
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debhelper.pod | 5 +++++
debian/changelog | 3 +++
dh_compress | 4 +++-
t/dh_compress.t | 35 ++++++++++++++++++-----------------
4 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/debhelper.pod b/debhelper.pod
index fc236c2..5a17502 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 7738662..ba293ff 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 at thykier.net> Sun, 17 Dec 2017 07:59:18 +0000
diff --git a/dh_compress b/dh_compress
index c175615..78c89c9 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 b2055f0..1eb6156 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 {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list