Package: debhelper
Version: 5.0.37.1
Severity: wishlist
Tags: patch

Hello,

please add the option --prefer-from-docs-files to dh_installdocs to
prefer files from debian/package.docs over files specified on command
line. This option can be usefull to solve bug #369268 in cdbs.

I tried to implement this option but I don't know whether the approach
to solve #369268 is okay. So I would like at least a comment from a cdbs
maintainer whether he supports this wishlist bug and will make use of
the new option.

Also the documentation of the new option should be reviewed since I'm
not a native english speaker.

Any comments also on the cdbs bug are appreciated.

Yours
  Micha

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-3-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages debhelper depends on:
ii  binutils             2.16.1cvs20060413-1 The GNU assembler, linker and bina
ii  coreutils            5.96-3              The GNU core utilities
ii  dpkg-dev             1.13.21             package building tools for Debian
ii  file                 4.17-2              Determines file type using "magic"
ii  html2text            1.3.2a-3            An advanced HTML to text converter
ii  perl                 5.8.8-6             Larry Wall's Practical Extraction 
ii  po-debconf           1.0.2               manage translated Debconf template

debhelper recommends no packages.

-- no debconf information
diff -urN debhelper-5.0.37.1/Debian/Debhelper/Dh_Getopt.pm 
debhelper-micha/Debian/Debhelper/Dh_Getopt.pm
--- debhelper-5.0.37.1/Debian/Debhelper/Dh_Getopt.pm    2006-04-14 
00:35:50.000000000 +0200
+++ debhelper-micha/Debian/Debhelper/Dh_Getopt.pm       2006-06-19 
11:59:18.134530504 +0200
@@ -170,6 +170,8 @@
                
                "language=s" => \$options{LANGUAGE},
 
+               "prefer-from-docs-files" => \$options{PREFER_FROM_DOCS_FILES},
+
                "<>" => \&NonOption,
        );
 
diff -urN debhelper-5.0.37.1/dh_installdocs debhelper-micha/dh_installdocs
--- debhelper-5.0.37.1/dh_installdocs   2006-01-04 02:20:51.000000000 +0100
+++ debhelper-micha/dh_installdocs      2006-06-19 12:11:49.700275144 +0200
@@ -11,7 +11,7 @@
 
 =head1 SYNOPSIS
 
-B<dh_installdocs> [S<I<debhelper options>>] [B<-A>] [B<-n>] [B<-X>I<item>] 
[S<I<file ...>>]
+B<dh_installdocs> [S<I<debhelper options>>] [B<-A>] [B<-n>] [B<-X>I<item>] 
[B<--prefer-from-docs-files>] [S<I<file ...>>]
 
 =head1 DESCRIPTION
 
@@ -29,6 +29,10 @@
 binary package in debian/control, but if you use B<-p>, B<-i>, or B<-a> flags, 
it
 will be the first package specified by those flags.
 
+If you use B<--prefer-from-docs-files> filenames listed in debian/package.docs
+will get installed from the origin listed in debian/package.docs preferred over
+filename's origins specified as parameter.
+
 Also, debian/README.Debian (or debian/README.debian) and debian/TODO, if
 they exist, will be installed into the first binary package listed in
 debian/control, if dh_installdocs is acting on that package. Note that
@@ -66,6 +70,11 @@
 Exclude files that contain "item" anywhere in their filename from
 being installed. Note that this includes doc-base files.
 
+=item B<--prefer-from-docs-files>
+
+Install the files specified on command line only if no equal named file
+is listed in the corresponding debian/package.docs.
+
 =item I<file ...>
 
 Install these files as documentation into the first package acted on. (Or
@@ -117,7 +126,21 @@
        }
 
        if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
-               push @docs, @ARGV;
+               if ($dh{PREFER_FROM_DOCS_FILES}) {
+                       foreach my $argv_doc (@ARGV) {
+                               my $argv_doc_basename = basename($argv_doc);
+                               my $basename_collision = 0;
+                               foreach my $doc (@docs) {
+                                       if (basename($doc) eq 
$argv_doc_basename) {
+                                               $basename_collision = 1;
+                                               last;
+                                       }
+                               }
+                               push @docs, $argv_doc if not 
$basename_collision;
+                       }
+               } else {
+                       push @docs, @ARGV;
+               }
        }
 
        if (@docs) {

Reply via email to