From: joey Date: Tue, 17 Aug 1999 04:21:03 +0000 (+0000) Subject: r4: Initial Import X-Git-Tag: debian_version_0_1~220 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7511571c6481101f17f9858357e62d133a8dcb1a;p=debhelper.git r4: Initial Import --- 7511571c6481101f17f9858357e62d133a8dcb1a diff --cc TODO index de0177f,de0177f..078a1d4 --- a/TODO +++ b/TODO @@@ -1,6 -1,6 +1,4 @@@ --shared libaries .so files of compressed manpages change to symlinks --multiple binary packages support edit package scripts (??) add all other functionality of debstd (??) --documentation ++dh_fixperms: allow listing of files not to be touched (diffucult). diff --cc debian/changelog index 87d5263,87d5263..7f1faa3 --- a/debian/changelog +++ b/debian/changelog @@@ -1,3 -1,3 +1,29 @@@ ++debhelper (0.2) unstable; urgency=low ++ ++ * Moved out of unstable, it still has rough edges and incomplete bits, but ++ is ready for general use. ++ * Added man pages for all commands. ++ * Multiple binary package support. ++ * Support for specifying exactly what set of binary packages to act on, ++ by group (arch or noarch), and by package name. ++ * dh_clean: allow specification of additional files to remove as ++ parameters. ++ * dh_compress: fixed it to not compress doc/package/copyright ++ * dh_installmanpage: allow listing of man pages that should not be ++ auto-installed as parameters. ++ * dh_installdebfiles: make sure all installed files have proper ownerships ++ and permissions. ++ * dh_installdebfiles: only pass ELF files to dpkg-shlibdeps, and pass .so ++ files. ++ * Added a README. ++ * dh_compress: changed behavior - debian/compress script is now run inside ++ the package build directory it is to act on. ++ * Added dh_lib symlink in debian/ so the debhelper apps used in this ++ package's debian/rules always use the most up-to-date db_lib. ++ * Changed dh_cleantmp commands in the examples rules files to dh_clean. ++ ++ -- Joey Hess Tue, 23 Sep 1997 12:26:12 -0400 ++ debhelper (0.1) experimental; urgency=low * First release. This is a snapshot of my work so far, and it not yet diff --cc debian/rules index 0806a4d,0806a4d..247b48b --- a/debian/rules +++ b/debian/rules @@@ -2,6 -2,6 +2,8 @@@ # Note that I have to refer to debhelper programs witrh ./, to make sure # I run the most current ones. ++export DH_VERBOSE=1 ++ test_files=dh_lib build: @@@ -14,7 -14,7 +16,7 @@@ clean # Build architecture-dependent files here. binary-arch: build -- # We have nothing to do by default. ++# We have nothing to do by default. # Build architecture-independent files here. binary-indep: build @@@ -28,7 -28,7 +30,7 @@@ install -d debian/tmp/usr/lib/debhelper cp dh_lib debian/tmp/usr/lib/debhelper -- ./dh_installdocs TODO ++ ./dh_installdocs TODO README ./dh_installexamples examples/* # ./dh_installmenu ./dh_installmanpages diff --cc dh_builddeb index a62e81c,a62e81c..7bea3c0 --- a/dh_builddeb +++ b/dh_builddeb @@@ -1,7 -1,7 +1,11 @@@ #!/bin/sh -e # --# Build the .deb package, assuming all the files are set up in debian/tmp. ++# Build the .deb package, assuming all the files are set up. PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --doit "dpkg --build debian/tmp .." ++ ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ doit "dpkg --build debian/$TMP .." ++done diff --cc dh_clean index da2c4b2,da2c4b2..e7bec96 --- a/dh_clean +++ b/dh_clean @@@ -1,16 -1,16 +1,21 @@@ #!/bin/sh -e # --# Clean up debian/tmp and other teporary files generated by the ++# Clean up debian/$TMP and other tepmorary files generated by the # build process. PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --doit "rm -rf debian/tmp" --doit "rm -f debian/substvars debian/*.substvars debian/files*" ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` ++ doit "rm -rf debian/$TMP" ++ doit "rm -f debian/${EXT}substvars" ++done ++doit "rm -f debian/files* $*" # 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 ++# 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 {} \; diff --cc dh_compress index e1f8ed6,e1f8ed6..a1ff97e --- a/dh_compress +++ b/dh_compress @@@ -6,35 -6,35 +6,47 @@@ PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --# The config file is a sh script that outputs the files to be compressed --# (typically using find). --if [ -f debian/compress ]; then -- files=`sh debian/compress 2>/dev/null` --else -- # By default fall back on what the policy manual says to compress. -- files=` -- find debian/tmp/usr/info debian/tmp/usr/man \ -- debian/tmp/usr/X11*/man -type f 2>/dev/null ; -- find debian/tmp/usr/doc -type f -size +4k \ -- ! -name "*.htm*" ! -name "*.gif" \ -- ! -name "debian/tmp/usr/doc/*/copyright" 2>/dev/null -- ` --fi ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` --if [ "$files" ]; then -- # This is just a cosmetic fix. -- files=`echo $files | tr "\n" " "` ++ # Run the file name gatering commands from within the directory ++ # structure that will be effected. ++ olddir=`pwd` ++ cd debian/$TMP -- doit "gzip -9 $files" || true --fi ++ if [ -f debian/${EXT}compress ]; then ++ # The config file is a sh script that outputs the files to be compressed ++ # (typically using find). ++ files=`sh debian/${EXT}compress 2>/dev/null` ++ else ++ # By default fall back on what the policy manual says to compress. ++ files=` ++ find usr/info usr/man usr/X11*/man -type f 2>/dev/null ; ++ find usr/doc -type f -size +4k \ ++ ! -name "*.htm*" ! -name "*.gif" \ ++ ! -name "copyright" 2>/dev/null ++ ` ++ fi --# Fix up symlinks that were pointing to the uncompressed files. --for file in `find debian/tmp -type l`; do -- DIRECTORY=`expr $file : "\(.*\)/[^/]*"` -- NAME=`expr $file : ".*/\([^/]*\)"` -- LINKVAL=`ls -l $DIRECTORY/$NAME | awk '{ print $11;}'` -- if [ ! -e $DIRECTORY/$LINKVAL -a -f $DIRECTORY/$LINKVAL.gz ]; then -- doit "rm $DIRECTORY/$NAME" -- doit "ln -s $LINKVAL.gz $DIRECTORY/$NAME.gz" ++ if [ "$files" ]; then ++ # This is just a cosmetic fix. ++ files=`echo $files | tr "\n" " "` ++ ++ doit "gzip -9 $files" || true fi ++ ++ # Change back to old pwd. ++ cd $olddir ++ ++ # Fix up symlinks that were pointing to the uncompressed files. ++ for file in `find debian/$TMP -type l`; do ++ DIRECTORY=`expr $file : "\(.*\)/[^/]*"` ++ NAME=`expr $file : ".*/\([^/]*\)"` ++ LINKVAL=`ls -l $DIRECTORY/$NAME | awk '{ print $11;}'` ++ if [ ! -e $DIRECTORY/$LINKVAL -a -f $DIRECTORY/$LINKVAL.gz ]; then ++ doit "rm $DIRECTORY/$NAME" ++ doit "ln -s $LINKVAL.gz $DIRECTORY/$NAME.gz" ++ fi ++ done done diff --cc dh_fixperms index a2fd944,a2fd944..9773831 --- a/dh_fixperms +++ b/dh_fixperms @@@ -5,25 -5,25 +5,30 @@@ PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --# General things.. --if [ -d debian/tmp ]; then -- doit "chown -R root.root debian/tmp" -- doit "chmod -R go=rX debian/tmp" --fi ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` --# Fix up premissions in /usr/doc, setting everything to not exectable --# by default. --files=`find debian/tmp/usr/doc -type f 2>/dev/null | tr "\n" " "` || true --if [ "$files" ]; then -- doit "chmod 644 $files" --fi --files=`find debian/tmp/usr/doc -type d 2>/dev/null | tr "\n" " "` || true --if [ "$files" ]; then -- doit "chmod 755 $files" --fi ++ # General things.. ++ if [ -d debian/$TMP ]; then ++ doit "chown -R root.root debian/$TMP" ++ doit "chmod -R go=rX debian/$TMP" ++ fi --# Executable man pages is just not done. --files=`find debian/tmp/usr/man/ debian/tmp/usr/X11*/man/ -type f 2>/dev/null | tr "\n" " "` || true --if [ "$files" ]; then -- doit "chmod 644 $files" --fi ++ # Fix up premissions in usr/doc, setting everything to not exectable ++ # by default. ++ files=`find debian/$TMP/usr/doc -type f 2>/dev/null | tr "\n" " "` || true ++ if [ "$files" ]; then ++ doit "chmod 644 $files" ++ fi ++ files=`find debian/$TMP/usr/doc -type d 2>/dev/null | tr "\n" " "` || true ++ if [ "$files" ]; then ++ doit "chmod 755 $files" ++ fi ++ ++ # Executable man pages are a bad thing. ++ files=`find debian/$TMP/usr/man/ debian/$TMP/usr/X11*/man/ -type f 2>/dev/null | tr "\n" " "` || true ++ if [ "$files" ]; then ++ doit "chmod 644 $files" ++ fi ++done diff --cc dh_installchangelogs index 935a87a,935a87a..4a93188 --- a/dh_installchangelogs +++ b/dh_installchangelogs @@@ -13,7 -13,7 +13,7 @@@ source dh_li UPSTREAM=$1 if [ "$NATIVE" -a "$UPSTREAM" ]; then -- error "Cannot specify an upstream changelog for a native package." ++ error "Cannot specify an upstream changelog for a native debian package." fi if [ "$NATIVE" ]; then @@@ -22,11 -22,11 +22,15 @@@ els CHANGELOG_NAME=changelog.Debian fi --if [ ! -d debian/tmp/usr/doc/$PACKAGE ]; then -- doit "install -d debian/tmp/usr/doc/$PACKAGE" --fi --doit "install -p -m644 debian/changelog debian/tmp/usr/doc/$PACKAGE/$CHANGELOG_NAME" ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` --if [ "$UPSTREAM" ]; then -- doit "install -p -m644 $UPSTREAM debian/tmp/usr/doc/$PACKAGE/changelog" --fi ++ if [ ! -d debian/$TMP/usr/doc/$PACKAGE ]; then ++ doit "install -d debian/$TMP/usr/doc/$PACKAGE" ++ fi ++ doit "install -p -m644 debian/changelog debian/$TMP/usr/doc/$PACKAGE/$CHANGELOG_NAME" ++ ++ if [ "$UPSTREAM" ]; then ++ doit "install -p -m644 $UPSTREAM debian/$TMP/usr/doc/$PACKAGE/changelog" ++ fi ++done diff --cc dh_installdebfiles index ada8215,ada8215..872eacb --- a/dh_installdebfiles +++ b/dh_installdebfiles @@@ -6,30 -6,30 +6,42 @@@ PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --if [ ! -d debian/tmp/DEBIAN ]; then -- doit "install -d debian/tmp/DEBIAN" --fi ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` --# Install executable files. --for file in postinst preinst prerm postrm; do -- if [ -f debian/$file ]; then -- doit "install -p debian/$file debian/tmp/DEBIAN" ++ if [ ! -d debian/$TMP/DEBIAN ]; then ++ doit "install -o root -g root -d debian/$TMP/DEBIAN" fi --done --# Install non-executable files --for file in shlibs conffiles; do -- if [ -f debian/$file ]; then -- doit "install -m 644 -p debian/$file debian/tmp/DEBIAN" -- fi --done ++ # Install executable files. ++ for file in postinst preinst prerm postrm; do ++ if [ -f debian/$EXT$file ]; then ++ doit "install -o root -g root -p debian/$EXT$file debian/$TMP/DEBIAN" ++ fi ++ done --# Run dpkg-shlibdeps to generate dependancies. --# This ends up running dpkg-shlibdeps on scripts, but that is no big deal. --files=`find debian/tmp -type f -perm +111 | tr "\n" " "` --if [ "$files" ]; then -- doit "dpkg-shlibdeps $files" --fi ++ # Install non-executable files ++ for file in shlibs conffiles; do ++ if [ -f debian/$EXT$file ]; then ++ doit "install -o root -g root -m 644 -p debian/$EXT$file debian/$TMP/DEBIAN" ++ fi ++ done --# Generate and install control file. --doit "dpkg-gencontrol -p$PACKAGE" ++ # Run dpkg-shlibdeps to generate dependancies. ++ filelist="" ++ for file in `find debian/$TMP -type f \( -perm +111 \) -or -name "*.so.*" | tr "\n" " "` ; do ++ case "`file $file`" in ++ *ELF*) ++ filelist="$file $filelist" ++ ;; ++ esac ++ done ++ if [ "$filelist" ]; then ++ doit "dpkg-shlibdeps -Tdebian/${EXT}substvars $filelist" ++ fi ++ ++ # Generate and install control file. ++ doit "dpkg-gencontrol -p$PACKAGE -Tdebian/${EXT}substvars -Pdebian/$TMP" ++ doit "chown root.root debian/$TMP/DEBIAN/control" ++done diff --cc dh_installdocs index 9481ec4,9481ec4..336ed6e --- a/dh_installdocs +++ b/dh_installdocs @@@ -1,26 -1,26 +1,45 @@@ #!/bin/sh -e # --# Reads debian/docs, and looks at files listed on command line, installs all --# files listed there into /usr/doc/$PACKAGE ++# Reads debian/docs, installs all files listed there into /usr/doc/$PACKAGE # Also installs the debian/copyright and debian/README.debian and debian/TODO PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --if [ ! -d debian/tmp/usr/doc/$PACKAGE ]; then -- doit "install -d debian/tmp/usr/doc/$PACKAGE" --fi ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` --if [ -e debian/docs ]; then -- docs=`cat debian/docs | tr "\n" " "` --fi ++ if [ ! -d debian/$TMP/usr/doc/$PACKAGE ]; then ++ doit "install -d debian/$TMP/usr/doc/$PACKAGE" ++ fi --for file in $docs $@; do -- doit "cp -a $file debian/tmp/usr/doc/$PACKAGE/" --done ++ docs="" ++ ++ if [ -e debian/${EXT}docs ]; then ++ docs=`cat debian/${EXT}docs | tr "\n" " "` ++ fi ++ ++ if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then ++ docs="$* $docs" ++ fi ++ ++ if [ "$docs" ]; then ++ for file in $docs; do ++ doit "cp -a $file debian/$TMP/usr/doc/$PACKAGE/" ++ done ++ fi ++ ++ # Install these files only into the main package by default. ++ if [ "$PACKAGE" = "$MAINPACKAGE" ]; then ++ for file in README.debian TODO ; do ++ if [ -f debian/$file ]; then ++ doit "install -m 644 -p debian/$file debian/$TMP/usr/doc/$PACKAGE/" ++ fi ++ done ++ fi --for file in copyright README.debian TODO ; do -- if [ -f debian/$file ]; then -- doit "install -m 644 -p debian/$file debian/tmp/usr/doc/$PACKAGE/" ++ if [ -f debian/copyright ]; then ++ doit "install -m 644 -p debian/copyright debian/$TMP/usr/doc/$PACKAGE/" fi done diff --cc dh_installexamples index 7aec26e,7aec26e..06e28d6 --- a/dh_installexamples +++ b/dh_installexamples @@@ -6,16 -6,16 +6,27 @@@ PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --if [ -e debian/examples ]; then -- examples=`cat debian/examples | tr "\n" " "` --fi ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` --if [ "$examples" -o $@ ]; then -- if [ ! -d debian/tmp/usr/doc/$PACKAGE/examples ]; then -- doit "install -d debian/tmp/usr/doc/$PACKAGE/examples" ++ examples="" ++ ++ if [ -e debian/${EXT}examples ]; then ++ examples=`cat debian/${EXT}examples | tr "\n" " "` ++ fi ++ ++ if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then ++ examples="$* $examples" fi -- for file in $examples $@; do -- doit "cp -a $file debian/tmp/usr/doc/$PACKAGE/examples/" -- done --fi ++ if [ "$examples" ]; then ++ if [ ! -d debian/$TMP/usr/doc/$PACKAGE/examples ]; then ++ doit "install -d debian/$TMP/usr/doc/$PACKAGE/examples" ++ fi ++ ++ for file in $examples; do ++ doit "cp -a $file debian/$TMP/usr/doc/$PACKAGE/examples/" ++ done ++ fi ++done diff --cc dh_installmanpages index 9dbf1c9,9dbf1c9..7ee35a9 --- a/dh_installmanpages +++ b/dh_installmanpages @@@ -1,16 -1,16 +1,19 @@@ #!/bin/sh -e # --# Automatically find and install man pages. ++# Automatically find and install man pages. However, do not install any man ++# pages listed on the command line. # This is a little bit DWIMish, but still very handy. PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --# Note: this was mostly copied from debstd, and not verified to work. --# Find all filenames that look like man pages. --for file in `find * -name "*.[1-9]*" ! -name "*.ex" ! -name "*.in"`; do -- # Make sure they arn't alreadt in debian/tmp -- if ! expr $file : 'debian/tmp/.*' >/dev/null; then ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ ++ # Find all filenames that look like man pages. ++ # .ex files are examples installed by deb-make, we don't want those, or ++ # .in files, which are from configure. ++ for file in `find * -name "*.[1-9]*" ! -name "*.ex" ! -name "*.in" | grep -v ^debian/$TMP`; do # Make sure file thinks they are man pages. if file $file|grep -q roff; then if echo $file|grep -q /; then @@@ -18,14 -18,14 +21,25 @@@ else NAME=$file fi -- SECTION=man`expr $NAME : '.*\.\([123456789]\)'` -- if [ ! -e debian/tmp/usr/man/$SECTION/$NAME -a \ -- ! -e debian/tmp/usr/X11*/man/$SECTION/$NAME ]; then -- if [ ! -d debian/tmp/usr/man/$SECTION ]; then -- doit "install -d debian/tmp/usr/man/$SECTION" ++ # Look at the command line and check if we should ++ # install the file. ++ install=1 ++ for notinstall in $@; do ++ if [ "$NAME" = "$notinstall" -o \ ++ "$file" = "$notinstall" ]; then ++ install="" ++ fi ++ done ++ if [ "$install" ]; then ++ SECTION=man`expr $NAME : '.*\.\([123456789]\)'` ++ if [ ! -e debian/$TMP/usr/man/$SECTION/$NAME -a \ ++ ! -e debian/$TMP/usr/X11*/man/$SECTION/$NAME ]; then ++ if [ ! -d debian/$TMP/usr/man/$SECTION ]; then ++ doit "install -d debian/$TMP/usr/man/$SECTION" ++ fi ++ doit "install -p -m644 $file debian/$TMP/usr/man/$SECTION/$NAME" fi -- doit "install -p -m644 $file debian/tmp/usr/man/$SECTION/$NAME" fi fi -- fi ++ done done diff --cc dh_installmenu index 26798c2,26798c2..775945a --- a/dh_installmenu +++ b/dh_installmenu @@@ -2,23 -2,23 +2,28 @@@ # # 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 debian/$TMP/usr/lib/menu/$PACKAGE # If debian/menu-method file exists, save it to --# debian/tmp/etc/menu-methods/$PACKAGE ++# debian/$TMP/etc/menu-methods/$PACKAGE PATH=debian:$PATH:/usr/lib/debhelper source dh_lib --if [ -e debian/menu ]; then -- if [ ! -d debian/tmp/usr/lib/menu ]; then -- doit "install -d debian/tmp/usr/lib/menu" ++for PACKAGE in $DH_DOPACKAGES; do ++ TMP=`tmpdir $PACKAGE` ++ EXT=`pkgext $PACKAGE` ++ ++ if [ -e debian/${EXT}menu ]; then ++ if [ ! -d debian/$TMP/usr/lib/menu ]; then ++ doit "install -d debian/$TMP/usr/lib/menu" ++ fi ++ doit "install -p -m644 debian/${EXT}menu debian/$TMP/usr/lib/menu/$PACKAGE" fi -- doit "install -p -m644 debian/menu debian/tmp/usr/lib/menu/$PACKAGE" --fi --if [ -e debian/menu-method ]; then -- if [ ! -d debian/tmp/etc/menu-methods ]; then -- doit "install -d debian/tmp/etc/menu-methods" ++ if [ -e debian/${EXT}menu-method ]; then ++ if [ ! -d debian/$TMP/etc/menu-methods ]; then ++ doit "install -d debian/$TMP/etc/menu-methods" ++ fi ++ doit "install -p debian/${EXT}menu-method debian/$TMP/etc/menu-methods/$PACKAGE" fi -- doit "install -p debian/menu-method debian/tmp/etc/menu-methods/$PACKAGE" --fi ++done diff --cc dh_lib index d926639,d926639..b8562cd --- a/dh_lib +++ b/dh_lib @@@ -1,7 -1,7 +1,8 @@@ # Library functions for debhelper programs. # Run a command, and display the command to stdout if verbose mode is on. --# All commands that edit debian/tmp should be ran via this function. ++# All commands that modifiy files in debian/$TMP should be ran via this ++# function. function doit() { verbose_echo "$1" $1 @@@ -20,20 -20,20 +21,29 @@@ function error() exit 1 } --# Argument processing and global variable initialization is below. ++# Pass it a name of a binary package, it returns the name of the tmp dir to ++# use, for that package, relative to debian/ ++# This is for back-compatability with the debian/tmp tradition. ++function tmpdir() { ++ if [ "$1" = "$MAINPACKAGE" ]; then ++ echo tmp ++ else ++ echo "$PACKAGE" ++ fi ++} --# Get the package name and version from the changelog. --LINE=`head -1 debian/changelog` --PACKAGE=`expr "$LINE" : '\(.*\) (.*)'` --VERSION=`expr "$LINE" : '.* (\(.*\))'` ++# Pass it a name of a binary package, it returns the name to prefix to files ++# in debian for this package. ++function pkgext() { ++ if [ "$1" != "$MAINPACKAGE" ]; then ++ echo "$PACKAGE." ++ fi ++} --# Is this a native Debian package? --if ! expr "$VERSION" : '.*-' >/dev/null; then -- NATIVE=1 --fi ++# Argument processing and global variable initialization is below. # Parse command line. --set -- `getopt v $*` ++set -- `getopt viap: $*` for i; do case "$i" @@@ -42,9 -42,9 +52,81 @@@ DH_VERBOSE=1 shift ;; ++ -i) ++ DH_DOINDEP=1 ++ shift ++ ;; ++ -a) ++ DH_DOARCH=1 ++ shift ++ ;; ++ -p) ++ DH_DOPACKAGES="$DH_DOPACKAGES $2" ++ shift ++ shift ++ ;; --) shift break ;; esac done ++ ++# Get the package version from the changelog. ++LINE=`head -1 debian/changelog` ++VERSION=`expr "$LINE" : '.* (\(.*\))'` ++ ++# Get the name of the main binary package. ++MAINPACKAGE=`grep ^Package: debian/control | cut -d " " -f 2 | head -1` ++ ++# Is this a native Debian package? ++if ! expr "$VERSION" : '.*-' >/dev/null; then ++ NATIVE=1 ++fi ++ ++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 ++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 ++ 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` ++fi diff --cc examples/rules index e6ebf0b,e6ebf0b..b18213c --- a/examples/rules +++ b/examples/rules @@@ -1,6 -1,6 +1,9 @@@ #!/usr/bin/make -f # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. ++# Uncomment this to turn on verbose mode. ++#export DH_VERBOSE=1 ++ build: build-stamp build-stamp: dh_testdir @@@ -11,20 -11,20 +14,20 @@@ clean: dh_testdir dh_testroot -- dh_cleantmp ++ rm -f build-stamp ++ dh_clean # Add here commands to clean up after the build process. #-$(MAKE) distclean -- rm -f build-stamp # Build architecture-independent files here. binary-indep: build -- # We have nothing to do by default. ++# We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build dh_testdir dh_testroot -- dh_cleantmp ++ dh_clean # Add here commands to install the files into debian/tmp #$(MAKE) PREFIX=debian/tmp install dh_installdocs