X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_installmanpages;h=cc6a6f6f2c59c8f4330a51f44a6cc8c92cdfe96f;hb=18a0da8092ea9f3dc48bca92b36f592af25a608d;hp=82681f332437081aaf866a625ed6dd70b9376d37;hpb=3f0143c06b3cc3aa746c869e9c5cd269ca48df6d;p=debhelper.git diff --git a/dh_installmanpages b/dh_installmanpages index 82681f3..cc6a6f6 100755 --- a/dh_installmanpages +++ b/dh_installmanpages @@ -1,14 +1,69 @@ #!/usr/bin/perl -w -# -# Automatically find and install man pages. However, do not install any man -# pages listed on the command line. -# Also change man pages with .so commands in them into symlinks. -# -# This is a little bit (hah!) DWIMish, but still very handy. +=head1 NAME + +dh_installmanpages - old-style man page installer (deprecated) + +=cut + +use strict; use File::Find; -BEGIN { push @INC, "debian", "/usr/share/debhelper" } -use Dh_Lib; +use Debian::Debhelper::Dh_Lib; + +=head1 SYNOPSIS + +B [S>] [S ...>] + +=head1 DESCRIPTION + +B is a debhelper program that is responsible for +automatically installing man pages into F +in package build directories. + +This is a DWIM-style program, with an interface unlike the rest of +debhelper. It is deprecated, and you are encouraged to use +L instead. + +B scans the current directory and all subdirectories for +filenames that look like man pages. (Note that only real files are looked +at; symlinks are ignored.) It uses L to verify that the files are +in the correct format. Then, based on the files' extensions, it installs +them into the correct man directory. + +All filenames specified as parameters will be skipped by B. +This is useful if by default it installs some man pages that you do not +want to be installed. + +After the man page installation step, B will check to see +if any of the man pages are F<.so> links. If so, it changes them to symlinks. + +=head1 OPTIONS + +=over 4 + +=item I ... + +Do not install these files as man pages, even if they look like valid man +pages. + +=back + +=head1 BUGS + +B will install the man pages it finds into B packages +you tell it to act on, since it can't tell what package the man +pages belong in. This is almost never what you really want (use B<-p> to work +around this, or use the much better L program instead). + +Files ending in F<.man> will be ignored. + +Files specified as parameters that contain spaces in their filenames will +not be processed properly. + +=cut + +warning("This program is deprecated, switch to dh_installman."); + init(); # Check if a file is a man page, for use by File::Find. @@ -18,8 +73,8 @@ sub find_man { # Does its filename look like a man page? # .ex files are examples installed by deb-make, # we don't want those, or .in files, which are - # from configure. - if (! (-f $_ && /^.*\.[1-9].*$/ && ! /\.(ex|in)$/)) { + # from configure, nor do we want CVS .#* files. + if (! (-f $_ && /^.*\.[1-9].*$/ && ! /\.(ex|in)$/ && ! /^\.#/)) { return; } @@ -27,7 +82,7 @@ sub find_man { if ($File::Find::dir=~m:debian/.*tmp.*:) { return; } - foreach $dir (@allpackages) { + foreach my $dir (@allpackages) { if ($File::Find::dir=~m:debian/\Q$dir\E:) { return; } @@ -60,8 +115,9 @@ sub find_so_man { if ($l=~m/\.so\s+(.*)/) { my $solink=$1; # This test is here to prevent links like ... man8/../man8/foo.8 - if (Dh_Lib::basename($File::Find::dir) eq Dh_Lib::dirname($solink)) { - $solink=Dh_Lib::basename($solink); + if (basename($File::Find::dir) eq + dirname($solink)) { + $solink=basename($solink); } else { $solink="../$solink"; @@ -72,25 +128,27 @@ sub find_so_man { } } -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); +foreach my $package (@{$dh{DOPACKAGES}}) { + next if is_udeb($package); + + my $tmp=tmpdir($package); # Find all filenames that look like man pages. @manpages=(); - @allpackages=GetPackages(''); + @allpackages=getpackages(''); find(\&find_man,'.'); # populates @manpages - foreach $page (@manpages) { + foreach my $page (@manpages) { $page=~s:^\./::; # just for looks - $basename=Dh_Lib::basename($page); + my $basename=basename($page); # Skip all files listed on command line. my $install=1; - foreach $skip (@ARGV) { + foreach my $skip (@ARGV) { # Look at basename of what's on connect line - # for backwards compatability. - if ($basename eq Dh_Lib::basename($skip)) { + # for backwards compatibility. + if ($basename eq basename($skip)) { $install=undef; last; } @@ -98,20 +156,16 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { if ($install) { my $extdir="share"; - # Handle X man pages specially. - if ($basename=~/x$/) { - $extdir="X11R6"; - } my ($section)=$basename=~m/.*\.([1-9])/; - my $destdir="$TMP/usr/$extdir/man/man$section/"; + my $destdir="$tmp/usr/$extdir/man/man$section/"; # Handle translated man pages. my $instname=$basename; my ($langcode)=$basename=~m/.*\.([a-z][a-z])\.([1-9])/; if (defined $langcode && $langcode ne '') { - $destdir="$TMP/usr/$extdir/man/$langcode/man$section/"; + $destdir="$tmp/usr/$extdir/man/$langcode/man$section/"; $instname=~s/\.$langcode\./\./; } @@ -128,14 +182,26 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { # Now the .so conversion. @sofiles=@sodests=(); - foreach $dir (qw{usr/share/man usr/X11R6/man}) { - if (-e "$TMP/$dir") { - find(\&find_so_man, "$TMP/$dir"); + foreach my $dir (qw{usr/share/man}) { + if (-e "$tmp/$dir") { + find(\&find_so_man, "$tmp/$dir"); } } - foreach $sofile (@sofiles) { + foreach my $sofile (@sofiles) { my $sodest=shift(@sodests); doit "rm","-f",$sofile; doit "ln","-sf",$sodest,$sofile; } } + +=head1 SEE ALSO + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Joey Hess + +=cut