Ian Jackson:
Niels Thykier writes ("Bug#1089303: chiark-utils: Supporting rootless builds by 
default"):
I think the attached patch should solve it. Though, please review it
carefully, since I am seeing some surprising delta. Such as
git-branchmove.1 being added to the diff, which I think is a bug in the
original packaging. Additionally 'debian/chiark-backup/conffiles' is
removed, which I do not understand and it looks kind of bad. I have
filtered out both of these in the attached debdiff.

Thanks for the patch.  (I haven't looked at it yet.)

Like with authbind, this might be overdue for a packaging rewrite. Let
me know if you are interested in that.

You are very probably right about it needing a packaging rewrite.  It
really ought to be using dh, although I'm not sure how well that will
fit given how anomalous the upstream parts are.

Ian.


Hi,

I had a look at migrating chiark-utils to `dh`.

The `git format-patch` generated patches (0001-0003) are based on dgit/sid and move the package towards classic debhelper. The first patch will also close this bug as a side effect. Each patch comments on the diffoscope delta relative to be "the before"-state. The baseline was a clean sid rebuild of `dgit/sid` in todays unstable (rather than the archive debs) to remove noise from newer compiler versions since last upload.

The final patch `dh-prototype.diff` is what I envisioned would be the final bit required to move to `dh`. Though for some reason it changes the generated `shlib:*` substvars for `chiark-utils-bin`. It is consistently introduced with that patch (and reverting the patch consistently restores the original behavior) but I see no logic in the `dh` patch that should change the generated substvar, so I am at a loss here. Note that `dh` patch also have delta caused by `dh_dwz` being run. I did not check it for other issues once I spotted the shlib one.

I recommend applying 0001-0003 for now. If you have time to debug `dh-prototype.diff` then it would be great. However, the move to debhelper classic would already be a major step of the way in my book.

Best regards,
Niels

From 8cd8efd9810910e4b34f9a9576dfcb2c673e3ef9 Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Mon, 30 Dec 2024 20:41:45 +0000
Subject: [PATCH 3/3] d/rules: Inline `binary-one` target into its callers

---
 debian/rules | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/debian/rules b/debian/rules
index 1983214..61aabf0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -110,21 +110,14 @@ binary-prep:
 	dh_installexamples
 	dh_compress
 
-
-binary-one:
-	dh_lintian -p$p
-	dh_link -p$p
-	dh_fixperms -p$p
-	chmod u+s,o-x debian/chiark-really/usr/sbin/really
-	dh_installdeb -p$p
-	dh_gencontrol -p$p
-	dh_md5sums -p$p
-	dh_builddeb -p$p
-
-
 binary-indep:	build binary-prep
-	set -e; for p in $(packages_indep); do \
-		debian/rules binary-one p=$$p; done
+	dh_lintian -i
+	dh_link -i
+	dh_fixperms -i
+	dh_installdeb -i
+	dh_gencontrol -i
+	dh_md5sums -i
+	dh_builddeb -i
 
 binary-arch:	build binary-prep
 	$(checkdir)
@@ -143,8 +136,14 @@ binary-arch:	build binary-prep
 		a="$$a -d$$d $$f"; \
 	    done; set -x; \
 	    dh_shlibdeps -p chiark-utils-bin -- $$a
-	set -e; for p in $(packages_arch); \
-		do debian/rules binary-one p=$$p; done
+	dh_lintian -a
+	dh_link -a
+	dh_fixperms -a
+	chmod u+s,o-x debian/chiark-really/usr/sbin/really
+	dh_installdeb -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
 
 define checkdir
 	test -f cprogs/writebuffer.c
-- 
2.45.2

From 2b3fb9789883f329358c36df666d0684bb7383ff Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Mon, 30 Dec 2024 20:11:00 +0000
Subject: [PATCH 2/3] Rewrite packaging to use d/<pkg> for staging packages and
 use more debhelper

With this change, packages are now staged in debian/<pkg> rather than
debian/tmp/<pkg>. This simplifies using debhelper a lot since the
debhelper tools assumes debian/<pkg> by default. The packaging now also
uses a few more debhelper tools for standard handling.

The primary delta from the previous debs with this commits are:

 1) dh_installchangelogs uses native packaging rules without a
    "changelog.Debian.gz" compat symlink. Given the package is
    considered a native package, the loss of the symlink seemed
    acceptable.

 2) dh_installchangelogs trims out very old changelog entries, which
    the original code did not. This delta is to be expected but still
    noisy in the diffoscope delta.

 3) The package now uses dh_compress, which has a different rule
    set for what files to compress. So far, this means more files
    in /usr/share/doc are now compressed.
---
 debian/rules | 105 +++++++++++++++++++++++++++------------------------
 1 file changed, 55 insertions(+), 50 deletions(-)

diff --git a/debian/rules b/debian/rules
index dd17451..1983214 100755
--- a/debian/rules
+++ b/debian/rules
@@ -59,61 +59,67 @@ binary-prep:
 			SYSTEM_GROUP=$$(id -g); \
 	done
 	#
-	mv $t/cprogs $t/chiark-utils-bin
+	mv $t/cprogs $d/chiark-utils-bin
 	#
 	cp -a debian/tmp/fishdescriptor/* debian/tmp/scripts/.
 	cp -a debian/tmp/sync-accounts/* debian/tmp/scripts/.
 	rm -r debian/tmp/sync-accounts
-	mv debian/tmp/scripts debian/tmp/chiark-scripts
-	mv debian/tmp/backup debian/tmp/chiark-backup
-	#
-	set -e; for p in $(packages); do \
-		install -d $t/$$p/DEBIAN $t/$$p/usr/share/doc/$$p; \
-		cp debian/copyright debian/changelog \
-			$t/$$p/usr/share/doc/$$p/; \
-		ln -s changelog.gz \
-			$t/$$p/usr/share/doc/$$p/changelog.Debian.gz; \
-		gzip -9vn $t/$$p/usr/share/doc/$$p/changelog; \
-		done
-	#
-	install -d $t/chiark-rwbuffer/usr/bin
-	install -d $t/chiark-rwbuffer/usr/share/man/man1
-	cd $t/chiark-utils-bin/usr/bin && \
-		mv readbuffer writebuffer $t/chiark-rwbuffer/usr/bin/
-	cd $t/chiark-utils-bin/usr/share/man/man1 && \
-		mv readbuffer.1 writebuffer.1 $t/chiark-rwbuffer/usr/share/man/man1/
-	#
-	install -d $t/chiark-backup/usr/share/man/man1
-	cp backup/man/*.1 $t/chiark-backup/usr/share/man/man1/
-	cd $t/chiark-backup/usr/share/man/man1 && \
+	mv debian/tmp/scripts debian/chiark-scripts
+	mv debian/tmp/backup debian/chiark-backup
+
+	# Move all packages created so far up to debian/<pkg>, where the dh_*
+	# expects to find them now that we are done renaming things.
+	set -e; for p in $(dh_listpackages); do \
+		[ ! -d $t/$$p ] || mv $t/$$p debian/$$p ; \
+	done
+
+	# Last bit of moving things around manually, where the debhelper tools
+	# will not trivially do it (at least, without stuff like `dh-exec`)
+
+	install -d debian/chiark-rwbuffer/usr/bin
+	install -d debian/chiark-rwbuffer/usr/share/man/man1
+	cd debian/chiark-utils-bin/usr/bin && \
+		mv readbuffer writebuffer $d/chiark-rwbuffer/usr/bin/
+	cd debian/chiark-utils-bin/usr/share/man/man1 && \
+		mv readbuffer.1 writebuffer.1 $d/chiark-rwbuffer/usr/share/man/man1/
+
+	install -d debian/chiark-backup/usr/share/man/man1
+	cp backup/man/*.1 debian/chiark-backup/usr/share/man/man1/
+	cd debian/chiark-backup/usr/share/man/man1 && \
 		for m in *.1; do \
 			mv "$$m" backup-"$$m"; \
 		done
 	cp \
- $t/chiark-backup/usr/share/doc/chiark-backup/examples/chiark/settings.sh \
- $t/chiark-backup/etc/chiark-backup/settings.sh
-	#
-	install -d $t/chiark-really/usr/sbin
-	install -d $t/chiark-really/usr/share/man/man8
-	cd $t/chiark-utils-bin/usr/sbin && \
-		mv really $t/chiark-really/usr/sbin/
-	cd $t/chiark-utils-bin/usr/share/man/man8 && \
-		mv really.8 $t/chiark-really/usr/share/man/man8/
-	rm	$t/chiark-utils-bin/usr/sbin/trivsoundd \
-		$t/chiark-utils-bin/usr/share/man/man8/trivsoundd.8
-	rmdir	$t/chiark-utils-bin/usr/sbin
+ debian/chiark-backup/usr/share/doc/chiark-backup/examples/chiark/settings.sh \
+ debian/chiark-backup/etc/chiark-backup/settings.sh
 	#
-	gzip -9fn $t/*/usr/share/man/man*/*
+	install -d debian/chiark-really/usr/sbin
+	install -d debian/chiark-really/usr/share/man/man8
+	cd $d/chiark-utils-bin/usr/sbin && \
+		mv really $d/chiark-really/usr/sbin/
+	cd $d/chiark-utils-bin/usr/share/man/man8 && \
+		mv really.8 $d/chiark-really/usr/share/man/man8/
+	rm	debian/chiark-utils-bin/usr/sbin/trivsoundd \
+		debian/chiark-utils-bin/usr/share/man/man8/trivsoundd.8
+	rmdir	debian/chiark-utils-bin/usr/sbin
+
+
+	dh_installchangelogs
+	dh_installdocs
+	dh_installman
+	dh_installexamples
+	dh_compress
+
 
 binary-one:
-	dh_lintian -p$p -P$t/$p
-	dh_link -p$p -P$t/$p
-	dh_fixperms -p$p -P$t/$p
-	chmod u+s,o-x $t/chiark-really/usr/sbin/really
-	dh_installdeb -p$p -P$t/$p
-	dh_gencontrol -p$p -P$t/$p
-	dh_md5sums -p$p -Pdebian/tmp/$p
-	dh_builddeb -p$p -Pdebian/tmp/$p
+	dh_lintian -p$p
+	dh_link -p$p
+	dh_fixperms -p$p
+	chmod u+s,o-x debian/chiark-really/usr/sbin/really
+	dh_installdeb -p$p
+	dh_gencontrol -p$p
+	dh_md5sums -p$p
+	dh_builddeb -p$p
 
 
 binary-indep:	build binary-prep
@@ -122,12 +128,11 @@ binary-indep:	build binary-prep
 
 binary-arch:	build binary-prep
 	$(checkdir)
-	set -ex; for p in chiark-really chiark-utils-bin chiark-rwbuffer; do \
-		dh_strip -p$$p -Pdebian/tmp/$$p; done
-	dh_shlibdeps -p chiark-rwbuffer -P$t/chiark-rwbuffer
-	dh_shlibdeps -p chiark-really -P$t/chiark-really
+	dh_strip
+	dh_shlibdeps -p chiark-rwbuffer
+	dh_shlibdeps -p chiark-really
 
-	set -e; for f in $t/chiark-utils-bin/usr/bin/*; do \
+	set -e; for f in $d/chiark-utils-bin/usr/bin/*; do \
 		case "$$f" in \
 		*/xbatmon-simple|*/xduplic-copier) \
 					d=Suggests	;; \
@@ -137,7 +142,7 @@ binary-arch:	build binary-prep
 		esac; \
 		a="$$a -d$$d $$f"; \
 	    done; set -x; \
-	    dh_shlibdeps -p chiark-utils-bin -P$t/chiark-utils-bin -- $$a
+	    dh_shlibdeps -p chiark-utils-bin -- $$a
 	set -e; for p in $(packages_arch); \
 		do debian/rules binary-one p=$$p; done
 
-- 
2.45.2

From c6aa90b41c0e31e044c8ff3d221a9a50e774fe75 Mon Sep 17 00:00:00 2001
From: Niels Thykier <[email protected]>
Date: Mon, 30 Dec 2024 19:23:27 +0000
Subject: [PATCH 1/3] Rewrite part of the packaging to use `debhelper` classic

This rewrites `debian/rules` to use `debhelper` more. With this,

 1) The package now builds without requiring root.
 2) The package now produces dbgsym packages
 3) The package now includes the md5sums control member.
 4) The package now uses dh_clean to properly clean up after the
    debhelper commands.

There are no loess of functionality or features in any of the debs.
The only delta to the original debs is that the original debs uses
"non-standard" mode for symlinks (like we saw with authbind). However,
that mode is ignored on unpack, so the delta is irrelevant.

The `debian/chiark-backup/conffiles` file was made obsolete by using
`dh_installdeb`, which generates that content automatically
(admittedly, with a slightly different order, but the order is
semantically irrelevant).

One downside with this approach is that the `binary-one` target has
to restore the setuid mode of `really`, which is a bit awkward in the
current design. Long term is to remove the `binary-one` target, but that
will when the `debian/tmp/$PKG` is rewritten to be `debian/$PKG`, so the
debhelper tools work better out of the box with those directories.

Closes: #1089303
---
 .gitignore                     |  2 ++
 cprogs/Makefile                |  2 +-
 debian/chiark-backup/conffiles |  5 ---
 debian/control                 |  1 +
 debian/rules                   | 62 +++++++++++++++-------------------
 settings.make                  |  7 ++--
 sync-accounts/Makefile         |  7 ++--
 7 files changed, 39 insertions(+), 47 deletions(-)
 delete mode 100644 debian/chiark-backup/conffiles

diff --git a/.gitignore b/.gitignore
index 6eeaa10..077d6ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,5 @@ debian/sv-*
 debian/files
 debian/*.debhelper.log
 debian/*.debhelper
+debian/.debhelper
+debian/*.substvars
diff --git a/cprogs/Makefile b/cprogs/Makefile
index 127c1fc..77c970f 100644
--- a/cprogs/Makefile
+++ b/cprogs/Makefile
@@ -93,7 +93,7 @@ install:		all
 		$(INSTALL_DIRECTORY) $(bindir) $(sbindir)
 		$(INSTALL_PROGRAM) $(PROGRAMS) $(bindir)
 		$(INSTALL_PROGRAM) $(DAEMONS) $(sbindir)
-		$(INSTALL) -m 4774 -o root -g $(SYSTEM_GROUP) \
+		$(INSTALL) -m 4774 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP) \
 			$(SUIDSBINPROGRAMS) $(sbindir)
 
 install-docs:	$(TXTDOCS)
diff --git a/debian/chiark-backup/conffiles b/debian/chiark-backup/conffiles
deleted file mode 100644
index c38afbf..0000000
--- a/debian/chiark-backup/conffiles
+++ /dev/null
@@ -1,5 +0,0 @@
-/etc/chiark-backup/settings.sh
-/etc/chiark-backup/snap/lvm
-/etc/chiark-backup/snap/remount
-/etc/chiark-backup/snap/remountrocp
-/etc/chiark-backup/snap/nosnap
diff --git a/debian/control b/debian/control
index 38c178f..ea1618b 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Priority: optional
 Maintainer: Ian Jackson <[email protected]>
 Build-Depends: libx11-dev, libxmu-dev, nettle-dev, debhelper (>= 13),
                libxdmcp-dev, libxau-dev, libice-dev, libsm-dev, libuv1-dev
+Rules-Requires-Root: no
 Standards-Version: 4.6.1.1
 Vcs-Browser: https://www.chiark.greenend.org.uk/ucgi/~ian/git/chiark-utils.git/
 Vcs-Git: https://www.chiark.greenend.org.uk/ucgi/~ian/githttp/chiark-utils.git
diff --git a/debian/rules b/debian/rules
index 28e5b55..dd17451 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,19 +37,26 @@ clean:
 		$(MAKE) -C $$s -i distclean || \
 		$(MAKE) -C $$s -f Makefile.in distclean; \
 	done
-	rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
-	rm -rf debian/sv-* debian/*.debhelper.log
+	rm -rf debian/sv-*
+	dh_clean
 
 binary-prep:
 	$(checkdir)
 	rm -rf debian/tmp*
+	# The ownership information will be reset later to root:root in
+	# the `dpkg-deb` call, so the actual ownership here is of no
+	# consequence as long as we are allowed to perform the action.
 	#
+	# Chown'ing from your own user/group to itself is always allowed,
+	# so we pass that via id -u/-g.
 	set -e; for s in $(subdirs_build_arch) $(subdirs_nobuild); do \
 		$(MAKE) -C $$s install install-docs install-examples \
 			prefix=$t/$$s/usr \
 			etcdir=$t/$$s/etc \
 			varlib=$t/$$s/var/lib \
-			mandir=$t/$$s/usr/share/man; \
+			mandir=$t/$$s/usr/share/man \
+			SYSTEM_USER=$$(id -u) \
+			SYSTEM_GROUP=$$(id -g); \
 	done
 	#
 	mv $t/cprogs $t/chiark-utils-bin
@@ -98,39 +105,28 @@ binary-prep:
 	#
 	gzip -9fn $t/*/usr/share/man/man*/*
 
-binary-hook-chiark-backup:
-binary-hook-chiark-rwbuffer:
-binary-hook-sync-accounts:
-binary-hook-chiark-scripts:
-binary-hook-chiark-really:
-binary-hook-chiark-utils-bin:
-
 binary-one:
-	set -e; for f in preinst postinst prerm postrm conffiles; do \
-		test -f debian/$p/$$f || continue; \
-		cp debian/$p/$$f $t/$p/DEBIAN/$$f; \
-		chmod u=rwX,go=rX $t/$p/DEBIAN/$$f; \
-	done
-	dh_lintian -p$p -Pdebian/tmp/$p
-	dh_link -p$p -Pdebian/tmp/$p
-	dpkg-gencontrol -p$p -P$t/$p -Tdebian/sv-$p
-	chown -R root.root debian/tmp
-	chmod -R g-ws debian/tmp
-	debian/rules binary-hook-$p
-	dpkg --build $t/$p ..
-
-binary-indep:	checkroot build binary-prep
+	dh_lintian -p$p -P$t/$p
+	dh_link -p$p -P$t/$p
+	dh_fixperms -p$p -P$t/$p
+	chmod u+s,o-x $t/chiark-really/usr/sbin/really
+	dh_installdeb -p$p -P$t/$p
+	dh_gencontrol -p$p -P$t/$p
+	dh_md5sums -p$p -Pdebian/tmp/$p
+	dh_builddeb -p$p -Pdebian/tmp/$p
+
+
+binary-indep:	build binary-prep
 	set -e; for p in $(packages_indep); do \
 		debian/rules binary-one p=$$p; done
 
-binary-arch:	checkroot build binary-prep
+binary-arch:	build binary-prep
 	$(checkdir)
 	set -ex; for p in chiark-really chiark-utils-bin chiark-rwbuffer; do \
 		dh_strip -p$$p -Pdebian/tmp/$$p; done
-	dpkg-shlibdeps -Tdebian/sv-chiark-rwbuffer \
-		$t/chiark-rwbuffer/usr/bin/*
-	dpkg-shlibdeps -Tdebian/sv-chiark-really \
-		$t/chiark-really/usr/sbin/*
+	dh_shlibdeps -p chiark-rwbuffer -P$t/chiark-rwbuffer
+	dh_shlibdeps -p chiark-really -P$t/chiark-really
+
 	set -e; for f in $t/chiark-utils-bin/usr/bin/*; do \
 		case "$$f" in \
 		*/xbatmon-simple|*/xduplic-copier) \
@@ -141,7 +137,7 @@ binary-arch:	checkroot build binary-prep
 		esac; \
 		a="$$a -d$$d $$f"; \
 	    done; set -x; \
-	    dpkg-shlibdeps -Tdebian/sv-chiark-utils-bin $$a
+	    dh_shlibdeps -p chiark-utils-bin -P$t/chiark-utils-bin -- $$a
 	set -e; for p in $(packages_arch); \
 		do debian/rules binary-one p=$$p; done
 
@@ -156,8 +152,4 @@ binary:		binary-indep binary-arch
 source diff:
 	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
 
-checkroot:
-	$(checkdir)
-	test root = "`whoami`"
-
-.PHONY: binary binary-arch binary-indep clean checkroot
+.PHONY: binary binary-arch binary-indep clean
diff --git a/settings.make b/settings.make
index 27969c1..21092d6 100644
--- a/settings.make
+++ b/settings.make
@@ -33,6 +33,7 @@ WARNINGS=	-Wall -Wwrite-strings -Wmissing-prototypes \
 OPTIMISE=	-O2
 DEBUG=		-g
 
+SYSTEM_USER= 	root
 SYSTEM_GROUP=	root
 
 prefix=/usr/local
@@ -56,7 +57,7 @@ man8dir=${mandir}/man8
 # INSTALL_PROGRAM_STRIP_OPT=-s
 
 INSTALL=		install -c
-INSTALL_SHARE=		$(INSTALL) -m 644 -o root -g $(SYSTEM_GROUP)
-INSTALL_SCRIPT=		$(INSTALL) -m 755 -o root -g $(SYSTEM_GROUP)
+INSTALL_SHARE=		$(INSTALL) -m 644 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP)
+INSTALL_SCRIPT=		$(INSTALL) -m 755 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP)
 INSTALL_PROGRAM=	$(INSTALL_SCRIPT) $(INSTALL_PROGRAM_STRIP_OPT)
-INSTALL_DIRECTORY=	$(INSTALL) -m 2755 -o root -g $(SYSTEM_GROUP) -d
+INSTALL_DIRECTORY=	$(INSTALL) -m 2755 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP) -d
diff --git a/sync-accounts/Makefile b/sync-accounts/Makefile
index f9279e2..c4170f4 100644
--- a/sync-accounts/Makefile
+++ b/sync-accounts/Makefile
@@ -19,12 +19,13 @@
 # with this program; if not, consult the Free Software Foundation's
 # website at www.fsf.org, or the GNU Project website at www.gnu.org.
 
+SYSTEM_USER=	root
 SYSTEM_GROUP=	root
 
 INSTALL=		install -c
-INSTALL_SHARE=		$(INSTALL) -m 644 -o root -g $(SYSTEM_GROUP)
-INSTALL_SCRIPT=		$(INSTALL) -m 755 -o root -g $(SYSTEM_GROUP)
-INSTALL_DIRECTORY=	$(INSTALL) -m 2755 -o root -g $(SYSTEM_GROUP) -d
+INSTALL_SHARE=		$(INSTALL) -m 644 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP)
+INSTALL_SCRIPT=		$(INSTALL) -m 755 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP)
+INSTALL_DIRECTORY=	$(INSTALL) -m 2755 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP) -d
 
 prefix=/usr/local
 bindir=$(prefix)/bin
-- 
2.45.2

diff --git a/debian/rules b/debian/rules
index 61aabf0..8c5ab4a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,29 +20,24 @@ makebuildargs := OPTIMISE= DEBUG= \
  CMDLINE_CPPFLAGS="$(shell $(D_BUILDFLAGS) --get CPPFLAGS) -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" \
  CMDLINE_LDFLAGS="$(shell $(D_BUILDFLAGS) --get LDFLAGS)"
 
-build:
-	$(checkdir)
+%:
+	dh $@
+
+override_dh_auto_build:
 	set -e; for s in $(subdirs_build_arch); do \
 		dh_auto_build --sourcedirectory=$$s -- all $(makebuildargs); \
 	done
-	touch build
 
-build-indep: build
-build-arch: build
 
-clean:
-	$(checkdir)
+override_dh_auto_clean:
 	rm -f build
 	set -e; for s in $(subdirs_build_arch); do \
 		$(MAKE) -C $$s -i distclean || \
 		$(MAKE) -C $$s -f Makefile.in distclean; \
 	done
 	rm -rf debian/sv-*
-	dh_clean
 
-binary-prep:
-	$(checkdir)
-	rm -rf debian/tmp*
+override_dh_auto_install:
 	# The ownership information will be reset later to root:root in
 	# the `dpkg-deb` call, so the actual ownership here is of no
 	# consequence as long as we are allowed to perform the action.
@@ -103,25 +98,14 @@ binary-prep:
 		debian/chiark-utils-bin/usr/share/man/man8/trivsoundd.8
 	rmdir	debian/chiark-utils-bin/usr/sbin
 
+	# We are not installing these. To avoid dh_missing complaining,
+	# lets just remove them (Could also be moved to debian/not-installed)
+	rm -fr debian/tmp/fishdescriptor/usr/lib/python2.7
+	rm -fr debian/tmp/fishdescriptor/usr/lib/python3
+	rm -f debian/tmp/fishdescriptor/usr/bin/fishdescriptor
+
 
-	dh_installchangelogs
-	dh_installdocs
-	dh_installman
-	dh_installexamples
-	dh_compress
-
-binary-indep:	build binary-prep
-	dh_lintian -i
-	dh_link -i
-	dh_fixperms -i
-	dh_installdeb -i
-	dh_gencontrol -i
-	dh_md5sums -i
-	dh_builddeb -i
-
-binary-arch:	build binary-prep
-	$(checkdir)
-	dh_strip
+override_dh_shlibdeps:
 	dh_shlibdeps -p chiark-rwbuffer
 	dh_shlibdeps -p chiark-really
 
@@ -136,24 +120,7 @@ binary-arch:	build binary-prep
 		a="$$a -d$$d $$f"; \
 	    done; set -x; \
 	    dh_shlibdeps -p chiark-utils-bin -- $$a
-	dh_lintian -a
-	dh_link -a
-	dh_fixperms -a
-	chmod u+s,o-x debian/chiark-really/usr/sbin/really
-	dh_installdeb -a
-	dh_gencontrol -a
-	dh_md5sums -a
-	dh_builddeb -a
-
-define checkdir
-	test -f cprogs/writebuffer.c
-endef
 
-# Below here is fairly generic really
 
-binary:		binary-indep binary-arch
-
-source diff:
-	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-.PHONY: binary binary-arch binary-indep clean
+execute_after_dh_fixperms:
+	chmod u+s,o-x debian/chiark-really/usr/sbin/really

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to