Web lists-archives.com

Re: Do we want to Require or Recommend DH




On Tue, May 21, 2019 at 05:46:11AM -0400, Reinhard Tartler wrote:
> On Tue, May 21, 2019, 03:41 Vincent Bernat <bernat@xxxxxxxxxx> wrote:.

> > Is there an example of a package where dh cannot be used? Making 96% of
> > packages simpler and 4% of packages moderately more complex seems to be
> > a good argument to uniformize our packaging practices towards dh.
> > --
> > Use the fundamental control flow constructs.
> >             - The Elements of Programming Style (Kernighan & Plauger)

> I looked yesterday at the boxbackup source package and contemplated
> converting it to dh from debhelper. I decided to not, because I'm having a
> hard time seeing a significant simplification potential. Maybe I'm just not
> seeing it?

> Note that I orphaned the package quite some time ago, so feel welcome to
> simplify it as much as possible on Salsa.

Well, I took a stab at this, but wasted far more time dealing with crlf
nonsense on the vcxproj.user files in the git tree than on the actual
conversion to dh(1).

So here's a patch which shows that even in its most direct form, converting
this package to dh results in a shorter debian/rules which trims a fair
amount of boilerplate.  Further improvements are definitely possible.

Simplifying debian/rules to only need to declare the exceptions, and not the
boilerplate, is always a win.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek@xxxxxxxxxx                                     vorlon@xxxxxxxxxx
commit a5e8d7c7c2b16ade5197c497491cb73e82784c19
Author: Steve Langasek <steve.langasek@xxxxxxxxxxxxx>
Date:   Tue May 21 10:38:49 2019 -0700

    Convert to dh(1).

diff --git a/debian/changelog b/debian/changelog
index 4ff829f4..97e4dca9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+boxbackup (0.13~~git20180819.g2f5b556-2) UNRELEASED; urgency=medium
+
+  * Convert to dh(1).
+
+ -- Steve Langasek <vorlon@xxxxxxxxxx>  Tue, 21 May 2019 10:38:32 -0700
+
 boxbackup (0.13~~git20180819.g2f5b556-1) unstable; urgency=medium
 
   * New upstream pre-release
diff --git a/debian/clean.sh b/debian/clean.sh
index 90a30513..1482640c 100644
--- a/debian/clean.sh
+++ b/debian/clean.sh
@@ -1,8 +1,6 @@
 #!/bin/sh
 
-rm -rf debug/
 rm -rf local/
 rm -rf parcels/
-rm -rf release/
 rm -rf docs/htmlguide/
 rm -rf docs/man/
diff --git a/debian/rules b/debian/rules
index b67b9519..a44d062e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,73 +5,56 @@
 
 include /usr/share/dpkg/pkg-info.mk
 
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
 TMP:=$(CURDIR)/debian/tmp
 
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -g
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-	INSTALL_PROGRAM += -s
-endif
+%:
+	dh $@
 
-configure: configure-stamp
-configure-stamp:
-	dh_testdir
+override_dh_autoreconf:
 	echo "$(DEB_VERSION_UPSTREAM_REVISION)" > VERSION.txt
 	echo "boxbackup" >> VERSION.txt
-	sh -x ./bootstrap
-	./configure $(DEB_EXTRA_CONFIG_FLAGS) LDFLAGS="-Wl,--as-needed"
-	touch configure-stamp
+	dh_autoreconf sh -- -x ./bootstrap
+
+configure: override_dh_autoreconf
+	:
+
+override_dh_auto_configure: configure
+	dh_auto_configure -- LDFLAGS="-Wl,--as-needed"
 
-build-stamp: configure-stamp
-	dh_testdir
-	$(MAKE) V=1
+override_dh_auto_build:
+	dh_auto_build -- V=1
+
+override_dh_auto_test:
 # the testsuite is only really maintained on i386 and amd64
 ifneq (,$(filter $(DEB_HOST_ARCH),i386 amd64))
 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
 	./runtest.pl ALL
 endif
 endif
-	touch build-stamp
 
 docs/docbook/instguide.pdf:
 	$(MAKE) -C docs instguide
 	cd docs/docbook && docbook2pdf instguide.xml
 
-docs/docbook/adminguide.pdf: configure-stamp
+docs/docbook/adminguide.pdf: override_dh_auto_configure
 	$(MAKE) -C docs adminguide
 	cd docs/docbook && docbook2pdf adminguide.xml
 
 docs: docs/docbook/instguide.pdf docs/docbook/adminguide.pdf
 	$(MAKE) -C docs manpages
 
-build-arch: build-stamp
-build-indep: docs
-
-build: build-arch build-indep
+build-arch: docs
 
-clean:
-	dh_testdir
-	dh_testroot
-	dh_clean build-stamp configure-stamp
+override_dh_auto_clean:
 	echo "USE_SVN_VERSION" > VERSION.txt
 	echo "boxbackup" >> VERSION.txt
-	[ ! -f Makefile ] || make clean
-	sh debian/clean.sh
-	dh_clean config.log config.status 
+	dh_auto_clean
 
-install: DH_OPTIONS=
-install: build
-	dh_testdir
-	dh_testroot
-	dh_prep
-	dh_installdirs
+override_dh_clean:
+	sh debian/clean.sh
+	dh_clean
 
+override_dh_install:
 	mkdir -p $(TMP)/etc/logcheck/ignore.d.workstation
 	mkdir -p $(TMP)/etc/logcheck/ignore.d.server
 	install -m 644 debian/boxbackup-server.logcheck.ignore $(TMP)/etc/logcheck/ignore.d.workstation/boxbackup-server
@@ -79,27 +62,5 @@ install: build
 
 	dh_install
 
-binary-indep:
-#  no architecture independant packages are being built
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir -a
-	dh_testroot -a
-	dh_installdebconf -a
-	dh_installdocs -a -A ExceptionCodes.txt docs/docbook/instguide.pdf docs/docbook/adminguide.pdf
-	dh_installinit -a
-	dh_installcron -a
-	dh_installman
-	dh_installchangelogs  -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
-
-binary: binary-arch
-.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install docs
+override_dh_installdocs:
+	dh_installdocs -A ExceptionCodes.txt docs/docbook/instguide.pdf docs/docbook/adminguide.pdf

Attachment: signature.asc
Description: PGP signature