Bug#1018979: haskell-devscripts: patch to not build docs during binary-arch build

2022-09-03 Thread Steve Langasek
Package: haskell-devscripts
Version: 0.16.27
Followup-For: Bug #1018979
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch
Control: tags -1 patch

The previous patch, tragically, generates empty packages.  Please find
attached a corrected patch which doesn't try to copy the package contents
from a non-existent directory.

-- 
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/
slanga...@ubuntu.com vor...@debian.org
diff -Nru haskell-devscripts-0.16.27/hlibrary.mk 
haskell-devscripts-0.16.27ubuntu3/hlibrary.mk
--- haskell-devscripts-0.16.27/hlibrary.mk  2022-07-29 14:16:53.0 
-0700
+++ haskell-devscripts-0.16.27ubuntu3/hlibrary.mk   2022-09-02 
13:47:46.0 -0700
@@ -112,8 +112,6 @@
 endif
 endif
 
-DEB_BUILD_DEPENDENCIES = build-arch
-
 # We call the shell for most things, so make our variables available to it
 export DEB_SETUP_BIN_NAME
 export CABAL_PACKAGE
@@ -175,13 +173,20 @@
 
 build/%-doc:: build-haddock-stamp
 
-# FIXME: For now, we have a single install recipe, which means we have
-# to build both arch and indep (haddock) artifacts, even if we need only
-# one of them. We should split the install recipe into two.
-debian/tmp-inst-%: $(DEB_SETUP_BIN_NAME) check-ghc-stamp build-haddock-stamp
+install-%-base::
perl -d:Confess -MDebian::Debhelper::Buildsystem::Haskell::Recipes=/.*/ 
\
-   -E 'install_recipe($$ARGV[0])' "$@"
-   ln --symbolic --force "$@" debian/tmp
+   -E 'install_recipe($$ARGV[0])' "$(patsubst 
install-%-base,debian/tmp-inst-%,$@)"
+   ln --symbolic --force "$(patsubst install-%-base,debian/tmp-inst-%,$@)" 
debian/tmp
+
+install-%-arch: $(DEB_SETUP_BIN_NAME) check-ghc-stamp install-%-base
+   :
+
+# FIXME: the install_recipe doesn't work for indep-only builds, so our
+# indep target depends on the arch target for now.
+install-%-indep: $(DEB_SETUP_BIN_NAME) check-ghc-stamp build-haddock-stamp 
install-%-base
+   :
+
+debian/tmp-inst-%:: $(DEB_SETUP_BIN_NAME) check-ghc-stamp build-haddock-stamp 
install-%-base
 
 dist-hugs: $(DEB_SETUP_BIN_NAME)
$(DEB_SETUP_BIN_NAME) configure --hugs --prefix=/usr -v2 \
@@ -190,47 +195,47 @@
 build/libhugs-$(CABAL_PACKAGE):: dist-hugs
$(DEB_SETUP_BIN_NAME) build --builddir=dist-hugs
 
-install/libghc-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghc
+install/libghc-$(CABAL_PACKAGE)-dev:: install-ghc-arch
dh_haskell_install_ghc_registration --package=$(notdir $@)
-   dh_haskell_install_development_libs --package=$(notdir $@) 
--source-dir="$<"
+   dh_haskell_install_development_libs --package=$(notdir $@) 
--source-dir="debian/tmp-inst-ghc"
dh_haskell_provides_ghc --package=$(notdir $@)
dh_haskell_depends_cabal --package=$(notdir $@)
dh_haskell_extra_depends_ghc --package=$(notdir $@)
dh_haskell_shlibdeps --package=$(notdir $@)
dh_haskell_blurbs --package=$(notdir $@) --type=dev
 
-install/libghc-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghc
-   dh_haskell_install_profiling_libs --package=$(notdir $@) 
--source-dir="$<"
+install/libghc-$(CABAL_PACKAGE)-prof:: install-ghc-arch
+   dh_haskell_install_profiling_libs --package=$(notdir $@) 
--source-dir="debian/tmp-inst-ghc"
dh_haskell_provides_ghc --package=$(notdir $@) 
--config-shipper="libghc-$(CABAL_PACKAGE)-dev"
dh_haskell_depends_cabal --package=$(notdir $@) 
--config-shipper="libghc-$(CABAL_PACKAGE)-dev"
dh_haskell_blurbs --package=$(notdir $@) --type=prof
 
-install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc
-   dh_haskell_install_htmldocs --package=$(notdir $@) --source-dir="$<"
-   dh_haskell_install_haddock --package=$(notdir $@) --source-dir="$<"
+install/libghc-$(CABAL_PACKAGE)-doc:: install-ghc-indep
+   dh_haskell_install_htmldocs --package=$(notdir $@) 
--source-dir="debian/tmp-inst-ghc"
+   dh_haskell_install_haddock --package=$(notdir $@) 
--source-dir="debian/tmp-inst-ghc"
dh_haskell_depends_haddock --package=$(notdir $@)
dh_haskell_recommends_documentation_references --package=$(notdir $@)
dh_haskell_suggests --package=$(notdir $@)
dh_haskell_blurbs --package=$(notdir $@) --type=doc
 
-install/libghcjs-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghcjs
+install/libghcjs-$(CABAL_PACKAGE)-dev:: install-ghcjs-arch
dh_haskell_install_ghc_registration --package=$(notdir $@)
-   dh_haskell_install_development_libs --package=$(notdir $@) 
--source-dir="$<"
+   dh_haskell_install_development_libs --package=$(notdir $@) 
--source-dir="debian/tmp-inst-ghcjs"
dh_haskell_provides_ghc --package=$(notdir $@)
dh_haskell_depends_cabal --package=$(notdir $@)
dh_haskell_extra_depends_ghc --package=$(notdir $@)

Bug#1018979: haskell-devscripts: patch to not build docs during binary-arch build

2022-09-02 Thread Steve Langasek
Package: haskell-devscripts
Version: 0.16.27
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch

As discussed on #debian-haskell, several problems with arch-specific package
builds failing during doc generation can be circumvented by not calling
haddock from the binary-arch target.  Attached please find a patch
(imperfect though it is) that refactors some of the hlibrary.mk targets to
allow binary-arch builds to skip the doc generation.

This has been uploaded to Ubuntu, where it will hopefully let pandoc/armhf
complete a build and unblock the ghc transition, rather than failing on an
inactivity timeout on the builders.

-- 
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/
slanga...@ubuntu.com vor...@debian.org
diff -Nru haskell-devscripts-0.16.27ubuntu1/hlibrary.mk 
haskell-devscripts-0.16.27ubuntu2/hlibrary.mk
--- haskell-devscripts-0.16.27ubuntu1/hlibrary.mk   2022-08-22 
14:38:06.0 -0700
+++ haskell-devscripts-0.16.27ubuntu2/hlibrary.mk   2022-09-02 
13:47:46.0 -0700
@@ -114,8 +114,6 @@
 endif
 endif
 
-DEB_BUILD_DEPENDENCIES = build-arch
-
 # We call the shell for most things, so make our variables available to it
 export DEB_SETUP_BIN_NAME
 export CABAL_PACKAGE
@@ -177,13 +175,20 @@
 
 build/%-doc:: build-haddock-stamp
 
-# FIXME: For now, we have a single install recipe, which means we have
-# to build both arch and indep (haddock) artifacts, even if we need only
-# one of them. We should split the install recipe into two.
-debian/tmp-inst-%: $(DEB_SETUP_BIN_NAME) check-ghc-stamp build-haddock-stamp
+install-%-base::
perl -d:Confess -MDebian::Debhelper::Buildsystem::Haskell::Recipes=/.*/ 
\
-   -E 'install_recipe($$ARGV[0])' "$@"
-   ln --symbolic --force "$@" debian/tmp
+   -E 'install_recipe($$ARGV[0])' "$(patsubst 
install-%-base,debian/tmp-inst-%,$@)"
+   ln --symbolic --force "$(patsubst install-%-base,debian/tmp-inst-%,$@)" 
debian/tmp
+
+install-%-arch: $(DEB_SETUP_BIN_NAME) check-ghc-stamp install-%-base
+   :
+
+# FIXME: the install_recipe doesn't work for indep-only builds, so our
+# indep target depends on the arch target for now.
+install-%-indep: $(DEB_SETUP_BIN_NAME) check-ghc-stamp build-haddock-stamp 
install-%-base
+   :
+
+debian/tmp-inst-%:: $(DEB_SETUP_BIN_NAME) check-ghc-stamp build-haddock-stamp 
install-%-base
 
 dist-hugs: $(DEB_SETUP_BIN_NAME)
$(DEB_SETUP_BIN_NAME) configure --hugs --prefix=/usr -v2 \
@@ -192,7 +197,7 @@
 build/libhugs-$(CABAL_PACKAGE):: dist-hugs
$(DEB_SETUP_BIN_NAME) build --builddir=dist-hugs
 
-install/libghc-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghc
+install/libghc-$(CABAL_PACKAGE)-dev:: install-ghc-arch
dh_haskell_install_ghc_registration --package=$(notdir $@)
dh_haskell_install_development_libs --package=$(notdir $@) 
--source-dir="$<"
dh_haskell_provides_ghc --package=$(notdir $@)
@@ -201,13 +206,13 @@
dh_haskell_shlibdeps --package=$(notdir $@)
dh_haskell_blurbs --package=$(notdir $@) --type=dev
 
-install/libghc-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghc
+install/libghc-$(CABAL_PACKAGE)-prof:: install-ghc-arch
dh_haskell_install_profiling_libs --package=$(notdir $@) 
--source-dir="$<"
dh_haskell_provides_ghc --package=$(notdir $@) 
--config-shipper="libghc-$(CABAL_PACKAGE)-dev"
dh_haskell_depends_cabal --package=$(notdir $@) 
--config-shipper="libghc-$(CABAL_PACKAGE)-dev"
dh_haskell_blurbs --package=$(notdir $@) --type=prof
 
-install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc
+install/libghc-$(CABAL_PACKAGE)-doc:: install-ghc-indep
dh_haskell_install_htmldocs --package=$(notdir $@) --source-dir="$<"
dh_haskell_install_haddock --package=$(notdir $@) --source-dir="$<"
dh_haskell_depends_haddock --package=$(notdir $@)
@@ -215,7 +220,7 @@
dh_haskell_suggests --package=$(notdir $@)
dh_haskell_blurbs --package=$(notdir $@) --type=doc
 
-install/libghcjs-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghcjs
+install/libghcjs-$(CABAL_PACKAGE)-dev:: install-ghcjs-arch
dh_haskell_install_ghc_registration --package=$(notdir $@)
dh_haskell_install_development_libs --package=$(notdir $@) 
--source-dir="$<"
dh_haskell_provides_ghc --package=$(notdir $@)
@@ -224,13 +229,13 @@
dh_haskell_shlibdeps --package=$(notdir $@)
dh_haskell_blurbs --package=$(notdir $@) --type=dev
 
-install/libghcjs-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghcjs
+install/libghcjs-$(CABAL_PACKAGE)-prof:: install-ghcjs-arch
dh_haskell_install_profiling_libs --package=$(notdir $@) 
--source-dir="$<"
dh_haskell_provides_ghc --package=$(notdir $@)