]> git.donarmstrong.com Git - debhelper.git/blob - dh_undocumented
r421: use strict
[debhelper.git] / dh_undocumented
1 #!/usr/bin/perl -w
2 #
3 # Passed a list of undocumented man pages, generates symlinks to
4 # undocumented.7.gz for those man pages.
5 #
6 # Also, it looks for debian/undocumented files for more lists of
7 # undocumented man pages.
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11 init();
12
13 foreach my $package (@{$dh{DOPACKAGES}}) {
14         my $tmp=tmpdir($package);
15         my $undocumented=pkgfile($package,"undocumented");
16
17         my @undoc;
18         if ($undocumented) {
19                 @undoc=filearray($undocumented);
20         }
21
22         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
23                 push @undoc, @ARGV;
24         }       
25
26         foreach my $file (@undoc) {
27                 $file=~s/.gz$//; # .gz extension is optional in input.
28
29                 # Determine what directory the file belongs in,
30                 # /usr/share/man, or /usr/X11R6/man, and how the link to
31                 # the undocuemtned.7 man page will look.
32                 my ($dir, $reldir);
33                 my ($section)=$file=~m/^.*\.(\d)/;
34                 if (!$section) {
35                         error("\"$file\" does not have an extension.");
36                 }       
37                 if ($file=~/.*\.\dx/) {
38                         $dir="usr/X11R6/man/man$section";
39                         $reldir="../../../share/man/man7/";
40                 }
41                 elsif ($section != 7) {
42                         $dir="usr/share/man/man$section";
43                         $reldir="../man7/";
44                 }
45                 else {
46                         $dir="usr/share/man/man$section";
47                         $reldir="";
48                 }
49
50                 if (! -d "$tmp/$dir") {
51                         doit("install","-d","$tmp/$dir");
52                 }
53                 doit("ln","-sf","${reldir}undocumented.7.gz","$tmp/$dir/$file.gz");
54         }
55 }