Source: mpdecimal
Version: 2.4.0-6
Severity: wishlist
Tags: patch

Hi,

First of all, thanks for maintaining mpdecimal in Debian!

As part of this year's "Bootstrappable Debian" Google Summer of Code
project I took a look at it to break a circular build dependency as
noted in the "Feedback Arc Set" section of
http://bootstrap.debian.net/amd64/ and, more specifically, at
http://bootstrap.debian.net/source/python-defaults.html and the
version-specific pages linked from it.  There are two primary goals to
my work on this GSoC project:
- The first goal is to modify some packages so that they may be built in
  some limited way ("nocheck", binary-only, or build profiles like
  "stage1") without some of their usual build dependencies.  In most
  cases this is caused by one or more dependency loops between binary
  and source packages, so that a source package requires for its
  building, directly or indirectly, one of its own binary packages to be
  already built.  The modifications make the source build in a limited
  fashion (not generating documentation, not running tests, not building
  some of the binary packages) so that this may happen with only the
  rest of the build dependencies, so Debian may be bootstrapped on a new
  architecture starting from a very few cross-built toolchain packages
  and then moving along, source package by source package.
- The second goal, which is actually closely related to the first, is
  that in the process of modifications, any changes (some files not
  regenerated, others not built at all) can be made with binary package
  level granularity.  This means that if a binary package is built at
  all during a limited build, then it must have the same contents as the
  same binary package resulting from a full build.  The point here is to
  avoid breakage if other packages in the archive depend on some
  functionality provided by the omitted files; if so, it should be
  obvious that the functionality is missing, and the clearest way to do
  that is by omitting a full binary package or, rather, delaying its
  build until the rest of the build dependencies are present.

What do you think about the attached patch that moves the HTML
documentation to a separate package, makes it architecture-independent
and thus removes the build dependency on sphinx for the
architecture-dependent (binary) builds?  The libmpdec-dev package that
formerly contained the documentation now recommends the new -doc
package, so that in the default "install Recommends automatically"
scenario the documentation will still be available.  This breaks a
circular build dependency through python3-sphinx leading to
libpython3.4-stdlib and libmpdec2.

If something goes wrong with the patch through the mail, my work is
available in a Gitorious repository at
https://gitorious.org/roam-debian-bootstrap/mpdecimal-debian/commits/roam-stage1-indep

Thanks again for your work on mpdecimal and Debian in general!

G'luck,
Peter

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
Peter Pentchev  [email protected] [email protected] [email protected]
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
From e3457c6e0e86fdd7f5995f2b044e7f99fc231084 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <[email protected]>
Date: Tue, 17 Jun 2014 01:07:31 +0300
Subject: [PATCH] Break the docs out into arch:all libmpdec-doc.

Move the HTML documentation into a separate package and only build it if
required.  This takes care of a circular dependency loop as outlined by
the versioned page linked to from
http://bootstrap.debian.net/source/mpdecimal.html -
python3-sphinx python3 libpython3-stdlib libpython3.4-stdlib libmpdec2

Have the libmpdec-dev package recommend the new libmpdec-doc one, so
that it will be installed in the default "always install Recommends"
Debian setup.
---
 debian/control | 14 ++++++++++++--
 debian/rules   | 18 +++++++++++++-----
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/debian/control b/debian/control
index ef15f89..b25ca58 100644
--- a/debian/control
+++ b/debian/control
@@ -3,8 +3,8 @@ Priority: optional
 Maintainer: Matthias Klose <[email protected]>
 Build-Depends: debhelper (>= 8.0.0), autotools-dev,
 # gmp is only used when running the tests from the separate test tarball
- libgmp-dev,
- python-sphinx (>= 1.0.7+dfsg) | python3-sphinx
+ libgmp-dev
+Build-Depends-Indep: python-sphinx (>= 1.0.7+dfsg) | python3-sphinx
 Standards-Version: 3.9.5
 Section: libs
 Homepage: http://www.bytereef.org/mpdecimal/index.html
@@ -14,6 +14,7 @@ Section: libdevel
 Architecture: any
 Multi-Arch: same
 Depends: libmpdec2 (= ${binary:Version}), ${sphinxdoc:Depends}, ${misc:Depends}
+Recommends: libmpdec-doc
 Description: library for decimal floating point arithmetic (development files)
  mpdecimal is a package for correctly-rounded arbitrary precision decimal
  floating point arithmetic.
@@ -29,3 +30,12 @@ Replaces: libmpdec2.3
 Description: library for decimal floating point arithmetic (runtime library)
  mpdecimal is a package for correctly-rounded arbitrary precision decimal
  floating point arithmetic.
+
+Package: libmpdec-doc
+Section: doc
+Architecture: all
+Breaks: libmpdec-dev (<< 2.4.0-7)
+Replaces: libmpdec-dev (<< 2.4.0-7)
+Description: library for decimal floating point arithmetic (documentation)
+ mpdecimal is a package for correctly-rounded arbitrary precision decimal
+ floating point arithmetic.
diff --git a/debian/rules b/debian/rules
index afbc00c..96f03a2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,8 +16,14 @@ ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
 	have_ipa_pure_const_bug=no
 endif
 
+ifneq (,$(shell dpkg-query -W sphinx-common 2>/dev/null || true))
+dh_sphinxdoc = --with sphinxdoc
+else
+dh_sphinxdoc =
+endif
+
 %:
-	dh $@ --parallel --buildsystem=autoconf --with sphinxdoc
+	dh $@ --parallel --buildsystem=autoconf $(dh_sphinxdoc)
 
 # work around debhelper, v9 overwrites CFLAGS in the build :-/
 
@@ -49,11 +55,13 @@ override_dh_auto_install:
 	dh_auto_install
 	ln -sf libmpdec.so.2 debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libmpdec.so
 
+ifneq (,$(filter libmpdec-doc, $(shell dh_listpackages)))
 override_dh_sphinxdoc:
 	cp -a debian/tmp/usr/share/doc/mpdecimal/* \
-		debian/libmpdec-dev/usr/share/doc/libmpdec-dev
-	rm -f debian/libmpdec-dev/usr/share/doc/libmpdec-dev/LICENSE*
-	rm -f debian/libmpdec-dev/usr/share/doc/libmpdec-dev/INSTALL*
+		debian/libmpdec-doc/usr/share/doc/libmpdec-doc
+	rm -f debian/libmpdec-doc/usr/share/doc/libmpdec-doc/LICENSE*
+	rm -f debian/libmpdec-doc/usr/share/doc/libmpdec-doc/INSTALL*
 	cp -p /usr/share/javascript/sphinxdoc/1.0/{doctools,jquery,searchtools,sidebar,underscore}.js \
-		debian/libmpdec-dev/usr/share/doc/libmpdec-dev/_static/.
+		debian/libmpdec-doc/usr/share/doc/libmpdec-doc/_static/.
 	dh_sphinxdoc
+endif
-- 
2.0.0

Attachment: signature.asc
Description: Digital signature

Reply via email to