2008-07-09  Frederik Schüler <fs@debian.org>

	* debian/rules: Remove the broken udeb creation routines, and redo the
	complete install procedure using debhelper.
	* debian/strace.docs: New file, list for dh_installdocs.
	* debian/strace.examples: New file, list for dh_installexamples.
	* debian/strace.install: New file, list for dh_install.
	* debian/strace-udeb.install: New file, list for dh_install.
	* debian/strace.manpages : New file, list for dh_installmanpages.
	* debian/copyright: Update.
	* debian/control: Fix libc6 build dependency for alpha and ia64.
	(strace-udeb: XC-Package-Type): Add header.
diff --git a/debian/control b/debian/control
index 194e17b..ba6bef2 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@
 Priority: standard
 Maintainer: Roland McGrath <frob@debian.org>
 Uploaders: Frederik Schüler <fs@debian.org>
-Build-Depends: libc6-dev (>= 2.2.2-1) [!alpha !ia64], libc6.1-dev (>= 2.2.2-1) [alpha ia64], gcc-multilib [i386 powerpc s390 sparc], debhelper (>= 5.0.0)
+Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [i386 powerpc s390 sparc], debhelper (>= 5.0.0)
 Standards-Version: 3.8.0
 Homepage: http://sourceforge.net/projects/strace/
 
@@ -22,6 +22,7 @@
 
 Package: strace-udeb
 Section: debian-installer
+XC-Package-Type: udeb
 Priority: extra
 Architecture: alpha amd64 arm armeb armel hppa i386 ia64 m68k mips mipsel powerpc ppc64 s390 sh sparc
 Depends: ${shlibs:Depends}
diff --git a/debian/copyright b/debian/copyright
index f6eeec3..59e7b1b 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,7 +1,7 @@
 This is the Debian packaged version of strace. For a complete list of
 changes from the upstream version please see the changelog.
 
-The upstream sources can be found at http://www.liacs.nl/~wichert/strace/
+The upstream sources can be found at http://sourceforge.net/projects/strace/
 
 This is the copyright as found in the upstream sources:
 
@@ -10,7 +10,10 @@
 Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
 Copyright (c) 1995, 1996 Michael Elizabeth Chastain <mec@duracef.shout.net>
 Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
-Copyright (C) 1998-2001 Wichert Akkerman <wakkerma@deephackmode.org>
+Copyright (C) 1998-2003 Wichert Akkerman <wakkerma@deephackmode.org>
+Copyright (c) 2002-2008 Roland McGrath  <roland@redhat.com>
+Copyright (c) 2003-2008 Dmitry V. Levin <ldv@altlinux.org>
+Copyright (c) 2007-2008 Jan Kratochvil  <jan.kratochvil@redhat.com>
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff --git a/debian/rules b/debian/rules
index 2460f2b..5291840 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,15 +1,11 @@
 #! /usr/bin/make -f
 
-# Debian package information
-package		= strace
+#export DH_VERBOSE=1
 
 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
 
-VERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }')
-UDEB := strace-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb
-
 arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
 ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
   HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
@@ -40,7 +36,7 @@
 
 clean:
 	dh_clean
-	rm -rf debian/$(package) debian/substvars debian/files debian/files~
+	rm -rf debian/strace debian/strace-udeb debian/substvars debian/files debian/files~
 	rm -rf build64 stamp-build64
 	rm -rf build stamp-build
 
@@ -50,55 +46,29 @@
 
 binary-arch: build checkroot
 	test -f stamp-build || make $(MFLAGS) -f debian/rules build
-	-rm -rf debian/$(package) debian/files debian/substvars
-
-	install -d -m 755 -o root -g root debian/$(package)
-	# reset the mode to work around a bug in install
-	chmod 755 debian/$(package)
-	install -d -m 755 -o root -g root debian/$(package)/DEBIAN
-
-# Install strace
-	install -d -o root -g root -m 755 debian/$(package)/usr/bin
-	install -o root -g root -m 755 build/strace \
-		debian/$(package)/usr/bin/strace
-	dh_strip
-
-	dpkg-gencontrol -is -pstrace-udeb -fdebian/files~ -Pdebian/$(package)
-	dh_md5sums
-	dpkg-deb --build debian/$(package) ../$(UDEB)
-	dpkg-distaddfile $(UDEB) debian-installer extra
-
-# Install documentation
-	install -d -o root -g root -m 755 \
-		debian/$(package)/usr/share/doc/$(package)
-	install -d -o root -g root -m 755 debian/$(package)/usr/share/man/man1
-	install -p -o root -g root -m 644 debian/changelog \
- 		debian/$(package)/usr/share/doc/$(package)/changelog.Debian
-	install -p -o root -g root -m 644 TODO \
- 		debian/$(package)/usr/share/doc/$(package)/TODO
-	install -p -o root -g root -m 644 NEWS \
- 		debian/$(package)/usr/share/doc/$(package)/changelog
-	gzip -9 debian/$(package)/usr/share/doc/$(package)/*
-	install -p -o root -g root -m 644 debian/copyright \
- 		debian/$(package)/usr/share/doc/$(package)/copyright
-	install -p -o root -g root -m 644 strace.1 \
-		debian/$(package)/usr/share/man/man1/strace.1
-	gzip -9 debian/$(package)/usr/share/man/man1/strace.1
-	install -d -o root -g root -m 755 \
-		debian/$(package)/usr/share/doc/$(package)/examples
-	install -p -o root -g root -m 755 strace-graph \
-		debian/$(package)/usr/share/doc/$(package)/examples
-
-ifneq (,$(HOST64))
-	install -o root -g root -m 755 build64/strace debian/$(package)/usr/bin/strace64
-	ln -s strace.1.gz debian/$(package)/usr/share/man/man1/strace64.1.gz
-	dh_strip
-endif
-
-	dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
-
-	dpkg-gencontrol -is -pstrace -Pdebian/$(package)
-	dpkg-deb --build debian/$(package) ..
+	dh_testdir -a
+	dh_testroot -a
+	dh_installdirs -a
+	dh_installdocs -a
+	dh_installman -a
+	dh_installexamples -a
+	dh_installchangelogs ChangeLog
+	dh_install -a
+	# install 64bit executable and manpage if it has been built
+	if test -f stamp-build64; then \
+	  mv build64/strace build64/strace64 ; \
+	  dh_install build64/strace64 usr/bin ; \
+	  dh_link usr/share/man/man1/strace.1 usr/share/man/man1/strace64.1; \
+	else : ; fi
+	dh_link -a
+	dh_strip -a
+	dh_compress -a
+	dh_fixperms -a
+	dh_installdeb -a
+	dh_shlibdeps -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
 
 checkroot:
 	test root = "`whoami`"
diff --git a/debian/strace.docs b/debian/strace.docs
new file mode 100644
index 0000000..f62d067
--- /dev/null
+++ b/debian/strace.docs
@@ -0,0 +1,2 @@
+TODO
+NEWS
diff --git a/debian/strace.examples b/debian/strace.examples
new file mode 100644
index 0000000..06b4d96
--- /dev/null
+++ b/debian/strace.examples
@@ -0,0 +1 @@
+strace-graph
diff --git a/debian/strace.install b/debian/strace.install
new file mode 100644
index 0000000..1f41928
--- /dev/null
+++ b/debian/strace.install
@@ -0,0 +1 @@
+build/strace usr/bin
diff --git a/debian/strace.manpages b/debian/strace.manpages
new file mode 100644
index 0000000..5e74dd7
--- /dev/null
+++ b/debian/strace.manpages
@@ -0,0 +1 @@
+strace.1