1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#!/usr/bin/perl -w
=head1 NAME
installdocbase - modified version of dh_installdocs to only install the
*.doc-base files in the debian/ directory.
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
=head1 OPTIONS
=over 4
=item B<-A>, B<--all>
Install all files specified by command line parameters in ALL packages
acted on.
=item B<-n>, B<--noscripts>
Do not modify postinst/prerm scripts.
=item B<-Xitem>, B<--exclude=item>
Exclude files that contain "item" anywhere in their filename from
being installed.
=item I<file ...>
Install these files as documentation into the first package acted on. (Or
in all packages if B<-A> is specified).
=back
=cut
init();
foreach my $package (@{$dh{DOPACKAGES}}) {
next if is_udeb($package);
my $tmp=tmpdir($package);
# Handle doc-base files. There are two filename formats, the usual
# plus an extended format (debian/package.*).
my %doc_ids;
opendir(DEB,"debian/") || error("can't read debian directory: $!");
# If this is the main package, we need to handle unprefixed filenames.
# For all packages, we must support both the usual filename format plus
# that format with a period an something appended.
my $regexp="\Q$package\E\.";
if ($package eq $dh{MAINPACKAGE}) {
$regexp="(|$regexp)";
}
foreach my $fn (grep {/^${regexp}doc-base(\..*)?$/} readdir(DEB)) {
# .EX are example files, generated by eg, dh-make
next if $fn=~/\.EX$/;
# Parse the file to get the doc id.
open (IN, "debian/$fn") || die "Cannot read debian/$fn.";
while (<IN>) {
if (/^Document:\s+(.*)(\s+)?/) {
$doc_ids{$fn}=$1;
last;
}
}
close IN;
}
closedir(DEB);
if (%doc_ids) {
if (! -d "$tmp/usr/share/doc-base/") {
doit("install","-g",0,"-o",0,"-d","$tmp/usr/share/doc-base/");
}
}
foreach my $fn (keys %doc_ids) {
doit("install","-g",0,"-o",0,"-m644","-p","debian/$fn",
"$tmp/usr/share/doc-base/$doc_ids{$fn}");
if (! $dh{NOSCRIPTS}) {
autoscript($package,"postinst","postinst-doc-base",
"s/#DOC-ID#/$doc_ids{$fn}/",
);
autoscript($package,"prerm","prerm-doc-base",
"s/#DOC-ID#/$doc_ids{$fn}/",
);
}
}
}
=head1 SEE ALSO
L<debhelper(7)>
This program is a part of debhelper.
=head1 AUTHOR
Joey Hess <joeyh@debian.org>
=cut
|