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
|
#!/usr/bin/perl -w
#
# Reads debian/docs, installs all files listed there into /usr/doc/$PACKAGE
# Also installs the debian/copyright and debian/README.debian and debian/TODO
BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
use Dh_Lib;
init();
foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
$TMP=tmpdir($PACKAGE);
$file=pkgfile($PACKAGE,"docs");
if ( ! -d "$TMP/usr/doc/$PACKAGE") {
doit("install","-d","$TMP/usr/doc/$PACKAGE");
}
undef @docs;
if ($file) {
@docs=filearray($file);
}
if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
push @docs, @ARGV;
}
if (@docs) {
doit("cp","-a",@docs,"$TMP/usr/doc/$PACKAGE/");
}
# .Debian is correct, according to policy, but I'm easy.
$readme_debian=pkgfile($PACKAGE,'README.Debian');
if (! $readme_debian) {
$readme_debian=pkgfile($PACKAGE,'README.debian');
}
if ($readme_debian) {
doit("install","-m","644","-p","$readme_debian","$TMP/usr/doc/$PACKAGE/README.Debian");
}
$todo=pkgfile($PACKAGE,'TODO');
if ($todo) {
if (isnative($PACKAGE)) {
doit("install","-m","644","-p",$todo,"$TMP/usr/doc/$PACKAGE/TODO");
}
else {
doit("install","-m","644","-p",$todo,"$TMP/usr/doc/$PACKAGE/TODO.Debian");
}
}
# Support debian/package.copyright, but if not present, fall back
# on debian/copyright for all packages, not just the main binary
# package.
$copyright=pkgfile($PACKAGE,'copyright');
if (! $copyright && -e "debian/copyright") {
$copyright="debian/copyright";
}
if ($copyright) {
doit("install","-m","644","-p",$copyright,"$TMP/usr/doc/$PACKAGE/copyright");
}
}
|