X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_undocumented;h=77ee3f585a120550d1cbd8ca454baaaac62ce3ed;hb=6a4c47eea5a5601f351a1fa0afd5e13aed56238b;hp=31b2f987463b99cf3f049a925a359167d7ffdc21;hpb=94f1df06050aa3c512fd8af6e67690f482fbcd5a;p=debhelper.git diff --git a/dh_undocumented b/dh_undocumented index 31b2f98..77ee3f5 100755 --- a/dh_undocumented +++ b/dh_undocumented @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/usr/bin/perl -w # # Passed a list of undocumented man pages, generates symlinks to # undocumented.7.gz for those man pages. @@ -6,48 +6,49 @@ # Also, it looks for debian/undocumented files for more lists of # undocumented man pages. -PATH=debian:$PATH:/usr/lib/debhelper -. dh_lib - -for PACKAGE in $DH_DOPACKAGES; do - TMP=`tmpdir $PACKAGE` - EXT=`pkgext $PACKAGE` - - undoc="" - - if [ -e debian/${EXT}undocumented ]; then - undoc=`tr "\n" " " < debian/${EXT}undocumented` - fi - - if [ \( "$PACKAGE" = "$DH_FIRSTPACKAGE" -o "$DH_PARAMS_ALL" \) \ - -a "$*" ]; then - undoc="$* $undoc" - fi - - if [ "$undoc" ]; then - for file in $undoc; do - # Remove .gz extention from the filename, if present. - if [ `expr "$file" : '\(.*\).gz'` ]; then - file=`expr "$file" : '\(.*\).gz'` - fi - - # Determine what directory the file belongs in, - # /usr/man, or /usr/X11R6/man. - section=`expr "$file" : '.*\.\([123456789]\)'` \ - || error "\"$file\" does not have an extention." - if [ `expr "$file" : '.*\.[123456789]\(x\)'` ] ; then - dir=usr/X11R6/man/man$section - reldir=../../../man - else - dir=usr/man/man$section - reldir=.. - fi - - if [ ! -d $TMP/$dir ]; then - doit "install -d $TMP/$dir" - fi - - doit "ln -s $reldir/man7/undocumented.7.gz $TMP/$dir/$file.gz" - done - fi -done +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $undocumented=pkgfile($PACKAGE,"undocumented"); + + @undoc=(); + if ($undocumented) { + @undoc=filearray($undocumented); + } + + if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { + push @undoc, @ARGV; + } + + foreach $file (@undoc) { + $file=~s/.gz$//; # .gz extention is optional in input. + + # Determine what directory the file belongs in, + # /usr/man, or /usr/X11R6/man, and how the link to + # the undocuemtned.7 man page will look. + ($section)=$file=~m/^.*\.(\d)/; + if (!$section) { + error("\"$file\" does not have an extention."); + } + if ($file=~/.*\.\dx/) { + $dir="usr/X11R6/man/man$section"; + $reldir="../../../man/man7/"; + } + elsif ($section != 7) { + $dir="usr/man/man$section"; + $reldir="../man7/"; + } + else { + $dir="usr/man/man$section"; + $reldir=""; + } + + if (! -d "$TMP/$dir") { + doit("install","-d","$TMP/$dir"); + } + doit("ln","-sf","${reldir}undocumented.7.gz","$TMP/$dir/$file.gz"); + } +}