]> git.donarmstrong.com Git - debhelper.git/commitdiff
r43: Initial Import
authorjoey <joey>
Tue, 17 Aug 1999 04:41:40 +0000 (04:41 +0000)
committerjoey <joey>
Tue, 17 Aug 1999 04:41:40 +0000 (04:41 +0000)
README
TODO
debian/changelog
debian/rules
dh_du
dh_installchangelogs
dh_installdirs.1
dh_installdocs
dh_installinit
dh_lib
dh_suidregister

diff --git a/README b/README
index 280da78149f40cff0a1e95bda656fb23e9ae0f70..5c3bf91e2b52ea8c9ca76031a234dc2beefbbd53 100644 (file)
--- a/README
+++ b/README
@@ -2,11 +2,10 @@ Debhelper is a collection of programs that can be used in debian/rules files
 to automate common tasks. For further documentation, see the man pages for
 dh_* commands.
 
-To help you get started, I've included an example of a debian/rules file
-that uses debhelper commands extensively. See
-/usr/doc/debhelper/examples/rules . These files are also useful as they give
-one good order you can run the different debhelper scripts in (though other
-variations are possible).
+To help you get started, I've included examples of debian/rules files
+that use debhelper commands extensively. See /usr/doc/debhelper/examples/ . 
+These files are also useful as they give one good order you can run the 
+various debhelper scripts in (though other variations are possible).
 
 
 Converting from debstd to debhelper:
@@ -76,7 +75,12 @@ All scripts that automatically generate code in this way let it be disabled
 by the -n parameter.
 
 Note that it will be shell code, so you cannot directly use it in a perl 
-script.
+script. If you would like to embed it into a perl script, here is one way to
+do that:
+
+print << `EOF`
+#DEBHELPER#
+EOF
 
 
 Notes on multiple binary packages:
@@ -100,7 +104,7 @@ following parameters:
                times)
 
 These parameters are cumulative. If none are given, the tools default to
-effecting all packages.
+affecting all packages.
 
 See examples/rules.multi for an example of how to use this.
 
diff --git a/TODO b/TODO
index 3118ab951b8877211f1b9663ddf6eb6009464cc7..00281d704600df2264641dd4432b970c4ae51245 100644 (file)
--- a/TODO
+++ b/TODO
@@ -2,7 +2,5 @@
 * add all other functionality of debstd (??)
 * dh_fixperms: allow listing of files not to be touched (diffucult).
 * add a dh_debstd, which mimics debstd, but uses debhelper tools internally.
-* dh_du: change it so it doesn't grep for things with tabs in them. That's
-  nasty. (and makes cut-and-paste from dh_du -v not work).
 * dh_compress: add --exclude "*.conf" type-thingy
 * info support for debhelper
index 80d0aaa33aa82776f0fe1163241a59032cbc5e3e..a1139e5b75da5db235ecde0129407c01fd9fad59 100644 (file)
@@ -1,3 +1,12 @@
+debhelper (0.37) unstable; urgency=low
+
+  * dh_du: Fixed hardcoded debian/tmp.
+  * This change got lost by accident, redid it: Optimized out most of the
+    slowdown caused byusing dpkg-parsechangelog - now it's only called by
+    2 dh_* programs.
+
+ -- Joey Hess <joeyh@master.debian.org>  Sun, 28 Dec 1997 20:45:22 -0500
+
 debhelper (0.36) unstable; urgency=low
 
   * dh_undocumented: exit with an error message if the man page specified
index b236fb1f0fd1affb5634fa4da6f3f0e73c00799f..6ac6d672a987e7be9218594863b002f2fd9c8536 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/make -f
-# Note that I have to refer to debhelper programs witrh ./, to make sure
+# 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 in this debian/ directory.
 
@@ -7,17 +7,24 @@
 # be sure to use the new templates from this package.
 export DH_AUTOSCRIPTDIR=autoscripts
 
+# Figure out the current debhelper version.
+VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null`" : \
+       '.*Version: \(.*\).*Distribution:')
+
 export DH_VERBOSE=1
 
 test_files=dh_lib
 
 build:
        ./dh_testdir $(test_files)
+       sed "s/#DEBHELPER_VERSION#/$(VERSION)/" < dh_testversion.in \
+               > dh_testversion
+       chmod 755 dh_testversion
 
 clean:
        ./dh_testdir $(test_files)
        ./dh_testroot
-       ./dh_clean
+       ./dh_clean dh_testversion
 
 # Build architecture-dependent files here.
 binary-arch: build
@@ -35,7 +42,7 @@ binary-indep: build
        cp dh_lib debian/tmp/usr/lib/debhelper
        cp -a autoscripts debian/tmp/usr/lib/debhelper
 
-       ./dh_installdocs TODO README BUGS
+       ./dh_installdocs TODO README
        ./dh_installexamples examples/*
        ./dh_installmenu
        ./dh_installmanpages
diff --git a/dh_du b/dh_du
index 39c684eb2a864fc6191ce862245f49529134868e..71ce2b1368998fc3c1182c8f446c1e2d7b193428 100755 (executable)
--- a/dh_du
+++ b/dh_du
@@ -15,5 +15,5 @@ for PACKAGE in $DH_DOPACKAGES; do
 
        # Note that the tabs in this next line are important.
        complex_doit "du -k $TMP | sed 's:      $TMP/:  :' | grep -v '  DEBIAN$' | grep -v '    $TMP$' >$TMP/DEBIAN/du"
-       doit "chown root.root debian/tmp/DEBIAN/du"
+       doit "chown root.root $TMP/DEBIAN/du"
 done
index 7405daae6d2c97915b36e456ec15b8dc0dc02a2e..0dd09918a58d801dd577a47fbaedf6636eb65c5d 100755 (executable)
@@ -12,11 +12,11 @@ PATH=debian:$PATH:/usr/lib/debhelper
 
 UPSTREAM=$1
 
-if [ "$NATIVE" -a "$UPSTREAM" ]; then
+if isnative && [ "$UPSTREAM" ]; then
        error "Cannot specify an upstream changelog for a native debian package."
 fi
 
-if [ "$NATIVE" ]; then
+if isnative; then
        CHANGELOG_NAME=changelog
 else
        CHANGELOG_NAME=changelog.Debian
index 9f5bc351f6f62c362c74dc85affa9d95580627cb..fc5c8d623b632331fe788815aaabeddd92922a59 100644 (file)
@@ -9,8 +9,9 @@ dh_installdirs is a debhelper program that is responsible for creating
 subdirectories in package build directories.
 .P
 Any directory names specified as parameters will be created in the package
-build directory of the first binary package listed in debian/control, if 
-dh_installdirs is acting on that package.
+build directory of the first package dh_installdirs 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/dirs (for the first binary package in debian/control),
 or debian/package.dirs (for each additional package in debian/control) can
@@ -37,8 +38,8 @@ Create directories for the package named "package".
 Use "tmpdir" for package build directory. 
 .TP
 .B dir ...
-Create these directories in the package build directory of the first binary 
-package listed in debian/control, if we are acting on that package.
+Create these directories in the package build directory of the first package
+acted on.
 .SH NOTES
 The
 .B \-a
index 153be9a2e9fcffb18c2ba464b15d11948e987c06..a1da8aa9545649a2dd2cb910f6ffc177dfe259c4 100755 (executable)
@@ -38,7 +38,7 @@ for PACKAGE in $DH_DOPACKAGES; do
                        doit "install -m 644 -p debian/README.Debian $TMP/usr/doc/$PACKAGE/"
                fi
                if [ -f debian/TODO ]; then
-                       if [ "$NATIVE" ]; then
+                       if isnative; then
                                doit "install -m 655 -p debian/TODO $TMP/usr/doc/$PACKAGE/TODO"
                        else
                                doit "install -m 644 -p debian/TODO $TMP/usr/doc/$PACKAGE/TODO.Debian"
index 2ea3440f3d680961134155777e9131a07162c4de..857e27930a079eb35f10917b082c7ef8573736c6 100755 (executable)
@@ -6,6 +6,12 @@
 PATH=debian:$PATH:/usr/lib/debhelper
 . dh_lib
 
+# This works around a bug in getopt(1), where it ignores some parameters.
+# Sigh.
+if [ "$*" ]; then
+       DH_U_PARAMS="$DH_U_PARAMS $*"
+fi
+
 for PACKAGE in $DH_DOPACKAGES; do
        TMP=`tmpdir $PACKAGE`
        EXT=`pkgext $PACKAGE`
diff --git a/dh_lib b/dh_lib
index 8347aae88d31e7df4f519d26c480923e3f19e8ab..2c2b995f5dabf312b12fd756669fbca96c27a75a 100644 (file)
--- a/dh_lib
+++ b/dh_lib
@@ -52,19 +52,26 @@ pkgext() {
 }
 
 # Returns 1 if the package is a native debian package, null otherwise.
+# Caches return code so it only needs to run dpkg-parsechangelog once.
 isnative() {
-       # Get the package version.
-       # Note that the 2>/dev/null is because a bug in dpkg-parsechangelog makes it
-       # output a bogus error message to stderr.
-       # If it actually has a real error, then the expr will fail, and this whole
-       # script will come crashing to a halt, which is good enough to inform
-       # the user something's wrong. :-)
-       VERSION=`expr "\`dpkg-parsechangelog 2>/dev/null\`" : \
-               '.*Version: \(.*\).*Distribution:'`
-       # Is this a native Debian package?
-       if expr "$VERSION" : '.*-' >/dev/null; then
-               return 1
+       if [ -z "$DH_ISNATIVE" ]; then
+               # Get the package version.
+               # Note that the 2>/dev/null is because a bug in dpkg-parsechangelog makes it
+               # output a bogus error message to stderr.
+               # If it actually has a real error, then the expr will fail, and this whole
+               # script will come crashing to a halt, which is good enough to inform
+               # the user something's wrong. :-)
+               VERSION=`expr "\`dpkg-parsechangelog 2>/dev/null\`" : \
+                       '.*Version: \(.*\).*Distribution:'`
+               # Is this a native Debian package?
+               if expr "$VERSION" : '.*-' >/dev/null; then
+                       DH_ISNATIVE=1
+               else
+                       DH_ISNATIVE=0
+               fi
        fi
+
+       return "$DH_ISNATIVE"
 }
 
 # Automatically add a shell script snippet to a debian script.
@@ -95,10 +102,46 @@ autoscript() {
        complex_doit "echo '# End automatically added section' >> $autoscript_debscript"
 }
 
+# Sets 2 global variables, INDEP_PACKAGES is all the arch-independant
+# packages, ARCH_PACKAGES is the arch-dependant packages.
+get_arch_indep_packages() {
+       INDEP_PACKAGES=""
+       ARCH_PACKAGES=""
+       
+       # First, get the list of all binary packages.
+        # Notice we want the list in reverse order, thus the tac.
+       PACKAGES=`grep ^Package: debian/control | cut -d " " -f 2 | tac | tr "\n" " "`
+       # Remove trailing space.
+       PACKAGES=`expr "$PACKAGES" : '\(.*\) '`
+       # Loop on the list of architectures.
+       for ARCH in `grep ^Architecture: debian/control | cut -d " " -f 2` ; do
+               # Pull the last package off the list.
+               THISPKG=`expr "$PACKAGES" : '.* \(.*\)'` || true
+               if [ ! "$THISPKG" ]; then
+                       THISPKG=$PACKAGES
+               fi
+               PACKAGES=`expr "$PACKAGES" : '\(.*\) .*'` || true
+       
+               if [ ! "$THISPKG" ]; then
+                       error "debian/control invalid - too many Architecture lines or too few Package lines"
+               fi
+
+               if [ "$ARCH" = "all" ]; then
+                       INDEP_PACKAGES="$INDEP_PACKAGES $THISPKG"
+               else
+                       ARCH_PACKAGES="$ARCH_PACKAGES $THISPKG"
+               fi
+       done
+
+       if [ "$PACKAGES" ]; then
+               error "debian/control invalid - too many Architecure lines or too few Package lines"
+       fi
+}
+
 # Argument processing and global variable initialization is below.
 
 # Parse command line.
-set -- `getopt xvidrnakp:P:u: $*`
+set -- `getopt xvidrnakp:P:u:m: $*`
 
 for i; do
        case "$i"
@@ -108,10 +151,14 @@ for i; do
                        shift
                        ;;
                -i)
+                       get_arch_indep_packages
+                       DH_DOPACKAGES="$DH_DOPACKAGES $INDEP_PACKAGES"
                        DH_DOINDEP=1
                        shift
                        ;;
                -a)
+                       get_arch_indep_packages
+                       DH_DOPACKAGES="$DH_DOPACKAGES $ARCH_PACKAGES"
                        DH_DOARCH=1
                        shift
                        ;;
@@ -150,6 +197,11 @@ for i; do
                        shift
                        shift
                        ;;
+               -m)
+                       DH_M_PARAMS="$2"
+                       shift
+                       shift
+                       ;;
                --)
                        shift
                        break
@@ -157,54 +209,22 @@ for i; do
        esac
 done
 
-# Get the name of the main binary package.
+# Get the name of the main binary package (first one listed in
+# debian/control).
 MAINPACKAGE=`grep ^Package: debian/control | cut -d " " -f 2 | head -1`
 
-if [ "$DH_DOINDEP" -o "$DH_DOARCH" ]; then
-       # Figure out all the binary packages to be produced, by looking at the
-       # control file. Break it into 2 lists, INDEP_PACKAGES and ARCH_PACKAGES.
-       #
-       # First, get the list of all binary packages.
-       PACKAGES=`grep ^Package: debian/control | cut -d " " -f 2 | tr "\n" " "`
-       # Remove trailing space.
-       PACKAGES=`expr "$PACKAGES" : '\(.*\) '`
-       # Loop on the list of architectures. Note that we tac the result to reverse
-       # it, becuase we are going through the list of packages in reverse.
-       for ARCH in `grep ^Architecture: debian/control | tac | cut -d " " -f 2` ; do
-               THISPKG=`expr "$PACKAGES" : '.* \(.*\)'` || true
-               if [ ! "$THISPKG" ]; then
-                       THISPKG=$PACKAGES
-               fi
-               PACKAGES=`expr "$PACKAGES" : '\(.*\) .*'` || true
-               if [ ! "$THISPKG" ]; then
-                       error "debian/control invalid - too many Architecture lines or too few Package lines"
-               fi
-               if [ "$ARCH" = "all" ]; then
-                       INDEP_PACKAGES="$INDEP_PACKAGES $THISPKG"
-               else
-                       ARCH_PACKAGES="$ARCH_PACKAGES $THISPKG"
-               fi
-       done
-
-       if [ "$PACKAGES" ]; then
-               error "debian/control invalid - too many Architecure lines or too few Package lines"
-       fi
-       if [ "$DH_DOINDEP" ]; then
-               DH_DOPACKAGES="$DH_DOPACKAGES $INDEP_PACKAGES"
-       fi
-       if [ "$DH_DOARCH" ]; then
-               DH_DOPACKAGES="$DH_DOPACKAGES $ARCH_PACKAGES"
-       fi
+# Remove leading spaces from DH_DOPACKAGES.
+if expr "$DH_DOPACKAGES" : ' *.*' >/dev/null ; then
+       DH_DOPACKAGES_NEW=`expr "$DH_DOPACKAGES" : ' *\(.*\)'`
 fi
 
 # Check if packages to build have been specified, if not, fall back to 
-# the default, doing them all. Note that DH_DOPACKAGES may have a leading
-# space and be empty otherwise.
-if [ ! "$DH_DOPACKAGES" -o "$DH_DOPACKAGES" = " " ]; then
+# the default, doing them all.
+if [ ! "$DH_DOPACKAGES" ]; then
        if [ "$DH_DOINDEP" -o "$DH_DOARCH" ]; then
                error "I have no package to build."
        fi
-       DH_DOPACKAGES=`grep ^Package: debian/control | cut -d " " -f 2`
+       DH_DOPACKAGES=`grep ^Package: debian/control | cut -d " " -f 2 | tr "\n" " "`
 fi
 
 # Check to see if -P was specified. If so, we can only act on a single
@@ -212,3 +232,19 @@ fi
 if [ "$DH_TMPDIR" ] && echo "$DH_DOPACKAGES" | egrep -q '.+ .+' ; then
        error "-P was specified, but multiple packages would be acted on."
 fi
+
+# Figure out which package is the first one we were instructed to build.
+# This package gets special treatement, files and directories specified on
+# the command line may effect it.
+for PACKAGE in $DH_DOPACKAGES ; do
+       DH_FIRSTPACKAGE="$PACKAGE"
+       break
+done
+
+# Check to see if: DH_FIRSTPACKAGE is not the MAINPACKAGE, and
+# some command line arguemnts are passed. Display a warning, becuase
+# debhelper's behaviour has changed in this case.
+if [ "$DH_FIRSTPACKAGE" != "$MAINPACKAGE" -a "$*" ]; then
+       echo `basename $0`": Warning: my behavior has changed, and command line" >&2
+       echo `basename $0`": arguments \"$*\" will apply to package \"$DH_FIRSTPACKAGE\"" >&2
+fi
index e03379f661ab985f62c5451995150b28181c64ce..42e4d16da34f86b1550b7a3f71034608763f9b84 100755 (executable)
@@ -19,7 +19,7 @@ for PACKAGE in $DH_DOPACKAGES; do
                files=`tr "\n" " " < debian/${EXT}suid`
        fi
 
-       if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
+       if [ "$PACKAGE" = "$DH_FIRSTPACKAGE" -a "$*" ]; then
                files="$* $files"
        fi