diff options
-rw-r--r-- | Makefile | 0 | ||||
-rw-r--r-- | autoscripts/postinst-info | 1 | ||||
-rw-r--r-- | autoscripts/postinst-info-nosection | 1 | ||||
-rw-r--r-- | autoscripts/postinst-mime | 1 | ||||
-rw-r--r-- | autoscripts/postinst-modules | 2 | ||||
-rw-r--r-- | autoscripts/postrm-xaw | 3 | ||||
-rw-r--r-- | autoscripts/prerm-info | 1 | ||||
-rw-r--r-- | autoscripts/prerm-xaw | 4 | ||||
-rw-r--r-- | debian/subtsvars | 1 | ||||
-rwxr-xr-x | dh_installinfo | 61 | ||||
-rw-r--r-- | dh_installinfo.1 | 54 | ||||
-rwxr-xr-x | dh_installmime | 22 | ||||
-rwxr-xr-x | dh_installmodules | 28 | ||||
-rwxr-xr-x | dh_installpam | 21 | ||||
-rwxr-xr-x | dh_perl | 131 | ||||
-rw-r--r-- | doc/v2 | 58 | ||||
-rw-r--r-- | me.info | 0 | ||||
-rw-r--r-- | t/dh_link | 16 |
18 files changed, 405 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Makefile 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 (<IN>) { + 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 <joeyh@master.debian.org> 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, "<debian/$EXT\subtsvars"); + my @lines=grep { ! /^perl:Depends=/ } <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 = <SCRIPT>; + close (SCRIPT); + if ($line =~ m<^#!\s*/usr/bin/(perl\S*)(?:\s+|$)>) { + $perl = $1; + if ($perl eq "perl") { + $dep = "perl5"; + } elsif ($perl eq "perl-thread") { + $dep = "perl5-thread"; + } elsif ($perl =~ m/^perl-\d\.\d{3}(?:-thread)?$/) { + $dep = $perl; + } elsif ($perl =~ m/^perl(\d\.\d{3})(\d\d)$/) { + # Should never happen but ... + $dep = "perl-$1 (=$1.$2)"; + } + } + return $dep; +} @@ -0,0 +1,58 @@ +Debhelper v2 is a major new revision of debhelper. Currently, v2 is still +being worked on, and will change in drastic ways without notice. To keep +this from breaking packages, debhelper will continue to operate in v1 +compatability mode by default. + +To enable debhelper v2 features (do this with *caution*), set DH_COMPAT=2 +Here are the changes I'm planning to make to debhelper for v2, based on +prior discussion on debian-devel. + +Items marked with a + are done. All others will happen as soon as I can code +them. + +* Standardize on the name used for the temporary build directory of a + package. Currently it's debian/tmp/ for the first package and + debian/<package>/ for other packages of a multi-binary package. I've + decided after much agonizing to to use debian/<package>. The main thing this + has going for it is it means lots of multi-binary packages need only small + alterations, since they already use debian/<package> for making most of + thier .deb's anyway. I eliminated the other ideas for these reasons: + - debian/tmp/<package>: debian/tmp already has history behind it, + changing how it's used would be confusing. + - debian/build/<package>: confusing (is the code compiled there?) + - debian/tmp-<package>, debian/package-<tmp>: too long, little gain + +* dh_installmanpages will be made into a non-DWIM program, so you'll have to + specify all man pages to install and possibly where to put them. This may + look something like: + dh_installmanpages -x xterm.1 xfoo.1 xbar.man + dh_installmanpages --section=8 su.man + Ok, there's a _little_ DWIM left in there, it'll be smart enough to munge + the .man filenames properly. It'll probably just assume all man pages have + an extention, and delete that extentation, and add the correct one. + +* dh_movefiles will use a name other than debian/<package>.files for the + list of what to move, because it can't use debian/files for the first + package, since that file is already used elsewhere. It'll use + debian/<package>.move + +* dh_movefiles should delete empty directories after it's moved all files + out of them. (#17111) + +* debian/README will be installed as /usr/doc/<package>/README in native + packages, and as README.Debian in non-native packages. This is consistent + with the handing of debian/TODO and debian/changelog. (#34628) + +* There will be no change to the names of debhelper config files used, I've + decided against debian/<package>/* and the like, because although those + subdirs do work, they're not allowed by the packaging manual, and they'd + make source unpacking by hand a lot harder. I will leave these files + completly as they are now. However, I will remove most of the language + documenting that debian/<foo> works, and will deprecate that usage. + debian/<package>.<foo> will be preferred even in single binary packages. + +* Every file in etc/ will be automatically be flagged as a conffile. + +* Debhelper config files will support globbing via * and ?, when + appropriate. To turn this off and use those changarcters raw, just quote + them. diff --git a/me.info b/me.info new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/me.info diff --git a/t/dh_link b/t/dh_link new file mode 100644 index 00000000..9f644e78 --- /dev/null +++ b/t/dh_link @@ -0,0 +1,16 @@ +#!/usr/bin/perl +use Test; +plan(tests => 3); + +# It used to not make absolute links in this situation, and it should. +# #37774 +system("./dh_link","etc/foo","usr/lib/bar"); +ok("/etc/foo",readlink("debian/tmp/usr/lib/bar")); + +# let's make sure it makes simple relative links ok. +system("./dh_link","usr/bin/foo","usr/bin/bar"); +ok("foo",readlink("debian/tmp/usr/bin/bar")); + +# ok, more complex relative links. +system("./dh_link","usr/lib/1","usr/bin/2"); +ok("../lib/1",readlink("debian/tmp/usr/bin/2")); |