From 65d6531fbb0aa21a100d77169edd63d49e0718a9 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Mon, 30 Dec 2024 20:11:00 +0000 Subject: [PATCH] Rewrite packaging to use d/ for staging packages and use more debhelper With this change, packages are now staged in debian/ rather than debian/tmp/. This simplifies using debhelper a lot since the debhelper tools assumes debian/ 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. Signed-off-by: Ian Jackson --- 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/, 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.30.2