Bug#758461: [cyrus-sasl2] Allow bootstrapping without Heimdal, PostgreSQL and LDAP

Peter Pentchev roam at ringlet.net
Sun Aug 17 18:44:59 UTC 2014


Source: cyrus-sasl2
Version: 2.1.26.dfsg1-11
Severity: wishlist
Tags: patch

Hi,

Thanks for taking care of cyrus-sasl2 in Debian!

As part of this year's "Bootstrappable Debian" Google Summer of Code
project I took a look at cyrus-sasl2 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/cyrus-sasl2.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.

The problem with cyrus-sasl2 is threefold - there are various build
dependency loops triggered by the Heimdal, PostgreSQL and LDAP support
in the various modules.  So what do you think about the attached patch
that checks for a "stage1" build profile specified in the
DEB_BUILD_PROFILES variable and, if so, builds Cyrus without the LDAP,
SQL and GSSAPI-Heimdal modules?

In this iteration, one would also have to manually remove the offending
build dependencies from the control file; I will file another bug that
makes use of the new <profile.*> restriction and the new Build-Profiles
binary stanza header to make this completely automated.  However, that
would have to wait for the actual introduction of build profile-aware
tools in the Debian archive infrastructure.

If anything should go wrong with the patch, it is also available at
https://gitorious.org/roam-debian-bootstrap/cyrus-sasl2-debian/commits/roam-stage1-build-2

Thanks in advance for your time, and thanks for your work on Debian!

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-2-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
-------------- next part --------------
From 25ebf6788f7899bd5d40c7983cd06168cfbf1ed1 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam at ringlet.net>
Date: Mon, 17 Mar 2014 16:11:51 +0200
Subject: [PATCH] A first try at adding stage1 build support.

In stage 1, remove the heimdal-multidev, libpq-dev and libldap2-dev
build dependencies as outlined in the "feedback arc set" section of
http://bootstrap.debian.net/amd64/

While building, check the DEB_BUILD_PROFILES variable for "stage1" and,
if found, disable the LDAP and SQL plugins and skip just the Heimdal
parts of the GSSAPI-related build.
---
 debian/control |  1 +
 debian/rules   | 55 +++++++++++++++++++++++--------------------------------
 2 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/debian/control b/debian/control
index 37a4dd6..4536f9a 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Priority: standard
 Maintainer: Debian Cyrus SASL Team <pkg-cyrus-sasl2-debian-devel at lists.alioth.debian.org>
 Uploaders: Fabian Fagerholm <fabbe at debian.org>, Roberto C. Sanchez <roberto at connexer.com>, Ond?ej Sur? <ondrej at debian.org>, Adam Conrad <adconrad at 0c3.net>
 Standards-Version: 3.9.5
+# For stage1 builds, remove libpq-dev, heimdal-multidev, and libldap2-dev.
 Build-Depends: debhelper (>= 9),
 	       quilt,
 	       automake (>= 1:1.14),
diff --git a/debian/rules b/debian/rules
index 4404190..39758f3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,33 +29,16 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 # Save Berkeley DB used for building the package
 BDB_VERSION ?= $(shell LC_ALL=C dpkg-query -l 'libdb[45].[0-9]-dev' | grep ^ii | sed -e 's|.*\s\libdb\([45]\.[0-9]\)-dev\s.*|\1|')
 
-# SQL support may be turned off during the build, but is on by default.
-ifeq (,$(findstring no-sql,$(DEB_BUILD_OPTIONS)))
-	CONFIGURE_SQL=--enable-sql
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+CONFIGURE_PROFILE=--enable-sql --with-ldap --enable-ldapdb
+DH_PACKAGE_EXCLUDES=
 else
-	CONFIGURE_SQL=--disable-sql
-	DH_PACKAGE_EXCLUDES += -Nlibsasl2-modules-sql
-endif
+CONFIGURE_PROFILE=--disable-sql --without-ldap --disable-ldapdb
+DH_PACKAGE_EXCLUDES=-Nlibsasl2-modules-sql -Nlibsasl2-modules-ldap \
+		    -Nlibsasl2-modules-gssapi-heimdal -Ncyrus-sasl2-heimdal-dbg
 
-# LDAP support may be turned off during the build, but is on by default.
-ifeq (,$(findstring no-ldap,$(DEB_BUILD_OPTIONS)))
-	CONFIGURE_LDAP=--with-ldap
-	CONFIGURE_LDAPDB=--enable-ldapdb
-else
-	CONFIGURE_LDAP=--without-ldap
-	CONFIGURE_LDAPDB=--disable-ldapdb
-	DH_PACKAGE_EXCLUDES += -Nlibsasl2-modules-ldap
-endif
-
-# GSSAPI support may be turned off during the build, but is on by default
-ifeq (,$(findstring no-gssapi,$(DEB_BUILD_OPTIONS)))
-	CONFIGURE_GSSAPI=--enable-gssapi
-else
-	CONFIGURE_GSSAPI=--disable-gssapi
-	DH_PACKAGE_EXCLUDES += -Nlibsasl2-modules-gssapi-mit \
-		-Nlibsasl2-modules-gssapi-heimdal \
-		-Ncyrus-sasl2-mit-dbg \
-		-Ncyrus-sasl2-heimdal-dbg
+SASL_SKIP_SQL=	1
+SASL_SKIP_HEIMDAL=	1
 endif
 
 CONFIGURE_COMMON_OPTIONS= \
@@ -73,7 +56,7 @@ CONFIGURE_COMMON_OPTIONS= \
 	--disable-srp \
 	--disable-srp-setpass \
 	--disable-krb4 \
-	$(CONFIGURE_GSSAPI) \
+	--enable-gssapi \
 	--enable-gss_mutexes \
 	--enable-auth-sasldb \
 	--enable-plain \
@@ -81,15 +64,13 @@ CONFIGURE_COMMON_OPTIONS= \
 	--enable-login \
 	--enable-ntlm \
 	--disable-passdss \
-	$(CONFIGURE_SQL) \
 	--with-sqlite3=/usr \
 	--with-mysql=/usr \
 	--with-pgsql=/usr/include/postgresql \
-	$(CONFIGURE_LDAPDB) \
 	--disable-macos-framework \
 	--with-pam=/usr \
 	--with-saslauthd=/var/run/saslauthd \
-	$(CONFIGURE_LDAP) \
+	$(CONFIGURE_PROFILE) \
 	--with-configdir=/etc/sasl2:/etc/sasl:/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2:/usr/lib/sasl2 \
 	--with-plugindir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2:/usr/lib/sasl2 \
 	--sysconfdir=/etc \
@@ -98,8 +79,10 @@ CONFIGURE_COMMON_OPTIONS= \
 # Some convenience variables
 export TMPBUILD_MIT := $(CURDIR)/build-mit
 export TMPBUILD_HEIMDAL := $(CURDIR)/build-heimdal
+ifeq (,$(SASL_SKIP_HEIMDAL))
 export HEIMDAL_LDFLAGS := $(shell krb5-config.heimdal --libs gssapi | sed -e 's/ -l.*//')
 export HEIMDAL_CPPFLAGS := $(shell krb5-config.heimdal --cflags gssapi)
+endif
 export TMPPKG_MIT := $(CURDIR)/debian/tmp-mit
 export TMPPKG_HEIMDAL := $(CURDIR)/debian/tmp-heimdal
 
@@ -114,7 +97,7 @@ BUILD_TMP_SUFFIX=.debian-build.tmp
 
 override_dh_auto_clean:
 	dh_auto_clean -B$(TMPBUILD_MIT)
-	dh_auto_clean -B$(TMPBUILD_HEIMDAL)
+	[ ! -d "$(TMPBUILD_HEIMDAL)" ] || dh_auto_clean -B$(TMPBUILD_HEIMDAL)
 
 	rm -f $(CURDIR)/sample/sample-client \
 		$(CURDIR)/sample/sample-server
@@ -139,9 +122,11 @@ override_dh_auto_configure:
 	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -I/usr/include/mit-krb5" \
 	dh_auto_configure -B$(TMPBUILD_MIT) -- $(CONFIGURE_COMMON_OPTIONS) --with-gss_impl=mit
 
+ifeq (,$(SASL_SKIP_HEIMDAL))
 	LDFLAGS="$(LDFLAGS) $(HEIMDAL_LDFLAGS) -Wl,-z,defs" \
 	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) $(HEIMDAL_CPPFLAGS)" \
 	dh_auto_configure -B$(TMPBUILD_HEIMDAL) -- $(CONFIGURE_COMMON_OPTIONS) --with-gss_impl=heimdal
+endif
 
 	# Record the build-time settings for later reference
 	echo 'To build this package, configure was called as follows:' \
@@ -153,7 +138,9 @@ override_dh_auto_configure:
 
 override_dh_auto_build:
 	dh_auto_build -B$(TMPBUILD_MIT) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2
+ifeq (,$(SASL_SKIP_HEIMDAL))
 	dh_auto_build -B$(TMPBUILD_HEIMDAL) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2
+endif
 
 	# Build sample-{client,server}
 	$(MAKE) -f $(CURDIR)/debian/sample/Makefile -C $(CURDIR)/sample T=$(TMPBUILD_MIT)
@@ -168,7 +155,9 @@ override_dh_auto_build:
 
 override_dh_auto_install:
 	dh_auto_install -B$(TMPBUILD_MIT) -- DESTDIR=$(TMPPKG_MIT) sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2
+ifeq (,$(SASL_SKIP_HEIMDAL))
 	dh_auto_install -B$(TMPBUILD_HEIMDAL) -- DESTDIR=$(TMPPKG_HEIMDAL) sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2
+endif
 
 
 	# Note the version of Berkeley DB used to build this package
@@ -195,7 +184,7 @@ override_dh_auto_install:
 	# Alter the rpath of certain binaries and shared libraries.
 	chrpath -d $(TMPPKG_MIT)/usr/sbin/sasldblistusers2 \
 		$(TMPPKG_MIT)/usr/sbin/saslpasswd2
-ifeq (,$(findstring no-sql,$(DEB_BUILD_OPTIONS)))
+ifeq (,$(SASL_SKIP_SQL))
 	chrpath -d $(TMPPKG_MIT)/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2/libsql.so.*.*.*
 endif
 
@@ -218,15 +207,17 @@ endif
 
 override_dh_install:
 	dh_install -s --autodest --list-missing --sourcedir=$(TMPPKG_MIT) -psasl2-bin -plibsasl2-2 -plibsasl2-modules -plibsasl2-modules-db -plibsasl2-modules-ldap -plibsasl2-modules-otp -plibsasl2-modules-sql -plibsasl2-modules-gssapi-mit -plibsasl2-dev -Nlibsasl2-modules-gssapi-heimdal $(DH_PACKAGE_EXCLUDES)
+ifeq (,$(SASL_SKIP_HEIMDAL))
 	dh_install -s --autodest --list-missing --sourcedir=$(TMPPKG_HEIMDAL) -plibsasl2-modules-gssapi-heimdal -Nsasl2-bin -Nlibsasl2-2 -Nlibsasl2-modules -Nlibsasl2-modules-db -Nlibsasl2-modules-ldap -Nlibsasl2-modules-otp -Nlibsasl2-modules-sql -Nlibsasl2-modules-gssapi-mit -Nlibsasl2-dev $(DH_PACKAGE_EXCLUDES)
+endif
 
 override_dh_installinit:
 	dh_installinit $(DH_PACKAGE_EXCLUDES) --name=saslauthd start 20 2 3 4 5 . stop 20 0 1 6 .
 
 override_dh_strip:
 	dh_strip -Xlibgssapiv2.so. -psasl2-bin -plibsasl2-2 -plibsasl2-modules -plibsasl2-modules-db -plibsasl2-modules-ldap -plibsasl2-modules-otp -plibsasl2-modules-sql -plibsasl2-modules-gssapi-mit -plibsasl2-dev -Nlibsasl2-modules-gssapi-heimdal $(DH_PACKAGE_EXCLUDES) --dbg-package=cyrus-sasl2-dbg
-ifeq (,$(findstring no-gssapi,$(DEB_BUILD_OPTIONS)))
 	dh_strip -Xlibgs2.so.3 -Xlibscram.so. -plibsasl2-modules-gssapi-mit --dbg-package=cyrus-sasl2-mit-dbg
+ifeq (,$(SASL_SKIP_HEIMDAL))
 	dh_strip -plibsasl2-modules-gssapi-heimdal -Nsasl2-bin -Nlibsasl2-2 -Nlibsasl2-modules -Nlibsasl2-modules-db -Nlibsasl2-modules-ldap -Nlibsasl2-modules-otp -Nlibsasl2-modules-sql -Nlibsasl2-modules-gssapi-mit -Nlibsasl2-dev --dbg-package=cyrus-sasl2-heimdal-dbg
 endif
 
-- 
2.1.0.rc1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-cyrus-sasl2-debian-devel/attachments/20140817/32af13aa/attachment.sig>


More information about the Pkg-cyrus-sasl2-debian-devel mailing list