]> git.donarmstrong.com Git - debhelper.git/blob - dh_installdocs
r144: Initial Import
[debhelper.git] / dh_installdocs
1 #!/usr/bin/perl -w
2 #
3 # Reads debian/docs, installs all files listed there into /usr/doc/$PACKAGE
4 # Also installs the debian/copyright and debian/README.debian and debian/TODO
5
6 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
7 use Dh_Lib;
8 init();
9
10 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
11         $TMP=tmpdir($PACKAGE);
12         $file=pkgfile($PACKAGE,"docs");
13
14         if ( ! -d "$TMP/usr/doc/$PACKAGE") {
15                 doit("install","-d","$TMP/usr/doc/$PACKAGE");
16         }
17
18         undef @docs;
19
20         if ($file) {
21                 @docs=filearray($file);
22         }
23
24         if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
25                 push @docs, @ARGV;
26         }
27
28         if (@docs) {
29                 doit("cp","-a",@docs,"$TMP/usr/doc/$PACKAGE/");
30         }
31
32         # .Debian is correct, according to policy, but I'm easy.
33         $readme_debian=pkgfile($PACKAGE,'README.Debian');
34         if (! $readme_debian) {
35                 $readme_debian=pkgfile($PACKAGE,'README.debian');
36         }
37         if ($readme_debian) {
38                 doit("install","-m","644","-p","$readme_debian","$TMP/usr/doc/$PACKAGE/README.Debian");
39         }
40
41         $todo=pkgfile($PACKAGE,'TODO');
42         if ($todo) {
43                 if (isnative($PACKAGE)) {
44                         doit("install","-m","644","-p",$todo,"$TMP/usr/doc/$PACKAGE/TODO");
45                 }
46                 else {
47                         doit("install","-m","644","-p",$todo,"$TMP/usr/doc/$PACKAGE/TODO.Debian");
48                 }
49         }
50
51         # Support debian/package.copyright, but if not present, fall back
52         # on debian/copyright for all packages, not just the main binary
53         # package.
54         $copyright=pkgfile($PACKAGE,'copyright');
55         if (! $copyright && -e "debian/copyright") {
56                 $copyright="debian/copyright";
57         }
58         if ($copyright) {
59                         doit("install","-m","644","-p",$copyright,"$TMP/usr/doc/$PACKAGE/copyright");
60         }
61 }