]> git.donarmstrong.com Git - debhelper.git/commitdiff
r338: * Patch from Jorgen `forcer' Schaefer <forcer at mindless.com> (much
authorjoey <joey>
Thu, 2 Mar 2000 21:23:22 +0000 (21:23 +0000)
committerjoey <joey>
Thu, 2 Mar 2000 21:23:22 +0000 (21:23 +0000)
     modified)to make dh_installwm use new window manager registration method,
     update-alternatives. Closes: #52156, #34684 (latter bug is obsolete)
   * Fixed $dh{flavor} to be upper-case.
   * Deprecated dh_installemavcsen --number; use --priority instead. Also,
     the option parser requires the parameter be a number now. And,
     dh_installwm now accepts --priority, and window manager packages should
     start using it.
   * dh_installwm now behaves like a proper debhelper command, and reads
     debian/<package>.wm too. This is a small behavior change; filenames
     specified on the command line no longer apply to all packages it acts
     on. I can't belive this program existed for 2 years with such a glaring
     problem; I guess most people don't need ot register 5 wm's in 3
     sub-packages. Anyway, it can handle such things now. :-)
   * Moved Dh_*.pm to /usr/lib/perl5/Debian/Debhelper. *big* change.

49 files changed:
autoscripts/postinst-wm
autoscripts/postrm-wm
debian/changelog
debian/fixlinks
debian/rules
dh_builddeb
dh_clean
dh_compress
dh_debstd
dh_du
dh_fixperms
dh_gencontrol
dh_installchangelogs
dh_installcron
dh_installdeb
dh_installdebconf
dh_installdirs
dh_installdocs
dh_installemacsen
dh_installemacsen.1
dh_installexamples
dh_installinfo
dh_installinit
dh_installmanpages
dh_installmenu
dh_installmime
dh_installmodules
dh_installpam
dh_installwm
dh_installwm.1
dh_installxaw
dh_installxfonts
dh_link
dh_listpackages
dh_makeshlibs
dh_md5sums
dh_movefiles
dh_perl
dh_shlibdeps
dh_strip
dh_suidregister
dh_testdir
dh_testroot
dh_testversion
dh_undocumented
doc/PROGRAMMING
doc/README
doc/TODO
doc/v2

index 94c052fc87d966c2b73f41e3da4f59b726615503..794ad7004502bb5e76f095ae82a11f654f26b110 100644 (file)
@@ -1,3 +1,2 @@
-if [ -x /usr/sbin/register-window-manager ] ; then
-       register-window-manager --add #WM#
-fi
+update-alternatives --install /usr/bin/x-window-manager \
+       x-window-manager #WM# #PRIORITY#
index 6dc9f5da434a542cb716fe55ed4970bfdb3c88b8..c4670b9ffd1806bf13ec32bca42cc5d0806fe035 100644 (file)
@@ -1,3 +1,2 @@
-if [ "$1" == "purge" -a -x /usr/sbin/register-window-manager ] ; then
-       register-window-manager --remove #WM#
-fi
+update-alternatives --remove x-window-manager #WM#
+
index 9808971821d0361cbbb29db21534bb8aba8b3f9d..fc64c040b232d412217a4722ae470b9a802b2979 100644 (file)
@@ -1,3 +1,23 @@
+debhelper (2.0.89) unstable; urgency=low
+
+  * Patch from Jorgen `forcer' Schaefer <forcer at mindless.com> (much
+    modified)to make dh_installwm use new window manager registration method,
+    update-alternatives. Closes: #52156, #34684 (latter bug is obsolete)
+  * Fixed $dh{flavor} to be upper-case.
+  * Deprecated dh_installemavcsen --number; use --priority instead. Also,
+    the option parser requires the parameter be a number now. And,
+    dh_installwm now accepts --priority, and window manager packages should
+    start using it.
+  * dh_installwm now behaves like a proper debhelper command, and reads
+    debian/<package>.wm too. This is a small behavior change; filenames
+    specified on the command line no longer apply to all packages it acts
+    on. I can't belive this program existed for 2 years with such a glaring
+    problem; I guess most people don't need ot register 5 wm's in 3
+    sub-packages. Anyway, it can handle such things now. :-)
+  * Moved Dh_*.pm to /usr/lib/perl5/Debian/Debhelper. *big* change.
+
+ -- Joey Hess <joeyh@debian.org>  Thu,  2 Mar 2000 11:39:56 -0800
+
 debhelper (2.0.88) unstable; urgency=low
 
   * Copyright update: files in the examples directory are public domain.
@@ -1328,7 +1348,7 @@ debhelper (1.2.0) unstable; urgency=low
     perl.. Since 1.1 has actually stabalized, I've upped this to 1.2.
   * dh_md5sums: rewritten in perl, for large speed gain under some
     circumstances (old version called perl sometimes, once per package.)
-  * dh_installmenu, dh_installwmacsen, dh_installwm: perlized.
+  * dh_installmenu, dh_installemacsen, dh_installwm: perlized.
   * Dh_Lib.pm: made autoscript() really work.
 
  -- Joey Hess <joeyh@debian.org>  Mon,  9 Nov 1998 13:04:16 -0800
index f90bf4d953db492d63e3ebef766372368d766605..23d4306a2a3165b2f59fb807f87a856f347c73ca 100644 (file)
@@ -1,8 +1,6 @@
 #!/bin/sh -e
 # Clean up after cvs's dreadful symlink handling, by making all the symlinks
 # this package needs.
-ln -sf ../Dh_Lib.pm debian/Dh_Lib.pm
-ln -sf ../Dh_Getopt.pm debian/Dh_Getopt.pm
 ln -sf postinst-menu autoscripts/postrm-menu
 ln -sf postinst-modules autoscripts/postrm-modules
 ln -sf postinst-mime autoscripts/postrm-mime
index ccc0a36317d754a35f007cb4a204d426ec135911..da3305e5b7677762b62b1d6f49a294c25db05c49 100755 (executable)
@@ -1,11 +1,10 @@
 #!/usr/bin/make -f
 # Note that I have to refer to debhelper programs with ./, to make sure
-# I run the most current ones. That's also why there is a symlink to the 
-# current Dh_lib.pm and the current Dh_getopt.pm in this debian/ directory.
+# I run the most current ones.
 #
 # This is _not_ a good example of a debhelper rules file, but I didn't need
-# to tell you that; just see the 25 lines of inlined perl below.. See
-# examples/ for some good examples.
+# to tell you that; just see the 25 lines of inlined perl below.. 
+# See examples/ for some good examples.
 
 # If any automatic script generation is done in building this package, 
 # be sure to use the new templates from this package.
@@ -41,12 +40,15 @@ binary-indep: link-stamp build
        ./dh_testdir
        ./dh_testroot
        ./dh_clean -k
-       ./dh_installdirs usr/bin usr/share/debhelper
+       ./dh_installdirs usr/bin usr/share/debhelper \
+               usr/lib/perl5/Debian/Debhelper
 
-       echo -e "package Dh_Version;\n\$$version='$(VERSION)';" > debian/debhelper/usr/share/debhelper/Dh_Version.pm
+       echo -e "package Dh_Version;\n\$$version='$(VERSION)';" > \
+               debian/debhelper/usr/lib/perl5/Debian/Debhelper/Dh_Version.pm
        find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
                -exec install -p {} debian/debhelper/usr/bin \;
-       cp -a Dh_*.pm debian/debhelper/usr/share/debhelper
+       cp -a Debian/Debhelper/*.pm \
+               debian/debhelper/usr/lib/perl5/Debian/Debhelper/
        cp -a autoscripts debian/debhelper/usr/share/debhelper
        rm -rf debian/debhelper/usr/share/debhelper/autoscripts/CVS
 
@@ -111,3 +113,4 @@ installhook:
 
 binary: binary-indep binary-arch
 .PHONY: build clean binary-indep binary-arch binary dist
+
index 0822f5077a0be56657692c997fd9ba84c137af3c..1082dd29e9200f33f7ee8a3d226e0820cdc6fccf 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Build the .deb package, assuming all the files are set up.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 # Set the default destination directory.
index da2c4b2279f5607c8df9e6d1b01e1f398b39a9ce..1f73bea732aedb8f7c381d0e042ee9f1d40bfccc 100755 (executable)
--- a/dh_clean
+++ b/dh_clean
@@ -1,16 +1,47 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
-# Clean up debian/tmp and other teporary files generated by the 
+# Clean up $TMP and other tepmorary files generated by the
 # build process.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-doit "rm -rf debian/tmp"
-doit "rm -f debian/substvars debian/*.substvars debian/files*"
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $EXT=pkgext($PACKAGE);
+
+       if (! $dh{D_FLAG}) {
+               doit("rm","-f","debian/$EXT\substvars",
+                       "debian/$EXT\postinst.debhelper",
+                       "debian/$EXT\postrm.debhelper",
+                       "debian/$EXT\preinst.debhelper",
+                       "debian/$EXT\prerm.debhelper");
+       }
+       
+       doit ("rm","-rf",$TMP);
+}
+
+if (! $dh{D_FLAG}) {
+       if (@ARGV) {
+               doit("rm","-f","--",@ARGV);
+       }
+
+       if (! $dh{K_FLAG}) {
+               doit("rm","-f","debian/files");
+       }
+
+       # Remove other temp files.
+       # (The \s+ is important, \s won't work because find would get null
+       # parameters). Note that you _don't_ quote wildcards used by find
+       # in here.
+       doit(split(/\s+/,"find . -type f -a
+               ( -name #*# -o -name *~ -o -name DEADJOE
+                -o -name *.orig -o -name *.rej -o -name *.bak
+                -o -name .*.orig -o -name .*.rej -o -name .SUMS
+                -o -name TAGS -o -name core -o ( -path */.deps/* -a -name *.P )
+               ) -exec rm -f {} ;"));
+}
+
+doit('rm', '-rf', 'debian/tmp')
+       if -x 'debian/tmp' && ! Debian::Debhelper::Dh_Lib::compat(1);
 
-# Remove other temp files. I don't run this through doit becuase
-# I haven't figured out what I have to esacape to put it in quotes.
-# However, it doesn't modify debian/tmp, so I guess it's ok to not run it 
-# through doit.
-find . \( -name "\#*\#" -o -name "*~" -o -name "DEADJOE" \) -exec rm -f {} \;
index e3c6e0b2c5fcf247a9d8862a3a233d8aca102762..015a1abb9e8d32c74374e22efe99293832e4d0d8 100755 (executable)
@@ -4,8 +4,7 @@
 # compressed files get fixed.
 
 use Cwd;
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 12e99ffd7b9b7798e3fc0edadfc21a1a106d8d3a..5577150b10f48e8cb4b4f628e455ea2f0e196cb0 100755 (executable)
--- a/dh_debstd
+++ b/dh_debstd
 # This has been gutted and extensively rewritten to function as a debhelper
 # command by Joey Hess. And then completly rewritten in perl.
 
+use Debian::Debhelper::Dh_Lib;
+
 # Need to stay compatable with debstd, so force use of level 1.
 $ENV{DH_COMAPT}=1;
 
-# Pre-parse command line before we load Dh_lib, becuase we use a
+# Pre-parse command line before we parse the command line, becuase we use a
 # different style of arguments.
 @argv=();
 foreach (@ARGV) {
@@ -37,9 +39,6 @@ foreach (@ARGV) {
        }
 }
 @ARGV=@argv;
-
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
 init();
 
 # Tolerate old style debstd invocations
diff --git a/dh_du b/dh_du
index a7ec6f489bd1b55d03213bcb97da9dfbb9c5b4e8..d786e49788af13af8e18dcf75942dea56e181d4b 100755 (executable)
--- a/dh_du
+++ b/dh_du
@@ -1,19 +1,10 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Generate a DEBIAN/du file, that lists the disk usage of the directories in 
 # the package.
+#
+# No longer - it was decided these files are a bad idea.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
-
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-
-       if [ ! -d "debian/$TMP/DEBIAN" ]; then
-               doit "install -d debian/$TMP/DEBIAN"
-       fi
+use Debian::Debhelper::Dh_Lib;
 
-       verbose_echo "du -k debian/$TMP | sed \"s:      debian/$TMP/:   :\" | grep -v \"        DEBIAN$\" | grep -v \"  debian/$TMP$\" > debian/$TMP/DEBIAN/du"
-       du -k debian/$TMP | sed "s:     debian/$TMP/:   :" | grep -v "  DEBIAN$" | grep -v "    debian/$TMP$" >debian/$TMP/DEBIAN/du
-       doit "chown root.root debian/tmp/DEBIAN/du"
-done
+warning("this program does nothing and is deprecated. Remove it from debian/rules.");
index 98201e94423cc1ac22d36483fe2a47c23a7d141c..191f3d0824646ef1ab9163bd885f2e0f2a20db46 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Do some general file permission fixups.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index e2a4e701b223cb689d050ba8ae7605a38794d636..df53a753e3d86d9a810f741d8c68da61d8b53cd5 100755 (executable)
@@ -1,19 +1,30 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Generate and install the control file. Simple dpkg-gencontrol wrapper.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-       EXT=`pkgext $PACKAGE`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $EXT=pkgext($PACKAGE);
+       
+       $changelog=pkgfile($PACKAGE,'changelog');
+       if (! $changelog) {
+               $changelog='debian/changelog';
+       }
 
-       if [ ! -d $TMP/DEBIAN ]; then
-               doit "install -o root -g root -d $TMP/DEBIAN"
-       fi
+       if ( ! -d '$TMP/DEBIAN' ) {
+               doit("install","-o","root","-g","root","-d","$TMP/DEBIAN");
+       }
 
        # Generate and install control file.
-       doit "dpkg-gencontrol -p$PACKAGE -Tdebian/${EXT}substvars -P$TMP $DH_U_PARAMS"
-       doit "chown root.root $TMP/DEBIAN/control"
-done
+       doit("dpkg-gencontrol","-l$changelog","-isp","-p$PACKAGE",
+               "-Tdebian/$EXT\substvars","-P$TMP",@{$dh{U_PARAMS}});
+
+       # This chmod is only necessary if the user sets the umask to something odd.
+       doit("chmod","644","$TMP/DEBIAN/control");
+       
+       doit("chown","root.root","$TMP/DEBIAN/control");
+}
+
index 5325f7b11e647cb7818b223dcca965f668bd4ca7..e653019132f04529af017c77eae306953e431275 100755 (executable)
@@ -7,8 +7,7 @@
 # if so, the debian changelog is just installed as "changelog", and it is an 
 # error to specify an upstream changelog on the command line.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 $upstream=shift;
@@ -59,7 +58,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
                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",$link_to,"$TMP/usr/share/doc/$PACKAGE/".Dh_Lib::basename($upstream));
+                       doit("ln","-sf",$link_to,"$TMP/usr/share/doc/$PACKAGE/".Debian::Debhelper::Dh_Lib::basename($upstream));
                }
        }
 }
index 7db8cdc6a5d8d34a46452b5b1610e7b41f7b5c90..149c3d91bbe8f020f4f35deb79437286c00833f5 100755 (executable)
@@ -1,20 +1,27 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Install cron scripts into the appropriate places.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-       EXT=`pkgext $PACKAGE`
-
-       for type in daily weekly monthly; do
-               if [ -e debian/${EXT}cron.$type ]; then
-                       if [ ! -d debian/$TMP/etc/cron.$type ]; then
-                               doit "install -o root -g root -d debian/$TMP/etc/cron.$type"
-                       fi
-                       doit "install debian/${EXT}cron.$type debian/$TMP/etc/cron.$type/$PACKAGE"
-               fi
-       done
-done
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       foreach $type (qw{daily weekly monthly}) {
+               $cron=pkgfile($PACKAGE,"cron.$type");
+               if ($cron) {
+                       if (! -d "$TMP/etc/cron.$type") {
+                               doit("install","-o","root","-g","root","-d","$TMP/etc/cron.$type");
+                       }
+                       doit("install",$cron,"$TMP/etc/cron.$type/$PACKAGE");
+               }
+       }
+       # Seperate because this needs to be mode 644.
+       $cron=pkgfile($PACKAGE,"cron.d");
+       if ($cron) {
+               if (! -d "$TMP/etc/cron.d") {
+                       doit("install","-o","root","-g","root","-d","$TMP/etc/cron.d");
+               }       
+               doit("install","-m",644,$cron,"$TMP/etc/cron.d/$PACKAGE");
+       }
+}
index d3eebe762e4cc3c64e3b3b65bb0f829275a291cf..e0ec36c78221f7c8637d39f3ed663c16dc3e3b6f 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Install files from debian/ into the package's DEBIAN directory.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 489db99a49a34f4646c3a62a73afbcc677b62f13..03ac235775669b5566c21e3db8deae0d6b216f63 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Integration with debconf.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index bab883d779819f5cc1444235c30f436dfeec0504..1ecf907e1d057365385bdf1417e7b7b1a4c02dc5 100755 (executable)
@@ -1,39 +1,41 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
-# Reads debian/dirs, creates the directories listed there there
+# Reads debian/dirs, creates the directories listed there
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-       EXT=`pkgext $PACKAGE`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $file=pkgfile($PACKAGE,"dirs");
 
-       if [ ! -d $TMP/usr/doc/$PACKAGE ]; then
-               doit "install -d $TMP/usr/doc/$PACKAGE"
-       fi
+       if (! -e $TMP) {
+               doit("install","-d",$TMP);
+       }
 
-       dirs=""
+       undef @dirs;
 
-       if [ -e debian/${EXT}dirs ]; then
-               dirs=`tr "\n" " " < debian/${EXT}dirs`
-       fi
+       if ($file) {
+               @dirs=filearray($file)
+       }
 
-       if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
-               dirs="$* $dirs"
-       fi
+       if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+               push @dirs, @ARGV;
+       }       
+
+       if (@dirs) {
+               # Stick the $TMP onto the front of all the dirs.
+               # This is necessary, for 2 reasons, one to make them 
+               # be in the right directory, but more importantly, it 
+               # protects against the danger of absolute dirs being
+               # specified.
+               @dirs=map {
+                               $_="$TMP/$_";
+                               tr:/:/:s; # just beautification.
+                               $_
+                         } @dirs;
 
-       if [ "$dirs" ]; then
-               # Check to see if any of the dirs are absolute.
-               for dir in "$dirs" ; do
-                       if expr "$dir" : "/" >/dev/null ; then
-                               error "Absolute directory name \"$dir\" specified."
-                       fi
-               done
                # Create dirs.
-               verbose_echo "cd $TMP && install -d $dirs && cd ../.."
-               cd $TMP
-               install -d $dirs
-               cd ../..
-       fi
-done
+               doit("install","-d",@dirs);
+       }
+}
index 86b6f200faebf50e08306711feb2397720f0c254..ad50423c4ac7677b9ac93aee42c31c060fa39efd 100755 (executable)
@@ -5,8 +5,7 @@
 # Also installs the debian/copyright and debian/README.debian and debian/TODO
 # and handles debian/doc-base.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index e87cecef687151d8959fe318b84e7bd1997547d8..8d8982c3fd60530f49d4f410cffb3a80159c0459 100755 (executable)
@@ -1,34 +1,51 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Registration with emacsen-common.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
+if (! defined $dh{PRIORITY}) {
+       $dh{PRIORITY}=50;
+}
+if (! defined $dh{FLAVOR}) {
+       $dh{FLAVOR}='emacs';
+}
 
-       emacsen_install=`pkgfile $PACKAGE emacsen-install`
-       emacsen_remove=`pkgfile $PACKAGE emacsen-remove`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
 
-       if [ "$emacsen_install" ]; then
-               if [ ! -d "$TMP/usr/lib/emacsen-common/packages/install" ]; then
-                       doit "install -d $TMP/usr/lib/emacsen-common/packages/install"
-               fi
-               doit "install $emacsen_install $TMP/usr/lib/emacsen-common/packages/install/$PACKAGE"
-       fi
+       $emacsen_install=pkgfile($PACKAGE,"emacsen-install");
+       $emacsen_remove=pkgfile($PACKAGE,"emacsen-remove");
+       $emacsen_startup=pkgfile($PACKAGE,"emacsen-startup");
 
-       if [ "$emacsen_remove" ]; then
-               if [ ! -d "$TMP/usr/lib/emacsen-common/packages/remove" ]; then
-                       doit "install -d $TMP/usr/lib/emacsen-common/packages/remove"
-               fi
-               doit "install $emacsen_remove $TMP/usr/lib/emacsen-common/packages/remove/$PACKAGE"
-       fi
+       if ($emacsen_install ne '') {
+               if (! -d "$TMP/usr/lib/emacsen-common/packages/install") {
+                       doit("install","-d","$TMP/usr/lib/emacsen-common/packages/install");
+               }
+               doit("install","-m0755",$emacsen_install,"$TMP/usr/lib/emacsen-common/packages/install/$PACKAGE");
+       }
 
-       if [ "$emacsen_install" -o "$emacsen_remove" ]; then
-               if [ ! "$DH_NOSCRIPTS" ]; then
-                       autoscript "postinst" "postinst-emacsen"
-                       autoscript "prerm" "prerm-emacsen"
-               fi
-       fi      
-done
+       if ($emacsen_remove ne '') {
+               if (! -d "$TMP/usr/lib/emacsen-common/packages/remove") {
+                       doit("install","-d","$TMP/usr/lib/emacsen-common/packages/remove");
+               }
+               doit("install","-m0755","$emacsen_remove","$TMP/usr/lib/emacsen-common/packages/remove/$PACKAGE");
+       }
+       
+       if ($emacsen_startup ne '') {
+               if (! -d "$TMP/etc/$dh{FLAVOR}/site-start.d/") {
+                       doit("install","-d","$TMP/etc/$dh{FLAVOR}/site-start.d/");
+               }
+               doit("install","-m0644",$emacsen_startup,"$TMP/etc/$dh{FLAVOR}/site-start.d/$dh{PRIORITY}$PACKAGE.el");
+       }
+
+       if ($emacsen_install ne '' || $emacsen_remove ne '') {
+               if (! $dh{NOSCRIPTS}) {
+                       autoscript($PACKAGE,"postinst","postinst-emacsen",
+                               "s/#PACKAGE#/$PACKAGE/");
+                       autoscript($PACKAGE,"prerm","prerm-emacsen",
+                               "s/#PACKAGE#/$PACKAGE/");
+               }
+       }
+}      
index d52cff264cb0e3b0a46f0c74a6ec7ead7395ccdb..7615ad6cbb8de2357d471dd4c95228ca7b5e4f6f 100644 (file)
@@ -3,7 +3,7 @@
 dh_installemacsen \- register an emacs add on package
 .SH SYNOPSIS
 .B dh_installemacsen
-.I "[debhelper options] [-n] [--number=n] [--flavor=foo]"
+.I "[debhelper options] [-n] [--priority=n] [--flavor=foo]"
 .SH "DESCRIPTION"
 dh_installemacsen is a debhelper program that is responsible for installing
 files used by the debian emacsen-common package into package build directories. 
@@ -32,7 +32,7 @@ for a list of options common to all debhelper commands.
 .B \-n, \--noscripts
 Do not modify postinst/prerm scripts.
 .TP
-.B \--number=n
+.B \--priority=n
 Sets the priority number of a site-start.d file. Default is 50.
 .TP
 .B \--flavor=foo
index 033564ef2fe5e0f98dbc0daf4cdb05d3064c43f7..bf0bbe4ac6d3d88cf13f19e1f0c46efca5c865d4 100755 (executable)
@@ -3,8 +3,7 @@
 # Reads debian/examples, installs all files listed there into
 # /usr/share/doc/$PACKAGE/examples
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index fe03433b7c85bbf6e9eda9e3bb152010766dcacb..3e64209580bb159bf2c76a6ad2f010a828c81c3e 100755 (executable)
@@ -3,8 +3,7 @@
 # Reads debian/info, installs all files listed there into /usr/share/info
 # and puts appropriate commands into the postinst.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
@@ -45,7 +44,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
                        }
                        close IN;
                        
-                       my $fn="/usr/share/info/".Dh_Lib::basename($file);
+                       my $fn="/usr/share/info/".Debian::Debhelper::Dh_Lib::basename($file);
                        
                        if ($section ne '') {
                                $section=~s:/:\\/:g; # allow / in section.
index 2ea3440f3d680961134155777e9131a07162c4de..7836a9e21b6ef38dbc742e8956d339d80886d21a 100755 (executable)
@@ -1,58 +1,73 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Install debian/init[.d], and set up the postinst and postrm for init
 # scripts.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
-
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
-       EXT=`pkgext $PACKAGE`
-
-       if [ -e debian/${EXT}init ]; then
-               if [ ! -d $TMP/etc/init.d ]; then
-                       doit "install -d $TMP/etc/init.d"
-               fi
-
-               # Figure out what filename to install it as.
-               if [ "$DH_D_FLAG" ]; then
-                       # -d on the command line sets DH_D_FLAG. We will 
-                       # remove a trailing 'd' from the package name and 
-                       # use that as the name.
-                       script=`expr $PACKAGE : '\(.*\)d$'` || true
-                       if [ ! "$script" ]; then
-                               echo `basename $0`" warning: \"$PACKAGE\" has no final -d, but -d was specified."
-                               script=$PACKAGE
-                       fi
-               else
-                       script=$PACKAGE
-               fi
-               doit "install -p -m755 debian/${EXT}init $TMP/etc/init.d/$script"
+use Debian::Debhelper::Dh_Lib;
+init();
+
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+
+       # Figure out what filename to install it as.
+       my $script;
+       if ($dh{D_FLAG}) {
+               # -d on the command line sets D_FLAG. We will 
+               # remove a trailing 'd' from the package name and 
+               # use that as the name.
+               $script=$PACKAGE;
+               if ($script=~m/(.*)d$/) {
+                       $script=$1;
+               }
+               else {
+                       warning("\"$PACKAGE\" has no final d' in its name, but -d was specified.");
+               }
+       }       
+       elsif ($dh{INIT_SCRIPT}) {
+               $script=$dh{INIT_SCRIPT};
+       }
+       else {
+               $script=$PACKAGE;
+       }       
+
+       $init=pkgfile($PACKAGE,$script) || pkgfile($PACKAGE,"init") ||
+             pkgfile($PACKAGE,"init.d");
+
+       if ($init ne '') {
+               if (! -d "$TMP/etc/init.d") {
+                       doit("install","-d","$TMP/etc/init.d");
+               }
+
+               doit("install","-p","-m755",$init,"$TMP/etc/init.d/$script");
 
                # This is set by the -u "foo" command line switch, it's
-               # the parameters to pass to update-rc.d. If not set, 
+               # the parameters to pass to update-rc.d. If not set,
                # we have to say "defaults".
-               if [ "$DH_U_PARAMS" = "" ]; then
-                       DH_U_PARAMS="defaults"
-               fi
-
-               # -r on the command line sets DH_R_FLAG. If it's set, there
-               # is no restart on upgrade.
-               if [ ! "$DH_NOSCRIPTS" ]; then
-                       if [ "$DH_R_FLAG" ]; then
-                               autoscript "postinst" "postinst-init-norestart" \
-                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
-                               autoscript "postrm" "postrm-init" \
-                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
-                       else
-                               autoscript "postinst" "postinst-init" \
-                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
-                               autoscript "postrm" "postrm-init" \
-                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
-                               autoscript "prerm" "prerm-init" \
-                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/"
-                       fi
-               fi
-       fi
-done
+               my $params='';
+               if (defined($dh{U_PARAMS})) {
+                       $params=join(' ',@{$dh{U_PARAMS}});
+               }       
+               if ($params eq '') {
+                       $params="defaults";
+               }
+
+               if (! $dh{NOSCRIPTS}) {
+                       # -r on the command line sets R_FLAG. If it's set, there
+                       # is no restart on upgrade.
+                       if ($dh{R_FLAG}) {
+                               autoscript($PACKAGE,"postinst","postinst-init-norestart",
+                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
+                               autoscript($PACKAGE,"postrm","postrm-init",
+                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
+                       }
+                       else {
+                               autoscript($PACKAGE,"postinst","postinst-init",
+                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
+                               autoscript($PACKAGE,"postrm","postrm-init",
+                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
+                               autoscript($PACKAGE,"prerm","prerm-init",
+                                       "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/");
+                       }
+               }
+       }
+}
index 82681f332437081aaf866a625ed6dd70b9376d37..448f0891169570e058d239cf30b964d371bf4daa 100755 (executable)
@@ -7,8 +7,7 @@
 # This is a little bit (hah!) DWIMish, but still very handy.
 
 use File::Find;
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 # Check if a file is a man page, for use by File::Find.
@@ -60,8 +59,8 @@ 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 (Debian::Debhelper::Dh_Lib::basename($File::Find::dir) eq Debian::Devhelper::Dh_Lib::dirname($solink)) {
+                       $solink=Debian::Debhelper::Dh_Lib::basename($solink);
                }
                else {
                        $solink="../$solink";
@@ -83,14 +82,14 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        foreach $page (@manpages) {
                $page=~s:^\./::; # just for looks
                
-               $basename=Dh_Lib::basename($page);
+               $basename=Debian::Debhelper::Dh_Lib::basename($page);
                
                # Skip all files listed on command line.
                my $install=1;
                foreach $skip (@ARGV) {
                        # Look at basename of what's on connect line
                        # for backwards compatability.
-                       if ($basename eq Dh_Lib::basename($skip)) {
+                       if ($basename eq Debian::Debhelper::Dh_Lib::basename($skip)) {
                                $install=undef;
                                last;
                        }
index 26798c29c006f78a905e041d592718866514683e..d6050febcfb6edf7f83d796aca9c2143a8288a29 100755 (executable)
@@ -1,24 +1,44 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Integration with debian menu system:
 #
-# If debian/menu file exists, save it to debian/tmp/usr/lib/menu/$PACKAGE
+# If debian/menu file exists, save it to $TMP/usr/lib/menu/$PACKAGE
 # If debian/menu-method file exists, save it to 
-# debian/tmp/etc/menu-methods/$PACKAGE
+# $TMP/etc/menu-methods/$PACKAGE
+#
+# Also, add to postinst and postrm.
+
+use Debian::Debhelper::Dh_Lib;
+init();
 
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $menu=pkgfile($PACKAGE,"menu");
+       $menu_method=pkgfile($PACKAGE,"menu-method");
+       
+       if ($menu ne '') {
+               if (! -d "$TMP/usr/lib/menu") {
+                       doit("install","-d","$TMP/usr/lib/menu");
+               }
+               doit("install","-p","-m644",$menu,"$TMP/usr/lib/menu/$PACKAGE");
+               
+               # Add the scripts if a menu-method file doesn't exist.
+               # The scripts for menu-method handle everything these do, too.
+               if ($menu_method eq "" && ! $dh{NOSCRIPTS}) {
+                       autoscript($PACKAGE,"postinst","postinst-menu");
+                       autoscript($PACKAGE,"postrm","postrm-menu")
+               }
+       }
 
-if [ -e debian/menu ]; then
-       if [ ! -d debian/tmp/usr/lib/menu ]; then
-               doit "install -d debian/tmp/usr/lib/menu"
-       fi
-       doit "install -p -m644 debian/menu debian/tmp/usr/lib/menu/$PACKAGE"
-fi
+       if ($menu_method ne '') {
+               if (!-d "$TMP/etc/menu-methods") {
+                       doit("install","-d","$TMP/etc/menu-methods");
+               }
+               doit("install","-p",$menu_method,"$TMP/etc/menu-methods/$PACKAGE");
 
-if [ -e debian/menu-method ]; then
-       if [ ! -d debian/tmp/etc/menu-methods ]; then
-               doit "install -d debian/tmp/etc/menu-methods"
-       fi
-       doit "install -p debian/menu-method debian/tmp/etc/menu-methods/$PACKAGE"
-fi
+               if (! $dh{NOSCRIPTS}) {
+                       autoscript($PACKAGE,"postinst","postinst-menu-method","s/#PACKAGE#/$PACKAGE/");
+                       autoscript($PACKAGE,"postrm","postrm-menu-method","s/#PACKAGE#/$PACKAGE/");
+               }
+       }
+}
index 232ddc19e1fe99de96223b35f247bd9e24e06f35..0dbc08b41923d44a30b1cf06d465f1102d8e599c 100755 (executable)
@@ -1,7 +1,8 @@
 #!/usr/bin/perl -w
+#
+# Mime support.
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 264ae9c0afdfa29322f9a88288e1bcfceab5fe8c..a80163068a083e4007563f53786583fcd643e2f5 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Register modules with modutils.
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
@@ -17,7 +16,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        if ($file) {
                if (! -e "$TMP/etc/modutils") {
                        doit("install","-d","$TMP/etc/modutils");
-                       doit("cp","-m0644",$file,"$TMP/etc/modutils/$PACKAGE");
+                       doit("install","-m","0644",$file,"$TMP/etc/modutils/$PACKAGE");
                }
                
                if (! $dh{NOSCRIPTS}) {
index 2262d810fe67251af704a47f8cca2c5b03c6e166..72f8d7ddd6f22877364e68b704579ec6e2ad67f3 100755 (executable)
@@ -4,8 +4,7 @@
 #
 # If debian/pam file exists, save it to $TMP/etc/pam.d/$PACKAGE
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index b3b9059e48d9c49e53c46591151b36a64c1b3ae2..8cb7af0372aab7f1f6bcc199444e7a3de2f7a240 100755 (executable)
@@ -2,21 +2,38 @@
 #
 # Add to postinst and postrm to register a window manager.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
-$wm=shift;
+if (! defined $dh{PRIORITY}) {
+        $dh{PRIORITY}=20;
+}
 
-if ($wm eq '') {
-       error("No window manager filename was specified.");
+if (@ARGV) {
+       # This is here for backwards comatability. If the filename doesn't
+       # include a path, assume it's in /usr/X11R6/bin.
+       if ($ARGV[0] !~ m:/:) {
+               $ARGV[0]="/usr/X11R6/$ARGV[0]";
+       }
 }
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
 #      $TMP=tmpdir($PACKAGE);
+       $file=pkgfile($PACKAGE,"wm");
+
+       if ($file) {
+               @wm=filearray($file);
+       }
 
-       if (! $dh{NOSCRIPTS}) {
-               autoscript($PACKAGE,"postinst","postinst-wm","s:#WM#:$wm:");
-               autoscript($PACKAGE,"postrm","postrm-wm","s:#WM#:$wm:");
+       if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+               push @wm, @ARGV;
+       }
+
+       if (@wm && ! $dh{NOSCRIPTS}) {
+               foreach (@wm) {
+                       autoscript($PACKAGE,"postinst","postinst-wm","s:#WM#:$_:;s/#PRIORITY#/$dh{PRIORITY}/",);
+                       autoscript($PACKAGE,"postrm","postrm-wm","s:#WM#:$_:");
+               }
        }
 }
+
index 486e511bfae5a3beb00aa29d8cc751817beaabeb..33345a9d49589d6d012f063ff4f4ff5bf7d778f1 100644 (file)
@@ -3,14 +3,21 @@
 dh_installwm \- register a window manager
 .SH SYNOPSIS
 .B dh_installwm
-.I "[debhelper options] [-n] wmfilename"
+.I "[debhelper options] [-n] [--priority=n] [wm ...]"
 .SH "DESCRIPTION"
 dh_installwm is a debhelper program that is responsible for
-generating the postinst and postrm commands needed to
-interface with the the
-.BR register-window-manager (8)
-command. This results in a window manager being registered when it is
-installed.
+generating the postinst and postrm commands that register a window manager
+with
+.BR update-alternatives (8)
+.P
+Any windowmanager filenames specified as parameters will be registered in
+the first package dh_installwm is told to ast 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.wm (debian/wm may be used for the
+first binary package in debian/control) can list other window manager to
+register.
 .SH OPTIONS
 .TP
 .B debhelper options
@@ -18,13 +25,16 @@ See
 .BR debhelper (1)
 for a list of options common to all debhelper commands.
 .TP
+.B \--priority=n
+Set the priority of the window manager. Default is 20, which is too low for
+most window managers; see the Debian Policy document for instructions on
+calculating the correct value.
+.TP
 .B \-n, \--noscripts
 Do not modify postinst/postrm scripts. Turns this command into a no-op.
 .TP
 .B wmfilename
-The filename of the window manager you wish to register. May be either a
-simple filename if the window manager is in /usr/X11R6/bin/, or a complete
-path otherwise.
+The filename of the window manager you wish to register.
 .SH NOTES
 Note that this command will set up postinst and postrm scripts for every
 package it acts on. It's wise to limit its action to a single package with,
@@ -41,6 +51,6 @@ instances of the same text to be added to maintainer scripts.
 .TP
 .BR debhelper (1)
 .TP
-.BR register-window-manager (8)
+.BR update-alternatives (8)
 .SH AUTHOR
 Joey Hess <joeyh@debian.org>
index bee971091c459efab64e748c8214ba3fa7a9648a..5cb94e248c476eba15a61ddd6a1103360bee45ae 100755 (executable)
@@ -7,8 +7,7 @@
 #
 # Also, add calls to postinst and postrm.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 1ceb3cbe39ecc4f961b357a67bc6421b3ea9f86b..83f38c0ae2e5767d4c48be9926ece8de4a04bb4e 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Integration with the Debian X11 font policy.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
diff --git a/dh_link b/dh_link
index 8d4c32ad60eac332248b93c5c22dc5022da3ae4d..0cbe6b73ba2e6a0ee2c13afa7bb3f491bc0589da 100755 (executable)
--- a/dh_link
+++ b/dh_link
@@ -3,8 +3,7 @@
 # Generate symlinks in debian packages, reading debian/links. The
 # file contains pairs of files and symlinks.
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
@@ -31,14 +30,16 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
                error("parameters list a link without a destination.");
        }
 
-       # Now I'd prefer to work with a hash.
-       %links=@links;
+       while (@links) {
+               $dest=pop @links;
+               $src=pop @links;
+
+               # Relivatize src and dest.
+               $src=~s:^/::;
+               $dest=~s:^/::;
 
-       foreach $src (keys %links) {
-               $dest=$links{$src};
-                               
                # Make sure the directory the link will be in exists.
-               $basedir=Dh_Lib::dirname("$TMP/$dest");
+               $basedir=Debian::Debhelper::Dh_Lib::dirname("$TMP/$dest");
                if (! -e $basedir) {
                        doit("install","-d",$basedir);
                }
@@ -52,18 +53,20 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
                        # Figure out how much of a path $src and $dest
                        # share in common.
                        for ($x=0; $x<$#src_dirs && $src_dirs[$x] eq $dest_dirs[$x]; $x++) {}
-
                        # Build up the new src.
                        $src="";
                        for (1..$#dest_dirs - $x) {
                                $src.="../";
                        }
-                       # The + 1 is here to include the actual filename.
-                       for (1..$#src_dirs - $x + 1) {
+                       for ($x .. $#src_dirs) {
                                $src.=$src_dirs[$_]."/";
                        }
                        $src=~s:/$::;
-               }       
+               }
+               else {
+                       # Make sure it's properly absolute.
+                       $src="/$src";
+               }
                
                doit("ln","-sf",$src,"$TMP/$dest");
        }
index 7a764af5be0e8b3fac805c934ccc9da843d67e7a..1123e6d2d7b09b3d0d58caa7137f3aeb952e4ddf 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Output a list of all packages debhelper will act on.
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 print join("\n",@{$dh{DOPACKAGES}})."\n";
+
index c3742267eeaf78a5ecdb22bfd3ff4d74f7ec7ba9..237602b4984cd9998f1cc65864afaf5d1314ecd6 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Automatically generate shlibs files.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 634e2fd6c0bf8c4faa93b1deb279999db9b62e61..9a3354de0d30d1767d297d73d224e19bc17e0013 100755 (executable)
@@ -1,22 +1,45 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
-# Generate a DEBIAN/md5sums file, that lists the md5sums of all
-# non-conffiles in the package
+# Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the
+# package.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Cwd;
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
 
-       if [ ! -d "debian/$TMP/DEBIAN" ]; then
-               doit "install -d debian/$TMP/DEBIAN"
-       fi
+       if (! -d "$TMP/DEBIAN") {
+               doit("install","-d","$TMP/DEBIAN");
+       }
 
-       doit "pushd debian/$TMP" >/dev/null
-       # Doit isn't smart enough to hande this next command so echo by hand. (sigh)
-       verbose_echo 'md5sum `find * -type f ! -regex "^DEBIAN/.*"` > DEBIAN/md5sums </dev/null'
-       md5sum `find * -type f ! -regex "^DEBIAN/.*"` >DEBIAN/md5sums </dev/null
-       doit "chown root.root DEBIAN/md5sums"
-       doit "popd 2>/dev/null" >/dev/null 
-done
+       # Check if we should exclude conffiles.
+       my $exclude="";
+       if (! $dh{INCLUDE} && -r "$TMP/DEBIAN/conffiles") {
+               # Generate exclude regexp.
+               open (CONFF,"$TMP/DEBIAN/conffiles");
+               while (<CONFF>) {
+                       chomp;
+                       s/^\///;
+                       $exclude.="! -path \"$_\" ";
+               }
+               close CONFF;
+       }
+       
+       # See if we should exclude other files.
+       if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
+               $exclude.="! \\( $dh{EXCLUDE_FIND} \\) ";
+       }
+       
+       $olddir=getcwd();
+       complex_doit("cd $TMP >/dev/null ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd $olddir >/dev/null");
+       # If the file's empty, no reason to waste inodes on it.
+       if (-z "$TMP/DEBIAN/md5sums") {
+               doit("rm","-f","$TMP/DEBIAN/md5sums");
+       }
+       else {
+               doit("chmod",644,"$TMP/DEBIAN/md5sums");
+               doit("chown","root.root","$TMP/DEBIAN/md5sums");
+       }
+}
index e02637330154edb76741f6be06f8c6380132eaca..9795b785a1a0f0f86f18ab609ebf7a629328e51a 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Move files out of debian/tmp, into subpackages.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 $ret=0;
diff --git a/dh_perl b/dh_perl
index 4136414f3fe80e26e3bf49a5197c5eeb3c4beb0b..dc614e45877e1307fb9dd07cd2591f746266933a 100755 (executable)
--- a/dh_perl
+++ b/dh_perl
@@ -3,12 +3,28 @@
 # Find dependencies on perl stuff
 # Remove .packlist files
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
-my $perl = $ENV{'PERL'} || '/usr/bin/perl';
-$version=sprintf("%.3f", $]);
+my $ext = '';
+my $lib_dir = 'usr/lib/perl5';
+
+# Figure out the version of perl. If $ENV{PERL} is set, query the perl binary
+# it points to, otherwise query perl directly.
+my $version=sprintf("%.3f", $]);
+if (defined $ENV{PERL}) {
+       $version=`$ENV{PERL} -e 'printf "%.3f", \$]'`;
+}
+
+# Cleaning the paths given on the command line
+foreach (@ARGV) {
+       s#/$##;
+       s#^/##;
+}
+
+# If -d is given, then we'll try to depend on one of the perl-5.00X-base 
+# package instead of perl-5.00X
+$ext='-base' if ($dh{'D_FLAG'});
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        $TMP=tmpdir($PACKAGE);
@@ -19,17 +35,24 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        my $dep = '';
        my $found = 0;
 
+       # Check also for alternate locations given on the command line
+       my $dirs = '';
+       foreach ($lib_dir, @ARGV) {
+               $dirs .= "$TMP/$_ " if (-d "$TMP/$_");
+       }
+       my $re = '(?:' . join('|', ($lib_dir, @ARGV)) . ')';
+
        # 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"`)) {
+       if ($dirs) {
+           foreach $file (split(/\n/,`find $dirs -type f \\( -name "*.pm" -or -name "*.so" \\)`)) {
                $found++;
-               if ($file =~ m<^$TMP/usr/lib/perl5/(\d\.\d{3})/([^/]+)/>) {
+               if ($file =~ m<^$TMP/$re/(\d\.\d{3})/([^/]+)/>) {
                        $v = $1;
                        $arch = $2;
                        check_module_version ($v, $version);
-                       $v .= '-thread' if ($arch =~ /-thread/);
+                       $v .= '-thread' if ($arch =~ /-thread/); 
                        $dep_arch = add_deps ($dep_arch, "perl-$v");
-               } elsif ($file =~ m<^$TMP/usr/lib/perl5/(\d.\d{3})/>) {
+               } elsif ($file =~ m<^$TMP/$re/(\d.\d{3})/>) {
                        $v = $1;
                        check_module_version ($v, $version);
                        $dep_arch = add_deps ($dep_arch, "perl-$v");
@@ -38,7 +61,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        }
 
        if ($found and not $dep_arch) {
-               $dep = "perl5";
+               $dep = "perl5$ext";
        } elsif ($dep_arch) {
                $dep = $dep_arch;
        }
@@ -68,14 +91,14 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
 
        next unless $dep;
 
-       if (-e "debian/$EXT\subtsvars") {
-               open (IN, "<debian/$EXT\subtsvars");
+       if (-e "debian/$EXT\substvars") {
+               open (IN, "<debian/$EXT\substvars");
                my @lines=grep { ! /^perl:Depends=/ } <IN>;
                close IN;
-               open (OUT, ">debian/$EXT\subtsvars");
+               open (OUT, ">debian/$EXT\substvars");
                print OUT @lines;
        } else {
-               open (OUT, ">debian/$EXT\subtsvars");
+               open (OUT, ">debian/$EXT\substvars");
        }
        print OUT "perl:Depends=$dep\n";
        close OUT;
@@ -84,6 +107,9 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
 sub add_deps {
        my ($dep, $new) = @_;
        
+        # If the $new-base package can exist then add $ext to $new
+       $new = "$new$ext" if ($new =~ m/^(?:perl5|perl-\d\.\d{3})$/);
+       
        # If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)?
        # is not already in the dependencies
        if ($new eq "perl5") {
index f6ae235ee899bf2e3288293bf71d4d8ca7f03cfb..83783aea4340e4e5da3b140539c0522d5e8f7e52 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Find dependancies. Simple dpkg-shlibdeps wrapper.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 2ecdcd2c957330ae47365477130bae11cd9f4b09..b39d46554f01fa3b6eecdd3da41c31d553aa58c8 100755 (executable)
--- a/dh_strip
+++ b/dh_strip
@@ -1,30 +1,70 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Strip files.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+use File::Find;
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for PACKAGE in $DH_DOPACKAGES; do
-       TMP=`tmpdir $PACKAGE`
+# Check if a file is an elf binary, shared library, or static library,
+# for use by File::Find. It'll fill the following 3 arrays with anything
+# it finds:
+my (@shared_libs, @executables, @static_libs);
+sub testfile {
+       return if -l $_ or -d $_; # Skip directories and symlinks always.
+
+       # See if we were asked to exclude this file.
+       # Note that we have to test on the full filename, including directory.
+       $fn="$File::Find::dir/$_";
+       foreach $f (@{$dh{EXCLUDE}}) {
+               return if ($fn=~m/\Q$f\E/);
+       }
+
+       # Does its filename look like a shared library?
+       if (m/.*\.so.*?/) {
+               # Ok, do the expensive test.
+               my $type=`file $_`;
+               if ($type=~m/.*ELF.*shared.*/) {
+                       push @shared_libs, $fn;
+                       return;
+               }
+       }
+       
+       # Is it executable? -x isn't good enough, so we need to use stat.
+       (undef,undef,$mode,undef)=stat(_);
+       if ($mode & 0111) {
+               # Ok, expensive test.
+               my $type=`file $_`;
+               if ($type=~m/.*ELF.*executable.*/) {
+                       push @executables, $fn;
+                       return;
+               }
+       }
+       
+       # Is it a static library, and not a debug library?
+       if (m/lib.*\.a/ && ! m/.*_g\.a/) {
+               push @static_libs, $fn;
+               return;
+       }
+}
+
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+
+       @shared_libs=@executables=@static_libs=();
+       find(\&testfile,$TMP);
+
+       foreach (@shared_libs) {
+               # Note that all calls to strip on shared libs
+               # *must* inclde the --strip-unneeded.
+               doit("strip","--remove-section=.comment","--remove-section=.note","--strip-unneeded",$_);
+       }
        
-       # Handle executables and shared libraries.
-       for file in `find debian/$TMP -type f \( -perm +111 -or -name "*.so*" \) 2>/dev/null` ; do
-               case "`file $file`" in
-                       *ELF*shared*)
-                               doit "strip --strip-unneeded $file"
-                       ;;
-                       *ELF*executable*)
-                               doit "strip --remove-section=comment --remove-section=note $file"
-                       ;;
-               esac
-       done
-
-       # Handle static libraries.
-       for file in `find debian/$TMP -type f -name "lib*.a" 2>/dev/null` ; do
-               # Don't strip debug libraries.
-               if ! expr "$file" : ".*_g\.a" >/dev/null ; then
-                       doit "strip --strip-debug $file"
-               fi
-       done
-done
+       foreach (@executables) {
+               doit("strip","--remove-section=.comment","--remove-section=.note",$_);
+       }
+
+       foreach (@static_libs) {
+               doit("strip","--strip-debug",$_);
+       }
+}
index b82bc7d229c2113fd0285b424f75b1777230306e..50d64b21cea2e1d9dd5ef860cb14d33685784a36 100755 (executable)
@@ -6,8 +6,7 @@
 # If there are parameters, or there is a debian/suid, register the files
 # listed there.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index 4d3c700bea9935db9a14b021533cc201f21fd5aa..8bd960d3c412d50f46313f5475df8bac9e46b06b 100755 (executable)
@@ -1,14 +1,14 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Checks to make sure we are building the package in the right directory.
 # Tests for the existance of debian/control, and for the existance
 # of any other files you specify on the command line.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-for file in debian/control $@; do
-       if [ ! -e "$file" ] ; then
-               error "\"$file\" not found. Are you sure you are in the correct directory?"
-       fi
-done
+foreach $file ('debian/control',@ARGV) {
+       if (! -e $file) {
+               error("\"$file\" not found. Are you sure you are in the correct directory?");
+       }
+}
index c62894c74cbe6b7e83ab1662f5a686ef5e4fdb69..b76a1e595678268e6914c0bc389be4b0d6e6d83c 100755 (executable)
@@ -2,8 +2,7 @@
 #
 # Checks to make sure you are root.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 
 if ($< != 0) {
        error("You must run this as root.");
index 57c0e588ea81a46e26ba41f1e6e1b424878f09b9..8f252146fd6abcc6e1a3de3e2c6285a40e2bc73a 100755 (executable)
@@ -2,9 +2,8 @@
 #
 # Debhelper version check.
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
-use Dh_Version; # contains the version number of debhelper.
+use Debian::Debhelper::Dh_Lib;
+use Debian::Debhelper::Dh_Version; # contains the version number of debhelper.
 init();
 
 my($compare, $ver);
@@ -19,6 +18,6 @@ elsif ($#ARGV eq 0) {
 }
 
 if (defined $compare and defined $ver) {
-       system('dpkg','--compare-versions',$Dh_Version::version,$compare,$ver) == 0 ||
-               error("debhelper version $Dh_Version::version is installed, but a version $compare $ver is needed to build this package.");
+       system('dpkg','--compare-versions',$Debian::Debhelper::Dh_Version::version,$compare,$ver) == 0 ||
+               error("debhelper version $Debian::Debhelper::Dh_Version::version is installed, but a version $compare $ver is needed to build this package.");
 }
index b1b7b16c1709c2e22e8f10e710f8eeef70ee48e0..93328ad05bfbf086b0f0f0db6b75e085f2ec650d 100755 (executable)
@@ -6,8 +6,7 @@
 # Also, it looks for debian/undocumented files for more lists of
 # undocumented man pages.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
index f4d14bd067d3c776cf69d44a0022c2f26d801a26..df9a7287d558fcea0f0863832596f0840f619a9a 100644 (file)
@@ -16,9 +16,9 @@ passed -v, and if you output the commands, you should indent them with 1 tab).
 This is so we don't have a lot of noise output when all the debhelper commands
 in a debian/rules are run, so the important stuff is clearly visible.
 
-Debhelper programs should accept the options, -v, -i, -a, -p, --no-act, and
--P, and any long forms of these options, like --verbose . If necessary, the
-options may be ignored.
+Debhelper programs should accept all options listed in the "SHARED
+DEBHELPER OPTIONS" section of debhelper(1), including and any long forms of
+these options, like --verbose . If necessary, the options may be ignored.
 
 If debhelper commands need config files, they should use
 debian/package.filename as the name of the config file (replace filename
@@ -41,9 +41,9 @@ There are always exceptions. Just ask me.
 Introducing Dh_Lib.pm:
 ---------------------
 
-Dh_lib.pm is the library used by all debhelper programs to parse their
+Dh_Lib.pm is the library used by all debhelper programs to parse their
 arguments and set some useful variables. It's not mandatory that your
-program use Dh_lib.pm, but it will make it a lot easier to keep it in sync
+program use Dh_Lib.pm, but it will make it a lot easier to keep it in sync
 with the rest of debhelper if it does, so this is highly encouraged.
 
 (There used to be a version of Dh_lib.pm that was a library of functions for
@@ -51,17 +51,16 @@ shell scripts. If you want to write a debhelper command that is a shell
 script, I can dig up that old library for you. Only the perl one is
 supported now, though.)
 
-Use Dh_lib.pm like this:
+Use Dh_Lib.pm like this:
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib
 init();
 
 The BEGIN block is there to make perl look for the module in all the right
 places.
 
-The init() function in the perl version. This causes Dh_lib to
-parse the command line and do some other initialization tasks.
+The init() function causes Dh_lib to parse the command line and do some other
+initialization tasks.
 
 Argument processing:
 -------------------
@@ -126,7 +125,8 @@ switch              variable        description
                                dh_builddeb will ever use this)
 --flavor       FLAVOR          will be set to a string (probably only
                                dh_installemacsen will ever use this)
---number       NUMBER          will be set to a number
+--number       PRIORITY        will be set to a number (deprecated)
+--priority     PRIORITY        will be set to a number
 
 Any additional command line parameters that do not start with "-" will be 
 ignored, and you can access them later just as you normally would.
@@ -206,3 +206,4 @@ autoscript()
        maintainer script (like the postinst or prerm).
 
 -- Joey Hess <joeyh@debian.org>
+
index dcc42e612c0419847ab09f932be60e36b4d607aa..93351579a488d66842a5ced89a754dce96253601 100644 (file)
@@ -20,7 +20,6 @@ Debhelper v2 is a major new version of Debhelper, still under development.
 Debhelper will continue to work in v1 compatability mode for now, if you're
 interested in trying the new versiln, read the file named "v2".
 
-
 Starting a new package:
 ----------------------
 
@@ -72,3 +71,4 @@ Other notes:
 * Debhelper's home page is at http://kitenet.net/programs/debhelper/
 
 -- Joey Hess <joeyh@debian.org>
+
index 54c95f3bb59255f4fbaeb465289124e91f5a0f99..c341e96c42453a559cdc5731871442e733f9e931 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -57,3 +57,6 @@ Deprecated:
     one year after they were deprecated, whichever comes first. Be sure to
     grep whole debian archive for all of them before removing them, though!
   - currently, a few packages in potato use dh_du, but bugs have been filed.
+* Remove support for --number option
+  - only dh_installemacsen ever used it, it is not --priority.
+
diff --git a/doc/v2 b/doc/v2
index fdfa548d9a523c0a82cfd85f4de3d8d273163688..327e625e862887109c42fd346475b6817da187bf 100644 (file)
--- a/doc/v2
+++ b/doc/v2
@@ -65,3 +65,4 @@ them.
 
 * dh_makeshlibs will generate autoscript fragments for ldconfig. This will
   require you call it before dh_installdeb, which isn't always done now.
+