[debhelper-devel] [debhelper] 01/01: dh_installdocs: Do less under nodoc profile

Niels Thykier nthykier at moszumanska.debian.org
Wed Jun 28 12:18:27 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 b7da6ea323aae5bdd2a89c7ab4d3356ad938f683
Author: Niels Thykier <niels at thykier.net>
Date:   Wed Jun 28 12:17:42 2017 +0000

    dh_installdocs: Do less under nodoc profile
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog                  |  5 +++++
 dh_installdocs                    | 14 +++++++++-----
 t/dh_installdocs/dh_installdocs.t | 21 ++++++++++++++++++++-
 3 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 532c71b..eb2d22a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,11 @@ debhelper (10.6) UNRELEASED; urgency=medium
     "a lot" of info files.
   * Dh_Lib: Introduce a is_build_profile_active function, which
     can be used to check if a given Build-Profile was specified.
+  * dh_installdocs: Ignore given documentation files when the
+    "nodoc" build profile is specified in DEB_BUILD_PROFILES.
+    Note that dh_installdocs is not a complete noop in this case
+    as it still ensures the package has a copyright file (or a
+    symlinked doc directory).  (Closes: #865869)
 
  -- Niels Thykier <niels at thykier.net>  Tue, 27 Jun 2017 17:29:32 +0000
 
diff --git a/dh_installdocs b/dh_installdocs
index fd594ff..54b8a24 100755
--- a/dh_installdocs
+++ b/dh_installdocs
@@ -181,6 +181,8 @@ init(options => {
 });
 
 my $called_getpackages = 0;
+my $nodocs = 0;
+$nodocs = 1 if is_build_profile_active('nodoc');
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	next if is_udeb($package);
@@ -220,12 +222,14 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
 	my @docs;
 
-	if ($file) {
-		@docs=filearray($file, ".");
-	}
+	if (not $nodocs) {
+		if ($file) {
+			@docs = filearray($file, ".");
+		}
 
-	if (($package eq $dh{FIRSTPACKAGE} || ($dh{PARAMS_ALL} && ! $link_doc)) && @ARGV) {
-		push @docs, @ARGV;
+		if (($package eq $dh{FIRSTPACKAGE} || ($dh{PARAMS_ALL} && !$link_doc)) && @ARGV) {
+			push @docs, @ARGV;
+		}
 	}
 
 	if (@docs) {
diff --git a/t/dh_installdocs/dh_installdocs.t b/t/dh_installdocs/dh_installdocs.t
index 2c7b381..ee7e546 100755
--- a/t/dh_installdocs/dh_installdocs.t
+++ b/t/dh_installdocs/dh_installdocs.t
@@ -22,9 +22,13 @@ if (not defined($rootcmd)) {
 	plan skip_all => 'fakeroot required';
 }
 else {
-	plan(tests => 17);
+	plan(tests => 22);
 }
 
+# Drop DEB_BUILD_PROFILES and DEB_BUILD_OPTIONS so they don't interfere
+delete($ENV{DEB_BUILD_PROFILES});
+delete($ENV{DEB_BUILD_OPTIONS});
+
 system("rm -rf debian/foo debian/bar debian/baz");
 
 my $doc = "debian/docfile";
@@ -69,6 +73,21 @@ ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar');
 ok(-e "debian/foo/usr/share/doc/bar/docfile");
 system("rm -rf debian/foo debian/bar debian/baz");
 
+# ... and with nodoc
+
+# docs are ignored, but copyright file is still there
+system("DEB_BUILD_PROFILES=nodoc $rootcmd $TOPDIR/dh_installdocs -pbar $doc");
+ok(!-e "debian/bar/usr/share/doc/bar/docfile");
+ok(!-e "debian/bar/usr/share/doc/bar/copyright");
+system("rm -rf debian/foo debian/bar debian/baz");
+
+# docs are ignored, but symlinked doc dir is still there
+system("DEB_BUILD_PROFILES=nodoc DH_COMPAT=11 $rootcmd $TOPDIR/dh_installdocs -pfoo --link-doc=bar $doc");
+ok(-l "debian/foo/usr/share/doc/foo");
+ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar');
+ok(!-e "debian/foo/usr/share/doc/bar/docfile");
+system("rm -rf debian/foo debian/bar debian/baz");
+
 system("$TOPDIR/dh_clean");
 
 # Local Variables:

-- 
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