Debian Bug report logs - #448615
dh_installdocs : Please consider a separate handler for debian/copyright for embedded use

version graph

Package: debhelper; Maintainer for debhelper is Debhelper Maintainers <debhelper-devel@lists.alioth.debian.org>; Source for debhelper is src:debhelper.

Reported by: Neil Williams <codehelp@debian.org>

Date: Tue, 30 Oct 2007 12:48:02 UTC

Severity: normal

Tags: patch

Found in version debhelper/5.0.59

Done: Neil Williams <codehelp@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#448615; Package debhelper. Full text and rfc822 format available.

Acknowledgement sent to Neil Williams <codehelp@debian.org>:
New Bug report received and forwarded. Copy sent to Joey Hess <joeyh@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Neil Williams <codehelp@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: dh_installdocs : Please consider a separate handler for debian/copyright for embedded use
Date: Tue, 30 Oct 2007 12:46:51 +0000
Package: debhelper
Version: 5.0.59
Severity: wishlist
File: /usr/bin/dh_installdocs

This is just an idea at this stage, but Emdebian currently removes all
/usr/share/doc/ contents in order to make suitably small packages for
embedded use. It would be beneficial if debhelper could help us by 
separating the handling of debian/copyright from the other
documentation so that the Emdebian distribution could remain legal (by
distributing the copyright files) without being burdened by README,
TODO and other package docs that are simply unnecessary on an embedded
device. When storage space is such a problem, it would also be useful if
the new handler would support compressing debian/copyright when a build
option is specified - maybe ifneq
($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE) or a custom DEB_BUILD_OPTION
that Emdebian could use on top of nocheck, nodocs etc. (Seeking wider
adoption of nodocs and some kind of consistent meaning to nodocs is
another topic for discussion.)

Emdebian could then recommend wrapping dh_installdocs in the above test
with the new handler as an alternative or debhelper could do the same
internally.

Whether or not the package ChangeLog files and debian/changelog will be
distributed has not been decided yet. Copyright files are typically
small. Installing changelogs (even compressed) could end up with users
being prevented from installing necessary applications, just to provide
room for the changelog.gz files.

All ideas welcome.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages debhelper depends on:
ii  binutils            2.18.1~cvs20071027-1 The GNU assembler, linker and bina
ii  coreutils           5.97-5.4             The GNU core utilities
ii  dpkg-dev            1.14.7               package building tools for Debian
ii  file                4.21-3               Determines file type using "magic"
ii  html2text           1.3.2a-3             An advanced HTML to text converter
ii  perl                5.8.8-11.1           Larry Wall's Practical Extraction 
ii  po-debconf          1.0.9                manage translated Debconf template

debhelper recommends no packages.

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#448615; Package debhelper. Full text and rfc822 format available.

Acknowledgement sent to Neil Williams <codehelp@debian.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>. Full text and rfc822 format available.

Message #10 received at 448615@bugs.debian.org (full text, mbox):

From: Neil Williams <codehelp@debian.org>
To: 448615@bugs.debian.org
Subject: patches
Date: Sun, 16 Dec 2007 15:43:37 +0000
[Message part 1 (text/plain, inline)]
I'm attaching two patches, one for dh_installdocs and one for dh_compress.

dh_installdocs.diff implements a new subroutine and uses that to omit
all other files except debian/copyright if "nodocs" is given in
DEB_BUILD_OPTIONS.

dh_compress.diff implements a method to allow the compression of
debian/copyright *even if less than 4k* to allow compression for target
filesystems that use smaller block sizes, like many embedded systems.
The option is only enabled if nodocs is specified to DEB_BUILD_OPTIONS.

These work for me, let me know if there are problems.

In due course, I'd like dh_installman (dh_installmanpages),
dh_installinfo, dh_installexamples and dh_installchangelogs to also
support nodocs with the simple addition:

if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~
/nodocs/) {
	exit;
}

Let me know if you would prefer separate bug reports for each of those,
one for all or none.

A patch may also be needed for dh_link so that dangling symlinks can be
prevented when docs are not included - I'll file a separate bug for that
later.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

[dh_compress.diff (text/x-patch, inline)]
--- debhelper-5.0.62/dh_compress 
+++ debhelper-5.0.62.new/dh_compress 
@@ -58,6 +58,13 @@
 
 =back
 
+=head1 NOTES
+
+If the DEB_BUILD_OPTIONS environment variable contains "nodocs",
+debian/copyright is not excluded from compression.
+
+=cut
+
 =head1 CONFORMS TO
 
 Debian policy, version 3.0
@@ -88,21 +95,32 @@
 		push @files, split(/\n/,`sh $olddir/$compress 2>/dev/null`);
 	}
 	else {
-		# Note that all the excludes of odd things like _z 
+		# if nodocs is used, allow compression of debian/copyright
+		my $nodocs=qq/! -name "copyright"/;
+		$nodocs="" if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nodocs/);
+		# also allow compression of sub 4k copyright files for
+		# embedded filesystems with smaller block/page sizes.
+		my $omitsmall=qq/-size +4k -or/;
+		$omitsmall="" if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nodocs/);
+		# find needs -name before ! -name, so add the copyright file
+		# at the start of the find command.
+		my $addcopy="";
+		$addcopy=qq/ -name "copyright" -or/ if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nodocs/);
+		# Note that all the excludes of odd things like _z
 		# are because gzip refuses to compress such files, assumming
 		# they are zip files. I looked at the gzip source to get the
 		# complete list of such extensions: ".gz", ".z", ".taz", 
 		# ".tgz", "-gz", "-z", "_z"
 		push @files, split(/\n/,`
 			find usr/info usr/share/info usr/man usr/share/man usr/X11*/man -type f ! -name "*.gz" 2>/dev/null || true;
-			find usr/share/doc -type f \\( -size +4k -or -name "changelog*" -or -name "NEWS*" \\) \\
+			find usr/share/doc -type f \\( $omitsmall $addcopy -name "changelog*" -or -name "NEWS*" \\) \\
 				\\( -name changelog.html -or ! -iname "*.htm*" \\) \\
 				! -iname "*.gif" ! -iname "*.png" ! -iname "*.jpg" \\
 				! -iname "*.jpeg" ! -iname "*.gz" ! -iname "*.taz" \\
 				! -iname "*.tgz" ! -iname "*.z" ! -iname "*.bz2" \\
 				! -iname "*-gz"  ! -iname "*-z" ! -iname "*_z" \\
 				! -iname "*.jar" ! -iname "*.zip" ! -iname "*.css" \\
-				! -name "copyright" 2>/dev/null || true;
+				$nodocs 2>/dev/null || true;
 			find usr/X11R6/lib/X11/fonts usr/share/fonts/X11 -type f -name "*.pcf" 2>/dev/null || true;
 		`);
 	}
[dh_installdocs.diff (text/x-patch, inline)]
--- debhelper-5.0.62/dh_installdocs 
+++ debhelper-5.0.62.new/dh_installdocs 
@@ -94,9 +94,50 @@
 between invocations of this command. Otherwise, it may cause multiple
 instances of the same text to be added to maintainer scripts.
 
+If the DEB_BUILD_OPTIONS environment variable contains "nodocs", only the
+copyright file will be installed - all other documentation, .docs file(s),
+README.Debian and TODO files are omitted.
+
 =cut
 
 init();
+
+sub handle_copyright($$)
+{
+	my ($tmp, $package) = @_;
+	# If the "directory" is a dangling symlink, then don't install
+	# the copyright file. This is useful for multibinary packages
+	# that share a doc directory.
+	if (-d "$tmp/usr/share/doc/$package") {
+		# Support debian/package.copyright, but if not present, fall
+		# back on debian/copyright for all packages, not just the
+		# main binary package.
+		my $copyright=pkgfile($package,'copyright');
+		if (! $copyright && -e "debian/copyright") {
+			$copyright="debian/copyright";
+		}
+		if ($copyright && ! excludefile($copyright)) {
+				doit("install","-g",0,"-o",0,"-m","644","-p",$copyright,
+					"$tmp/usr/share/doc/$package/copyright");
+		}
+	}
+}
+
+# This variable can be used to exclude all docs.
+if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nodocs/) {
+	foreach my $package (@{$dh{DOPACKAGES}}) {
+		my $tmp=tmpdir($package);
+		next if is_udeb($package);
+		# If this is a symlink, leave it alone.
+		if ( ! -d "$tmp/usr/share/doc/$package" &&
+			 ! -l "$tmp/usr/share/doc/$package") {
+			doit("install","-g",0,"-o",0,"-d","$tmp/usr/share/doc/$package");
+		}
+		# ignore the .docs file(s), just put in copyright
+		&handle_copyright($tmp,$package);
+	}
+	exit;
+}
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	next if is_udeb($package);
@@ -169,22 +210,7 @@
 		}
 	}
 
-	# If the "directory" is a dangling symlink, then don't install
-	# the copyright file. This is useful for multibinary packages 
-	# that share a doc directory.
-	if (-d "$tmp/usr/share/doc/$package") {
-		# Support debian/package.copyright, but if not present, fall
-		# back on debian/copyright for all packages, not just the 
-		# main binary package.
-		my $copyright=pkgfile($package,'copyright');
-		if (! $copyright && -e "debian/copyright") {
-			$copyright="debian/copyright";
-		}
-		if ($copyright && ! excludefile($copyright)) {
-				doit("install","-g",0,"-o",0,"-m","644","-p",$copyright,
-					"$tmp/usr/share/doc/$package/copyright");
-		}
-	}
+	&handle_copyright($tmp,$package);
 
 	# Handle doc-base files. There are two filename formats, the usual
 	# plus an extended format (debian/package.*).
[signature.asc (application/pgp-signature, attachment)]

Tags added: patch Request was from Neil Williams <codehelp@debian.org> to control@bugs.debian.org. (Sun, 16 Dec 2007 15:48:03 GMT) Full text and rfc822 format available.

Blocking bugs of 480518 added: 448615 Request was from Neil Williams <codehelp@debian.org> to control@bugs.debian.org. (Sat, 10 May 2008 15:48:12 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Joey Hess <joeyh@debian.org>:
Bug#448615; Package debhelper. Full text and rfc822 format available.

Acknowledgement sent to Neil Williams <codehelp@debian.org>:
Extra info received and forwarded to list. Copy sent to Joey Hess <joeyh@debian.org>. Full text and rfc822 format available.

Message #19 received at 448615@bugs.debian.org (full text, mbox):

From: Neil Williams <codehelp@debian.org>
To: 448615@bugs.debian.org
Cc: control@bugs.debian.org
Subject: Ping?
Date: Sat, 17 May 2008 20:45:18 +0100
[Message part 1 (text/plain, inline)]
Severity: normal
thanks

Just checking on this bug - the issue is more than just an idea now. I
need to have this support available to be able to use a sane
cross-building autobuilder for Emdebian.

If this bug could be closed, I could start filing bugs for packages that
install docs without using debhelper (for "nodocs" support) without
having to explain why other docs are still installed by debhelper. I
could also start building certain packages reliably using an autobuilder
that did not rely on patches to debian/rules to remove debhelper
commands.

Fixing this issue would also help Emdebian to ensure that copyright
files are available, albeit compressed, in all packages which is
important from a legal viewpoint.

The patches at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=448615#10 were against
the old debhelper - I can update them if requested. The other changes
are trivial, I'd like dh_installman (dh_installmanpages),
dh_installinfo, dh_installexamples and dh_installchangelogs to also
support nodocs with the simple addition:

if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~
/nodocs/) {
	exit;
}

This means that I would also not have to patch debian/foo.install files
to remove debian/*/usr/share/man/man* content.

I know it's too late to get this into Lenny but if I can at least get
the change into unstable, it would make it much more likely that
Emdebian could make a release alongside Debian Lenny.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


[signature.asc (application/pgp-signature, inline)]

Severity set to `normal' from `wishlist' Request was from Neil Williams <codehelp@debian.org> to control@bugs.debian.org. (Sat, 17 May 2008 20:09:04 GMT) Full text and rfc822 format available.

Reply sent to Neil Williams <codehelp@debian.org>:
You have taken responsibility. (Sat, 10 Apr 2010 13:33:11 GMT) Full text and rfc822 format available.

Notification sent to Neil Williams <codehelp@debian.org>:
Bug acknowledged by developer. (Sat, 10 Apr 2010 13:33:11 GMT) Full text and rfc822 format available.

Message #26 received at 448615-done@bugs.debian.org (full text, mbox):

From: Neil Williams <codehelp@debian.org>
To: 448615-done@bugs.debian.org
Subject: Closing
Date: Sat, 10 Apr 2010 14:29:50 +0100
[Message part 1 (text/plain, inline)]
Emdebian has a different way of handling this now - the emdebian-grip
package and postbuild support. Closing.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.linux.codehelp.co.uk/
http://e-mail.is-not-s.ms/

[Message part 2 (application/pgp-signature, inline)]

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 09 May 2010 07:31:46 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 17:16:29 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.