On Sat, 18 Nov 2017 at 18:35:38 +0200, Adrian Bunk wrote:
> On Sat, Nov 18, 2017 at 09:36:58AM +0100, Helmut Grohne wrote:
> >...
> > +override_dh_autoreconf:
> > +   rm -f gtk-doc.make
> > +   gtkdocize
> > +   dh_autoreconf
> >...
> 
> The "rm -f gtk-doc.make" has to be done when cleaning,
> not in autoreconf.

dh_autoreconf_clean is meant to delete whatever was changed by
dh_autoreconf if it is given a script to run instead of autoreconf,
typically either "NOCONFIGURE=1 ./autogen.sh" using upstream's autogen.sh,
or a debian/autogen.sh containing gtkdocize and autoreconf -fi. The man
page briefly mentions this method, and src:flatpak in unstable is an
example of it in use. Is that a valid approach, or is there a reason
why explicitly deleting the file during clean should be preferred?
I'd like to document whichever one is best-practice a bit more clearly.

It looks as though plain gtkdocize replaces gtk-doc.make with a symbolic
link, which dh-autoreconf won't delete (bug filed), breaking the ability
to build twice in a row; so gtkdocize --copy (which works like I expected)
is probably better, at least until/unless dh-autoreconf can be taught
to remove files that were replaced with a symlink. I've changed flatpak
in git to use gtkdocize --copy.

Helmut: similarly, is there a reason that I'm not seeing why explicitly
removing gtk-doc.make before gtkdocize was necessary, or were you only
doing that as a way to be completely sure that the old one wasn't used, or
was it a workaround for gtkdocize turning the plain file into a symlink?

I can confirm that using the same approach as in src:flatpak (but with
gtkdocize --copy) makes libidn2 build correctly, producing binaries
that should be functionally identical to what the maintainer uploaded
(diffoscope reports only trivial differences). Patches attached.

Regards,
    smcv
>From 47dce702411c4b4c4c86015b9609f82268282a5e Mon Sep 17 00:00:00 2001
From: Helmut Grohne <hel...@subdivi.de>
Date: Fri, 17 Nov 2017 22:43:07 +0100
Subject: [PATCH 1/4] Fix FTBFS: gtkdocize and add dblatex to Build-Depends.
 (Closes: #881915)

---
 debian/changelog | 7 +++++++
 debian/control   | 3 ++-
 debian/rules     | 5 +++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index c27cd70..607178a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libidn2 (2.0.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS: gtkdocize and add dblatex to Build-Depends. (Closes: #881915)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 17 Nov 2017 22:43:07 +0100
+
 libidn2 (2.0.4-1) unstable; urgency=medium
 
   * Add myself to Uploaders
diff --git a/debian/control b/debian/control
index b441c4b..2f9e798 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,8 @@ Build-Depends: debhelper (>= 9),
                ruby-ronn,
                texinfo,
                texlive,
-               gtk-doc-tools
+               gtk-doc-tools,
+               dblatex,
 Standards-Version: 4.1.0
 Priority: optional
 Homepage: https://www.gnu.org/software/libidn/#libidn2
diff --git a/debian/rules b/debian/rules
index 1a6212b..5790fa3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,11 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 %:
 	dh $@ --parallel --with autoreconf --fail-missing -O--dbgsym-migration="libidn2-0-dbg (<< 2.0.2-1~)" -X.la
 
+override_dh_autoreconf:
+	rm -f gtk-doc.make
+	gtkdocize
+	dh_autoreconf
+
 override_dh_auto_configure:
 	dh_auto_configure -- \
 		--enable-ld-version-script \
-- 
2.15.0

>From e1e70e45ec8d8ddf929f803b50f624ee5381dc32 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 22 Nov 2017 08:28:00 +0000
Subject: [PATCH 2/4] Run gtkdocize via debian/autogen.sh

This is passed as a parameter to dh_autoreconf, so that the changed
gtk-doc.make will be detected by dh_autoreconf and deleted in
dh_autoreconf_clean.

Use gtkdocize --copy so that it doesn't replace plain files with
symlinks, which dh_autoreconf_clean doesn't currently know how to undo.
---
 debian/autogen.sh | 4 ++++
 debian/changelog  | 9 +++++++++
 debian/rules      | 4 +---
 3 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100755 debian/autogen.sh

diff --git a/debian/autogen.sh b/debian/autogen.sh
new file mode 100755
index 0000000..38ef0ff
--- /dev/null
+++ b/debian/autogen.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+gtkdocize --copy
+autoreconf -fi
diff --git a/debian/changelog b/debian/changelog
index 607178a..3cf9420 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,17 @@
 libidn2 (2.0.4-1.1) UNRELEASED; urgency=medium
 
   * Non-maintainer upload.
+
+  [ Helmut Grohne ]
   * Fix FTBFS: gtkdocize and add dblatex to Build-Depends. (Closes: #881915)
 
+  [ Simon McVittie ]
+  * Run gtkdocize via a script debian/autogen.sh passed as a parameter
+    to dh_autoreconf, so that the changed gtk-doc.make will be recorded
+    by dh_autoreconf and deleted by dh_autoreconf_clean
+    - Use gtkdocize --copy to avoid gtk-doc.make becoming a symlink, which
+      dh_autoreconf doesn't currently handle
+
  -- Helmut Grohne <hel...@subdivi.de>  Fri, 17 Nov 2017 22:43:07 +0100
 
 libidn2 (2.0.4-1) unstable; urgency=medium
diff --git a/debian/rules b/debian/rules
index 5790fa3..e013df1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,9 +6,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 	dh $@ --parallel --with autoreconf --fail-missing -O--dbgsym-migration="libidn2-0-dbg (<< 2.0.2-1~)" -X.la
 
 override_dh_autoreconf:
-	rm -f gtk-doc.make
-	gtkdocize
-	dh_autoreconf
+	dh_autoreconf debian/autogen.sh
 
 override_dh_auto_configure:
 	dh_auto_configure -- \
-- 
2.15.0

Reply via email to