diff options
-rw-r--r-- | Dh_Getopt.pm | 13 | ||||
-rw-r--r-- | debian/changelog | 15 | ||||
-rw-r--r-- | dh_builddeb.1 | 4 | ||||
-rw-r--r-- | dh_gencontrol.1 | 4 | ||||
-rwxr-xr-x | dh_installchangelogs | 8 | ||||
-rw-r--r-- | dh_installinit.1 | 4 | ||||
-rw-r--r-- | dh_shlibdeps.1 | 4 | ||||
-rwxr-xr-x | dh_suidregister | 96 | ||||
-rw-r--r-- | doc/PROGRAMMING | 2 |
9 files changed, 104 insertions, 46 deletions
diff --git a/Dh_Getopt.pm b/Dh_Getopt.pm index 0eec704d..5084d6f0 100644 --- a/Dh_Getopt.pm +++ b/Dh_Getopt.pm @@ -50,6 +50,11 @@ sub AddExclude { my($option,$value)=@_; push @{$options{EXCLUDE}},$value; } +# This collects non-options values. +sub NonOption { + push @{$options{ARGV}}, @_; +} + # Parse options and return a hash of the values. sub parseopts { undef %options; @@ -122,6 +127,8 @@ sub parseopts { "number=s" => \$options{number}, "flavor=s" => \$options{flavor}, + + "<>" => \&NonOption, ); if (!$ret) { @@ -168,6 +175,12 @@ sub parseopts { error("I have no package to build"); } + # Anything left in @ARGV is options that appeared after a -- + # These options are added to U_PARAMS, while the non-option + # values we collected replace them in @ARGV; + $options{U_PARAMS}.=join(' ', @ARGV); + @ARGV=@{$options{ARGV}} if exists $options{ARGV}; + return %options; } diff --git a/debian/changelog b/debian/changelog index 2de265dd..d32495e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +debhelper (2.0.74) unstable; urgency=low + + * dh_suidregister: Die with understandable error message if asked to + act on files that don't exist. + * dh_installchangelogs: to comply with policy, if it's told to act on a + html changelog, it installs it as changelog.html.gz and dumps a plain + text version to changelog.gz. The dumping is done with lynx. + (Closes: #51099) + * Dh_Getopt.pm: Modified it so any options specified after -- are added to + U_PARAMS. This means that instead of passing '-u"something nasty"' to + dh_gencontrol and the like, you can pass '-- something nasty' without + fiddling to get the quoting right, etc. + + -- Joey Hess <joeyh@master.debian.org> Tue, 23 Nov 1999 11:36:15 -0800 + debhelper (2.0.73) unstable; urgency=low * Actually, debhelper build-depends on perl-5.005. diff --git a/dh_builddeb.1 b/dh_builddeb.1 index 556b5430..4e87b7b3 100644 --- a/dh_builddeb.1 +++ b/dh_builddeb.1 @@ -3,7 +3,7 @@ dh_builddeb \- build debian packages .SH SYNOPSIS .B dh_builddeb -.I "[debhelper options] [--destdir=directory] [-uparams]" +.I "[debhelper options] [--destdir=directory] [-uparams] [-- params]" .SH "DESCRIPTION" dh_builddeb simply calls .BR dpkg (8) @@ -20,6 +20,8 @@ Use this if you want the generated .deb files to be put in a directory other than the default of ".." .TP .B \-uparams +.TP +.B \-\- params Pass "params" to .BR dpkg-deb (1) when it is used to build the package. diff --git a/dh_gencontrol.1 b/dh_gencontrol.1 index 84bdb0a2..15e90a7c 100644 --- a/dh_gencontrol.1 +++ b/dh_gencontrol.1 @@ -3,7 +3,7 @@ dh_gencontrol \- generate and install control file .SH SYNOPSIS .B dh_gencontrol -.I "[debhelper options] [-uparams]" +.I "[debhelper options] [-uparams] [-- params]" .SH "DESCRIPTION" dh_gencontrol is a debhelper program that is responsible for generating control files, and installing them into the DEBIAN directory with the proper @@ -19,6 +19,8 @@ See for a list of options common to all debhelper commands. .TP .B \-uparams, \--dpkg-gencontrol-params=params +.TP +.B \-\- params Pass "params" to .BR dpkg-gencontrol (1) .SH ENVIRONMENT diff --git a/dh_installchangelogs b/dh_installchangelogs index 187e134c..5325f7b1 100755 --- a/dh_installchangelogs +++ b/dh_installchangelogs @@ -43,21 +43,23 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { "$TMP/usr/share/doc/$PACKAGE/$changelog_name"); if ($upstream) { + my $link_to; if ($upstream=~m/\.html?$/i) { # HTML changelog doit("install","-o","root","-g","root","-p","-m644", $upstream,"$TMP/usr/share/doc/$PACKAGE/changelog.html"); - doit("ln", "-sf", 'changelog.html', - "$TMP/usr/share/doc/$PACKAGE/changelog"); + complex_doit("lynx -dump $upstream > $TMP/usr/share/doc/$PACKAGE/changelog"); + $link_to='changelog.html'; } else { doit("install","-o","root","-g","root","-p","-m644", $upstream,"$TMP/usr/share/doc/$PACKAGE/changelog"); + $link_to='changelog'; } if ($dh{K_FLAG}) { # Install symlink to original name of the upstream changelog file. # Use basename in case original file was in a subdirectory or something. - doit("ln","-sf","changelog","$TMP/usr/share/doc/$PACKAGE/".Dh_Lib::basename($upstream)); + doit("ln","-sf",$link_to,"$TMP/usr/share/doc/$PACKAGE/".Dh_Lib::basename($upstream)); } } } diff --git a/dh_installinit.1 b/dh_installinit.1 index 6a0e4758..0b384126 100644 --- a/dh_installinit.1 +++ b/dh_installinit.1 @@ -3,7 +3,7 @@ dh_installinit \- install init scripts into package build directories .SH SYNOPSIS .B dh_installinit -.I "[debhelper options] [--init-script=scriptname] [-n] [-r] [-d] [-uparams]" +.I "[debhelper options] [--init-script=scriptname] [-n] [-r] [-d] [-uparams] -- [params]" .SH "DESCRIPTION" dh_installinit is a debhelper program that is responsible for installing init scripts into package build directories. @@ -37,6 +37,8 @@ for daemons with names ending in "d". (Note: this takes precedence over the --init-script parameter described below.) .TP .B \-uparams, \--update-rcd-params=params +.TP +.B \-\- params Pass "params" to .BR update-rc.d (8) If not specified, "defaults" will be passed to diff --git a/dh_shlibdeps.1 b/dh_shlibdeps.1 index 5e01d086..20427969 100644 --- a/dh_shlibdeps.1 +++ b/dh_shlibdeps.1 @@ -3,7 +3,7 @@ dh_shlibdeps \- calculate shared library dependancies .SH SYNOPSIS .B dh_shlibdeps -.I "[debhelper options] [-uparams] [-ldirectory]" +.I "[debhelper options] [-ldirectory] [-uparams] [-- params]" .SH "DESCRIPTION" dh_shlibdeps is a debhelper program that is responsible for calculating shared library dependancies for all executables found in the package build @@ -20,6 +20,8 @@ See for a list of options common to all debhelper commands. .TP .B \-uparams, \--dpkg-shlibdeps-params=params +.TP +.B \-\- params Pass "params" to .BR dpkg-shlibdeps (1) .TP diff --git a/dh_suidregister b/dh_suidregister index 4ca72a1c..b7b3152f 100755 --- a/dh_suidregister +++ b/dh_suidregister @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/usr/bin/perl -w # # If no parameters are given, and no debian/suid files exists, scan for # suid/sgid files and suidregister them. @@ -6,53 +6,71 @@ # If there are parameters, or there is a debian/suid, register the files # listed there. -PATH=debian:$PATH:/usr/lib/debhelper -. dh_lib +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib; +init(); -for PACKAGE in $DH_DOPACKAGES; do - TMP=`tmpdir $PACKAGE` - EXT=`pkgext $PACKAGE` +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $suid=pkgfile($PACKAGE,"suid"); - files="" + @files=(); + if ($suid) { + @files=filearray($suid); + } - if [ -e debian/${EXT}suid ]; then - files=`tr "\n" " " < debian/${EXT}suid` - fi + if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { + push @files, @ARGV; + } - if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then - files="$* $files" - fi - - if [ ! "$files" -a ! -e debian/${EXT}suid ]; then + if (! @files && ! $suid) { # No files specified (and no empty debian/suid file), so # guess what files to process. - files=`find debian/$TMP -type f -perm +6000` + @files=split(/\n/,`find $TMP -type f -perm +6000`); # We will strip the debian working directory off of the # filenames. - tostrip="debian/$TMP/" - else + $tostrip="$TMP/"; + } + else { # We will strip leading /'s, so the user can feed this # program either absolute filenames, or relative filenames, # and it will do the right thing either way. - tostrip="/" - fi - - if [ "$files" ]; then - for file in $files; do - # Strip leading $tostrip from $file. If not there, - # leave $file untouched. - if [ `expr "$file" : "$tostrip\\(.*\\)"` ]; then - file=`expr "$file" : "$tostrip\\(.*\\)"` - fi - - # Create the sed string that will be used to - # fill in the blanks in the autoscript files. - # Fill with the owner, group, and perms of the file. - sedstr=`find debian/$TMP/$file -printf "s:#FILE#:$file:;s/#PACKAGE#/$PACKAGE/;s/#OWNER#/%u/;s/#GROUP#/%g/;s/#PERMS#/%m/"` - - autoscript "postinst" "postinst-suid" "$sedstr" - autoscript "postrm" "postrm-suid" "$sedstr" - done - fi -done + $tostrip="/"; + } + + foreach $file (@files) { + # Strip leading $tostrip from $file. + $file=~s/^$tostrip//; + + if (! -e "$TMP/$file") { + error("\"$TMP/$file\" does not exist."); + } + + # Create the sed string that will be used to + # fill in the blanks in the autoscript files. + # Fill with the owner, group, and perms of the file. + (undef,undef,$mode,undef,$uid,$gid,undef) = stat("$TMP/$file"); + # Now come up with the user and group names for the uid and gid. + $user=getpwuid($uid); + if (! defined $user) { + warning("$file has odd uid $uid, not in /etc/passwd"); + $user=$uid; + } + $group=getgrgid($gid); + if (! defined $group) { + warning("$file has odd gid $gid not in /etc/group"); + $group=$gid; + } + # Note that I have to print mode in ocal, stripping file type. + $sedstr=sprintf("s:#FILE#:$file:;s/#PACKAGE#/$PACKAGE/;s/#OWNER#/$user/;s/#GROUP#/$group/;s/#PERMS#/%#o/", + $mode & 07777); + + autoscript($PACKAGE,"postinst","postinst-suid",$sedstr); + autoscript($PACKAGE,"postrm","postrm-suid","$sedstr"); + + if ( -e "$TMP/$file") { + doit("chmod","a-s","$TMP/$file"); + } + } +} diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING index 98b4cd29..bf73cc57 100644 --- a/doc/PROGRAMMING +++ b/doc/PROGRAMMING @@ -34,6 +34,8 @@ The autoscript() function (see below) is one easy way to do this. dh_installdeb is an exception, it will run after the other commands and merge these modifications into the actual postinst scripts. +Debhelper programs should default to doing exactly what policy says to do. + There are always exceptions. Just ask me. Introducing Dh_Lib.pm: |