summaryrefslogtreecommitdiff
path: root/dh_undocumented
diff options
context:
space:
mode:
authorjoey <joey>1999-09-06 05:47:41 +0000
committerjoey <joey>1999-09-06 05:47:41 +0000
commit37c69d4e7124fb03edf46bea4eb38f6721f2aa2a (patch)
tree2ab81f9330d3cb5b01d3600ec41d1f1988b17f68 /dh_undocumented
parentda7d6c32c080678dc672f7c6e680c11569f46eda (diff)
r266: * FHS complience. Patch from Johnie Ingram <johnie@netgod.net>.
For the most part, this was a straight-forward substitution, dh_installmanpages needed a non-obvious change though. * Closes: #42489, #42587, #41732. * dh_installdocs: Adds code to postinst and prerm as specified in http://www.debian.org/Lists-Archives/debian-ctte-9908/msg00038.html, to make /usr/doc/<package> a compatability symlink to /usr/share/doc/<package>. Note that currently if something exists in /usr/doc/<package> when the postinst is run, it will silently not make the symlink. I'm considering more intellingent handing of this case. * Note that if you build a package with this version of debhelper, it will use /usr/share/man, /usr/share/doc, and /usr/share/info. You may need to modify other files in your package that reference the old locations.
Diffstat (limited to 'dh_undocumented')
-rwxr-xr-xdh_undocumented93
1 files changed, 48 insertions, 45 deletions
diff --git a/dh_undocumented b/dh_undocumented
index ebde8904..c8aa5623 100755
--- a/dh_undocumented
+++ b/dh_undocumented
@@ -1,51 +1,54 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
#
# Passed a list of undocumented man pages, generates symlinks to
-# undocumented.7 for those man pages.
+# undocumented.7.gz for those man pages.
#
# 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" = "$MAINPACKAGE" -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]\)'`
- if [ `expr "$file" : '.*\.[123456789]\(x\)'` ] ; then
- dir=usr/X11R6/man/man$section
- reldir=../../../man
- else
- dir=usr/man/man$section
- reldir=..
- fi
-
- if [ ! -d debian/$TMP/$dir ]; then
- doit "install -d debian/$TMP/$dir"
- fi
-
- doit ln -s $reldir/man7/undocumented.7.gz debian/$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/share/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/share/man/man$section";
+ $reldir="../man7/";
+ }
+ else {
+ $dir="usr/share/man/man$section";
+ $reldir="";
+ }
+
+ if (! -d "$TMP/$dir") {
+ doit("install","-d","$TMP/$dir");
+ }
+ doit("ln","-sf","${reldir}undocumented.7.gz","$TMP/$dir/$file.gz");
+ }
+}