]> git.donarmstrong.com Git - debhelper.git/blob - dh_undocumented
r338: * Patch from Jorgen `forcer' Schaefer <forcer at mindless.com> (much
[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 Debian::Debhelper::Dh_Lib;
10 init();
11
12 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
13         $TMP=tmpdir($PACKAGE);
14         $undocumented=pkgfile($PACKAGE,"undocumented");
15
16         @undoc=();
17         if ($undocumented) {
18                 @undoc=filearray($undocumented);
19         }
20
21         if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
22                 push @undoc, @ARGV;
23         }       
24
25         foreach $file (@undoc) {
26                 $file=~s/.gz$//; # .gz extension is optional in input.
27
28                 # Determine what directory the file belongs in,
29                 # /usr/share/man, or /usr/X11R6/man, and how the link to
30                 # the undocuemtned.7 man page will look.
31                 ($section)=$file=~m/^.*\.(\d)/;
32                 if (!$section) {
33                         error("\"$file\" does not have an extension.");
34                 }       
35                 if ($file=~/.*\.\dx/) {
36                         $dir="usr/X11R6/man/man$section";
37                         $reldir="../../../share/man/man7/";
38                 }
39                 elsif ($section != 7) {
40                         $dir="usr/share/man/man$section";
41                         $reldir="../man7/";
42                 }
43                 else {
44                         $dir="usr/share/man/man$section";
45                         $reldir="";
46                 }
47
48                 if (! -d "$TMP/$dir") {
49                         doit("install","-d","$TMP/$dir");
50                 }
51                 doit("ln","-sf","${reldir}undocumented.7.gz","$TMP/$dir/$file.gz");
52         }
53 }