]> git.donarmstrong.com Git - debhelper.git/commitdiff
r1: Initial revision
authorjoey <joey>
Tue, 17 Aug 1999 04:12:54 +0000 (04:12 +0000)
committerjoey <joey>
Tue, 17 Aug 1999 04:12:54 +0000 (04:12 +0000)
19 files changed:
TODO [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/rules [new file with mode: 0755]
dh_builddeb [new file with mode: 0755]
dh_clean [new file with mode: 0755]
dh_compress [new file with mode: 0755]
dh_fixperms [new file with mode: 0755]
dh_installchangelogs [new file with mode: 0755]
dh_installdebfiles [new file with mode: 0755]
dh_installdocs [new file with mode: 0755]
dh_installexamples [new file with mode: 0755]
dh_installmanpages [new file with mode: 0755]
dh_installmenu [new file with mode: 0755]
dh_lib [new file with mode: 0644]
dh_testdir [new file with mode: 0755]
dh_testroot [new file with mode: 0755]
examples/rules [new file with mode: 0755]

diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..de0177f
--- /dev/null
+++ b/TODO
@@ -0,0 +1,6 @@
+shared libaries
+.so files of compressed manpages change to symlinks
+multiple binary packages support
+edit package scripts (??)
+add all other functionality of debstd (??)
+documentation
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..87d5263
--- /dev/null
@@ -0,0 +1,6 @@
+debhelper (0.1) experimental; urgency=low
+
+  * First release. This is a snapshot of my work so far, and it not yet
+    ready to replace debstd.
+
+ -- Joey Hess <joeyh@master.debian.org>  Mon, 22 Sep 1997 15:01:25 -0400
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..b934849
--- /dev/null
@@ -0,0 +1,13 @@
+Source: debhelper
+Section: devel
+Priority: optional
+Maintainer: Joey Hess <joeyh@master.debian.org>
+Standards-Version: 2.1.1.0
+
+Package: debhelper
+Architecture: all
+Description: helper programs for debian/rules
+ A collection of programs that can be used in a debian/rules file to
+ automate common tasks. Programs are included to install various files into
+ your package, compress files, fix file permissions, integrate your package
+ with the debian menu system, etc.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..0feed1b
--- /dev/null
@@ -0,0 +1,5 @@
+Debhelper is written by Joey Hess <joeyh@master.debian.org>.
+Parts of the code came from debmake, by Christoph Lameter 
+<clameter@debian.org>.
+
+The copyright of this package is GPL.
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..0806a4d
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/make -f
+# Note that I have to refer to debhelper programs witrh ./, to make sure
+# I run the most current ones.
+
+test_files=dh_lib
+
+build:
+       ./dh_testdir $(test_files)
+
+clean:
+       ./dh_testdir $(test_files)
+       ./dh_testroot
+       ./dh_clean
+
+# Build architecture-dependent files here.
+binary-arch: build
+       # We have nothing to do by default.
+
+# Build architecture-independent files here.
+binary-indep: build
+       ./dh_testdir $(test_files)
+       ./dh_testroot
+       ./dh_clean
+
+       install -d debian/tmp/usr/bin
+       find . -perm +111 -maxdepth 1 -type f \
+               -exec install -p {} debian/tmp/usr/bin \;
+       install -d debian/tmp/usr/lib/debhelper
+       cp dh_lib debian/tmp/usr/lib/debhelper
+
+       ./dh_installdocs TODO
+       ./dh_installexamples examples/*
+#      ./dh_installmenu
+       ./dh_installmanpages
+       ./dh_installchangelogs
+       ./dh_compress
+       ./dh_installdebfiles
+       ./dh_fixperms
+       ./dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
diff --git a/dh_builddeb b/dh_builddeb
new file mode 100755 (executable)
index 0000000..a62e81c
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+#
+# Build the .deb package, assuming all the files are set up in debian/tmp.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+source dh_lib
+doit "dpkg --build debian/tmp .."
diff --git a/dh_clean b/dh_clean
new file mode 100755 (executable)
index 0000000..da2c4b2
--- /dev/null
+++ b/dh_clean
@@ -0,0 +1,16 @@
+#!/bin/sh -e
+#
+# Clean up debian/tmp and other teporary 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*"
+
+# 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 {} \;
diff --git a/dh_compress b/dh_compress
new file mode 100755 (executable)
index 0000000..e1f8ed6
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh -e
+#
+# Compresses files and makes sure that symlinks pointing to the 
+# compressed files get fixed.
+
+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
+
+if [ "$files" ]; then
+       # This is just a cosmetic fix.
+       files=`echo $files | tr "\n" " "`       
+
+       doit "gzip -9 $files" || true
+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"
+       fi
+done
diff --git a/dh_fixperms b/dh_fixperms
new file mode 100755 (executable)
index 0000000..a2fd944
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+#
+# Do some general file permission fixups.
+
+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
+
+# 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 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
diff --git a/dh_installchangelogs b/dh_installchangelogs
new file mode 100755 (executable)
index 0000000..935a87a
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh -e
+#
+# Installs debian/changelog. If another filename is passed to it, installs
+# that file as the upstream changelog.
+#
+# Looks at debian/control to determine if this is a native debian package,
+# if so, the debian changelog is just installed as "changelog", and it is an 
+# error to specify an upstream changelog on the command line.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+source dh_lib
+
+UPSTREAM=$1
+
+if [ "$NATIVE" -a "$UPSTREAM" ]; then
+       error "Cannot specify an upstream changelog for a native package."
+fi
+
+if [ "$NATIVE" ]; then
+       CHANGELOG_NAME=changelog
+else
+       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"
+
+if [ "$UPSTREAM" ]; then
+       doit "install -p -m644 $UPSTREAM debian/tmp/usr/doc/$PACKAGE/changelog"
+fi
diff --git a/dh_installdebfiles b/dh_installdebfiles
new file mode 100755 (executable)
index 0000000..ada8215
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+#
+# Install files from debian/ into the package's DEBIAN directory.
+# Also generates the control file.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+source dh_lib
+
+if [ ! -d debian/tmp/DEBIAN ]; then
+       doit "install -d debian/tmp/DEBIAN"
+fi
+
+# Install executable files.
+for file in postinst preinst prerm postrm; do
+       if [ -f debian/$file ]; then
+               doit "install -p debian/$file 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
+
+# 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
+
+# Generate and install control file.
+doit "dpkg-gencontrol -p$PACKAGE"
diff --git a/dh_installdocs b/dh_installdocs
new file mode 100755 (executable)
index 0000000..9481ec4
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+#
+# Reads debian/docs, and looks at files listed on command line, 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
+
+if [ -e debian/docs ]; then
+       docs=`cat debian/docs | tr "\n" " "`
+fi
+
+for file in $docs $@; do
+       doit "cp -a $file debian/tmp/usr/doc/$PACKAGE/"
+done
+
+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/"
+       fi
+done
diff --git a/dh_installexamples b/dh_installexamples
new file mode 100755 (executable)
index 0000000..7aec26e
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+#
+# Reads debian/examples, installs all files listed there into
+# /usr/doc/$PACKAGE/examples
+
+PATH=debian:$PATH:/usr/lib/debhelper
+source dh_lib
+
+if [ -e debian/examples ]; then
+       examples=`cat debian/examples | tr "\n" " "`
+fi
+
+if [ "$examples" -o $@ ]; 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
diff --git a/dh_installmanpages b/dh_installmanpages
new file mode 100755 (executable)
index 0000000..9dbf1c9
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh -e
+#
+# Automatically find and install man pages.
+# 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
+               # Make sure file thinks they are man pages.
+               if file $file|grep -q roff; then
+                       if echo $file|grep -q /; then
+                               NAME=`expr $file : '.*/\(.*\)'`
+                       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"
+                               fi
+                               doit "install -p -m644 $file debian/tmp/usr/man/$SECTION/$NAME"
+                       fi
+               fi
+       fi
+done
diff --git a/dh_installmenu b/dh_installmenu
new file mode 100755 (executable)
index 0000000..26798c2
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+#
+# Integration with debian menu system:
+#
+# 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
+
+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"
+       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"
+       fi
+       doit "install -p debian/menu-method debian/tmp/etc/menu-methods/$PACKAGE"
+fi
diff --git a/dh_lib b/dh_lib
new file mode 100644 (file)
index 0000000..d926639
--- /dev/null
+++ b/dh_lib
@@ -0,0 +1,50 @@
+# 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.
+function doit() {
+       verbose_echo "$1"
+       $1
+}
+
+# Echo something if the verbose flag is on.
+function verbose_echo() {
+       if [ "$DH_VERBOSE" ]; then
+               echo "  $1"
+       fi
+}
+
+# Echo an error message and exit.
+function error() {
+       echo `basename $0`": $1" >&2
+       exit 1
+}
+
+# Argument processing and global variable initialization is below.
+
+# Get the package name and version from the changelog.
+LINE=`head -1 debian/changelog`
+PACKAGE=`expr "$LINE" : '\(.*\) (.*)'`
+VERSION=`expr "$LINE" : '.* (\(.*\))'`
+
+# Is this a native Debian package?
+if ! expr "$VERSION" : '.*-' >/dev/null; then
+               NATIVE=1
+fi
+
+# Parse command line.
+set -- `getopt v $*` 
+
+for i; do
+       case "$i"
+       in
+               -v)
+                       DH_VERBOSE=1
+                       shift
+                       ;;
+               --)
+                       shift
+                       break
+                       ;;
+       esac
+done
diff --git a/dh_testdir b/dh_testdir
new file mode 100755 (executable)
index 0000000..4d3c700
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh -e
+#
+# 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
+
+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
diff --git a/dh_testroot b/dh_testroot
new file mode 100755 (executable)
index 0000000..fcc9b47
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+#
+# Checks to make sure you are root.
+
+PATH=debian:$PATH:/usr/lib/debhelper
+source dh_lib
+
+if  [ "`whoami`" != root ]; then
+       error "You must run this as root."
+fi
diff --git a/examples/rules b/examples/rules
new file mode 100755 (executable)
index 0000000..e6ebf0b
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+build: build-stamp
+build-stamp:
+       dh_testdir
+       # Add here commands to compile the pacckage.
+       #$(MAKE)
+       touch build-stamp
+
+clean:
+       dh_testdir
+       dh_testroot
+       dh_cleantmp
+       # 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.
+
+# Build architecture-dependent files here.
+binary-arch: build
+       dh_testdir
+       dh_testroot
+       dh_cleantmp
+       # Add here commands to install the files into debian/tmp
+       #$(MAKE) PREFIX=debian/tmp install
+       dh_installdocs
+       dh_installexamples
+       dh_installmenu
+       dh_installmanpages
+       dh_installchangelogs
+       dh_compress
+       dh_installdebfiles
+       dh_fixperms
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary