From 430dd853a0827cf0419d2531cf163d4c1e19c4f9 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 17 Aug 1999 05:12:07 +0000 Subject: r189: Initial revision --- Makefile | 0 autoscripts/postinst-info | 1 + autoscripts/postinst-info-nosection | 1 + autoscripts/postinst-mime | 1 + autoscripts/postinst-modules | 2 + autoscripts/postrm-xaw | 3 + autoscripts/prerm-info | 1 + autoscripts/prerm-xaw | 4 ++ debian/subtsvars | 1 + dh_installinfo | 61 +++++++++++++++++ dh_installinfo.1 | 54 +++++++++++++++ dh_installmime | 22 ++++++ dh_installmodules | 28 ++++++++ dh_installpam | 21 ++++++ dh_perl | 131 ++++++++++++++++++++++++++++++++++++ doc/v2 | 58 ++++++++++++++++ me.info | 0 t/dh_link | 16 +++++ 18 files changed, 405 insertions(+) create mode 100644 Makefile create mode 100644 autoscripts/postinst-info create mode 100644 autoscripts/postinst-info-nosection create mode 100644 autoscripts/postinst-mime create mode 100644 autoscripts/postinst-modules create mode 100644 autoscripts/postrm-xaw create mode 100644 autoscripts/prerm-info create mode 100644 autoscripts/prerm-xaw create mode 100644 debian/subtsvars create mode 100755 dh_installinfo create mode 100644 dh_installinfo.1 create mode 100755 dh_installmime create mode 100755 dh_installmodules create mode 100755 dh_installpam create mode 100755 dh_perl create mode 100644 doc/v2 create mode 100644 me.info create mode 100644 t/dh_link diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e69de29b diff --git a/autoscripts/postinst-info b/autoscripts/postinst-info new file mode 100644 index 00000000..59881a19 --- /dev/null +++ b/autoscripts/postinst-info @@ -0,0 +1 @@ +install-info --quiet --section "#SECTION#" "#SECTION#" #FILE# diff --git a/autoscripts/postinst-info-nosection b/autoscripts/postinst-info-nosection new file mode 100644 index 00000000..cba27d27 --- /dev/null +++ b/autoscripts/postinst-info-nosection @@ -0,0 +1 @@ +install-info --quiet #FILE# diff --git a/autoscripts/postinst-mime b/autoscripts/postinst-mime new file mode 100644 index 00000000..e993233b --- /dev/null +++ b/autoscripts/postinst-mime @@ -0,0 +1 @@ +if [ -x /usr/sbin/update-mime ]; then update-mime; fi diff --git a/autoscripts/postinst-modules b/autoscripts/postinst-modules new file mode 100644 index 00000000..a8f4ce70 --- /dev/null +++ b/autoscripts/postinst-modules @@ -0,0 +1,2 @@ +update-modules +depmod -a diff --git a/autoscripts/postrm-xaw b/autoscripts/postrm-xaw new file mode 100644 index 00000000..b8d718ea --- /dev/null +++ b/autoscripts/postrm-xaw @@ -0,0 +1,3 @@ +if test -x /usr/sbin/update-xaw-wrappers; then + /usr/sbin/update-xaw-wrappers +fi diff --git a/autoscripts/prerm-info b/autoscripts/prerm-info new file mode 100644 index 00000000..b3f53ccd --- /dev/null +++ b/autoscripts/prerm-info @@ -0,0 +1 @@ +install-info --quiet --remove #FILE# diff --git a/autoscripts/prerm-xaw b/autoscripts/prerm-xaw new file mode 100644 index 00000000..2507a2f5 --- /dev/null +++ b/autoscripts/prerm-xaw @@ -0,0 +1,4 @@ +for opts in #OPTS#; do + update-alternatives --quiet --remove $opts +done + diff --git a/debian/subtsvars b/debian/subtsvars new file mode 100644 index 00000000..458d7871 --- /dev/null +++ b/debian/subtsvars @@ -0,0 +1 @@ +perl:Depends=perl5 diff --git a/dh_installinfo b/dh_installinfo new file mode 100755 index 00000000..b6ae40f9 --- /dev/null +++ b/dh_installinfo @@ -0,0 +1,61 @@ +#!/usr/bin/perl -w +# +# Reads debian/info, installs all files listed there into /usr/info +# and puts appropriate commands into the postinst. + +BEGIN { push @INC, "debian", "/usr/lib/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $file=pkgfile($PACKAGE,"info"); + + undef @info; + + if ($file) { + @info=filearray($file); + } + + if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { + push @info, @ARGV; + } + + if (@info) { + if ( ! -d "$TMP/usr/info") { + doit("install","-d","$TMP/usr/info"); + } + doit("cp",@info,"$TMP/usr/info"); + doit("chmod","-R", "go=rX","$TMP/usr/info/"); + doit("chmod","-R", "u+rw","$TMP/usr/info/"); + } + + foreach $file (@info) { + # Only register with install-info if this is a head file in + # a tree of info files. + if ($file=~/\.info$/ && ! $dh{NOSCRIPTS}) { + # Figure out what section this file goes in. + my $section; + open (IN, "<$file") || die "$file: $!"; + while () { + if (/INFO-DIR-SECTION\s+(.*)/) { + $section=$1; + last; + } + } + close IN; + + my $fn="/usr/info/".Dh_Lib::basename($file); + + if ($section ne '') { + autoscript($PACKAGE,"postinst","postinst-info", + "s/#SECTION#/$section/;s:#FILE#:$fn:"); + } + else { + autoscript($PACKAGE,"postinst","postinst-info-nosection", + "s/#FILE#/$fn/"); + } + autoscript($PACKAGE,"prerm","prerm-info", "s:#FILE#:$fn:"); + } + } +} diff --git a/dh_installinfo.1 b/dh_installinfo.1 new file mode 100644 index 00000000..33e388a7 --- /dev/null +++ b/dh_installinfo.1 @@ -0,0 +1,54 @@ +.TH DH_INSTALLINFO 1 "" "Debhelper Commands" "Debhelper Commands" +.SH NAME +dh_installinfo \- install and register info files +.SH SYNOPSIS +.B dh_installinfo +.I "[debhelper options] [-A] [-n] [file ...]" +.SH "DESCRIPTION" +dh_installinfo is a debhelper program that is responsible for installing +info files and registering them with install-info. +.P +Any filenames specified as parameters will be installed into the first +package dh_installinfo is told to act on. By default, this is the first +binary package in debian/control, but if you use -p, -i, or -a flags, it +will be the first package specified by those flags. +.P +A file named debian/package.info (debian/info may be used for the first +binary package in debian/control) can list other files to be installed. +.P +dh_installinfo will automatically generate the postinst and prerm commands +needed to interface with install-info. See +.BR dh_installdeb (1) +for an explanation of how this works. +.SH OPTIONS +.TP +.B debhelper options +See +.BR debhelper (1) +for a list of options common to all debhelper commands. +.TP +.B \-A, \--all +Install all files specified by command line parameters in ALL packages +acted on. +.TP +.B \-n, \--noscripts +Do not modify postinst/prerm scripts. +.TP +.B file ... +Install these info files into the first package acted on. (Or in +all packages if -A is specified). +.SH ENVIRONMENT +See +.BR debhelper (1) +for a list of environment variables that affect all debhelper commands. +.SH "SEE ALSO" +.BR debhelper (1) +.TP +.BR install-info (8) +.SH BUGS +It's impossible to specify filenames with spaces or other whitespace in them +in debian/info file. This is more a historical design flaw than a bug. +.SH "CONFORMS TO" +Debian policy, version 2.5.0.0 +.SH AUTHOR +Joey Hess diff --git a/dh_installmime b/dh_installmime new file mode 100755 index 00000000..232ddc19 --- /dev/null +++ b/dh_installmime @@ -0,0 +1,22 @@ +#!/usr/bin/perl -w + +BEGIN { push @INC, "debian", "/usr/lib/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $mime=pkgfile($PACKAGE,"mime"); + + if ($mime ne '') { + if (! -d "$TMP/usr/lib/mime/packages") { + doit("install","-d","$TMP/usr/lib/mime/packages"); + } + doit("install","-p","-m644",$mime,"$TMP/usr/lib/mime/packages/$PACKAGE"); + + if (! $dh{NOSCRIPTS}) { + autoscript($PACKAGE,"postinst","postinst-mime"); + autoscript($PACKAGE,"postrm","postrm-mime") + } + } +} diff --git a/dh_installmodules b/dh_installmodules new file mode 100755 index 00000000..264ae9c0 --- /dev/null +++ b/dh_installmodules @@ -0,0 +1,28 @@ +#!/usr/bin/perl -w +# +# Register modules with modutils. + +BEGIN { push @INC, "debian", "/usr/lib/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $file=pkgfile($PACKAGE,"modules"); + + if (! -e $TMP) { + doit("install","-d",$TMP); + } + + if ($file) { + if (! -e "$TMP/etc/modutils") { + doit("install","-d","$TMP/etc/modutils"); + doit("cp","-m0644",$file,"$TMP/etc/modutils/$PACKAGE"); + } + + if (! $dh{NOSCRIPTS}) { + autoscript($PACKAGE,"postinst","postinst-modules","s/#PACKAGE#/$PACKAGE/"); + autoscript($PACKAGE,"postrm","postrm-modules","s/#PACKAGE#/$PACKAGE/"); + } + } +} diff --git a/dh_installpam b/dh_installpam new file mode 100755 index 00000000..2262d810 --- /dev/null +++ b/dh_installpam @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w +# +# Integration with debian pam system: +# +# If debian/pam file exists, save it to $TMP/etc/pam.d/$PACKAGE + +BEGIN { push @INC, "debian", "/usr/lib/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $pam=pkgfile($PACKAGE,"pam"); + + if ($pam ne '') { + if (! -d "$TMP/etc/pam.d") { + doit("install","-d","$TMP/etc/pam.d"); + } + doit("install","-p","-m644",$pam,"$TMP/etc/pam.d/$PACKAGE"); + } +} diff --git a/dh_perl b/dh_perl new file mode 100755 index 00000000..4136414f --- /dev/null +++ b/dh_perl @@ -0,0 +1,131 @@ +#!/usr/bin/perl -w +# +# Find dependencies on perl stuff +# Remove .packlist files + +BEGIN { push @INC, "debian", "/usr/lib/debhelper" } +use Dh_Lib; +init(); + +my $perl = $ENV{'PERL'} || '/usr/bin/perl'; +$version=sprintf("%.3f", $]); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $EXT=pkgext($PACKAGE); + + my ($file, $v, $arch); + my $dep_arch = ''; + my $dep = ''; + my $found = 0; + + # Look for perl modules and check where they are installed + if (-d "$TMP/usr/lib/perl5") { + foreach $file (split(/\n/,`find $TMP/usr/lib/perl5 -type f -name "*.pm"`)) { + $found++; + if ($file =~ m<^$TMP/usr/lib/perl5/(\d\.\d{3})/([^/]+)/>) { + $v = $1; + $arch = $2; + check_module_version ($v, $version); + $v .= '-thread' if ($arch =~ /-thread/); + $dep_arch = add_deps ($dep_arch, "perl-$v"); + } elsif ($file =~ m<^$TMP/usr/lib/perl5/(\d.\d{3})/>) { + $v = $1; + check_module_version ($v, $version); + $dep_arch = add_deps ($dep_arch, "perl-$v"); + } + } + } + + if ($found and not $dep_arch) { + $dep = "perl5"; + } elsif ($dep_arch) { + $dep = $dep_arch; + } + + # Look for perl scripts + my ($ff, $newdep); + foreach $file (split(/\n/,`find $TMP -type f \\( -name "*.pl" -or -perm +111 \\)`)) { + $ff=`file -b $file`; + if ($ff =~ /perl/) { + $newdep = dep_from_script ($file); + $dep = add_deps ($dep, $newdep) if $newdep; + } + } + + # Remove .packlist files and eventually some empty directories + if (not $dh{'K_FLAG'}) { + foreach $file (split(/\n/,`find $TMP -type f -name .packlist`)) + { + unlink($file); + # Get the directory name + while ($file =~ s#/[^/]+$##){ + last if (not -d $file); + last if (not rmdir $file); + } + } + } + + next unless $dep; + + if (-e "debian/$EXT\subtsvars") { + open (IN, "; + close IN; + open (OUT, ">debian/$EXT\subtsvars"); + print OUT @lines; + } else { + open (OUT, ">debian/$EXT\subtsvars"); + } + print OUT "perl:Depends=$dep\n"; + close OUT; +} + +sub add_deps { + my ($dep, $new) = @_; + + # If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)? + # is not already in the dependencies + if ($new eq "perl5") { + return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}(\s|,|$)/); + } elsif ($new eq "perl5-thread") { + return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}-thread(\s|,|$)/); + } + + if (not $dep) { + $dep = $new; + } else { + $dep .= ", $new" unless ($dep =~ m/(^|\s)$new(\s|,|$)/); + } + + return $dep; +} + +sub check_module_version { + my ($v1, $v2) = @_; + unless ($v1 eq $v2) { + warning("A module has been found in perl-$v1 arch directory. But perl-$v2 is the perl currently used ...\n"); + } +} + +sub dep_from_script { + my $file = shift; + my ($line, $perl, $dep); + open (SCRIPT, "<$file") || die "Can't open $file: $!\n"; + $line =