Source: krb5
Version: 1.12.1+dfsg-3
Severity: wishlist
Tags: patch

Hi,

First of all, thanks for taking care of MIT Kerberos in Debian!

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

With krb5 all of this may be achieved by building without LDAP support
in the "stage1" build profile and thus dropping the libldap2-dev build
dependency.  Attached is a patch that implements the first part - it
checks for "stage1" in the DEB_BUILD_PROFILES environment variable and
omits the LDAP pieces of the build and the krb5-kdc-ldap binary package.
This still means that the build dependency must be removed by hand in
such builds; I will file a separate bug that adds build profile
annotations to the control file, but it will have to wait until the
Debian archive infrastructure actually supports these annotations.  The
modifications in this patch may be made right now and will already help
the bootstrapping effort.

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

Thanks again for your work on MIT Kerberos and on 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  r...@ringlet.net r...@freebsd.org p.penc...@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
From 67ca225a9bfff9a6e970993ea5af678664d1d602 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@ringlet.net>
Date: Mon, 17 Mar 2014 17:12:17 +0200
Subject: [PATCH] A first try at adding stage1 support.

In stage 1, remove the libldap2-dev build dependency 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 functionality and skip the LDAP-related parts
of the build and installation.
---
 debian/control |  1 +
 debian/rules   | 73 ++++++++++++++++++++++++++++++++++++----------------------
 2 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/debian/control b/debian/control
index aacaa8e..e94b26b 100644
--- a/debian/control
+++ b/debian/control
@@ -1,6 +1,7 @@
 Source: krb5
 Section: net
 Priority: standard
+# For stage1 builds, remove the libldap2-dev dependency.
 Build-Depends: debhelper (>= 8.1.3), byacc | bison,
  comerr-dev, docbook-to-man, doxygen,
  libkeyutils-dev [linux-any], libldap2-dev,
diff --git a/debian/rules b/debian/rules
index ca517fc..49ebb20 100755
--- a/debian/rules
+++ b/debian/rules
@@ -51,6 +51,19 @@ EXCLUDE = -Xtmac.doc -Xexamples/krb5 -Xgnats/mit 
-Xkrb5-send-pr \
 LIB_PACKAGES = libkrb5-3 libgssapi-krb5-2 libkadm5clnt-mit9 libkadm5srv-mit9 
libkdb5-7 libgssrpc4  \
        libkrb5support0  libk5crypto3 libkrad0
 
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+DH_EXCLUDE=
+else
+KRB5_SKIP_LDAP=        1
+DH_EXCLUDE=    -Nkrb5-kdc-ldap
+endif
+
+ifeq (,$(KRB5_SKIP_LDAP))
+CONFIGURE_LDAP=        --with-ldap
+else
+CONFIGURE_LDAP=        --without-ldap
+endif
+
 # We touch each configure and Autoconf-related file so that we do not attempt
 # to use Autoconf.  The cache is used by the Embdebian project for cross
 # compiles.
@@ -66,7 +79,7 @@ configure-stamp:
        cd build && $(FLAGS) ../src/configure  \
                --prefix=/usr --localstatedir=/etc --mandir=/usr/share/man \
                --with-system-et --with-system-ss --disable-rpath  \
-               --enable-shared --with-ldap --without-tcl \
+               --enable-shared $(CONFIGURE_LDAP) --without-tcl \
        --with-system-verto \
                --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
                --sysconfdir=/etc \
@@ -114,11 +127,15 @@ install: build-arch
 
        cd build && $(MAKE) install DESTDIR=`pwd`/../debian/tmp
        install -d $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/krb5 
$(CURDIR)/debian/tmp/etc/insserv/overrides
+ifeq (,$(KRB5_SKIP_LDAP))
        install -m644 debian/krb5-kdc-ldap.insserv-override 
debian/tmp/etc/insserv/overrides/krb5-kdc
-       install -m644 $(CURDIR)/debian/README.mech.d 
$(CURDIR)/debian/libgssapi-krb5-2/etc/gss/mech.d/README
        mv $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libkdb_ldap* \
            $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/krb5/
        rm -f 
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/krb5/libkdb_ldap*.so
+else
+       rm -f $(CURDIR)/debian/tmp/usr/share/man/man8/kdb5_ldap_util.8
+endif
+       install -m644 $(CURDIR)/debian/README.mech.d 
$(CURDIR)/debian/libgssapi-krb5-2/etc/gss/mech.d/README
        mv $(CURDIR)/debian/tmp/usr/bin/krb5-config \
            $(CURDIR)/debian/tmp/usr/bin/krb5-config.mit
        mv $(CURDIR)/debian/tmp/usr/share/man/man1/krb5-config.1 \
@@ -127,7 +144,7 @@ install: build-arch
        install -m644 src/util/ac_check_krb5.m4 \
                debian/libkrb5-dev/usr/share/aclocal
 
-       dh_install --sourcedir=debian/tmp --fail-missing $(EXCLUDE)
+       dh_install --sourcedir=debian/tmp --fail-missing $(EXCLUDE) 
$(DH_EXCLUDE)
        set -e ; find 
debian/krb5-multidev/usr/lib/$(DEB_HOST_MULTIARCH)/mit-krb5 -type l -name \*.so 
-print |\
                while read linkname; do \
                ln -s -f ../`readlink $$linkname` \
@@ -161,17 +178,17 @@ binary-indep: DH_OPTIONS=-i
 binary-indep: build-indep  install
        dh_testdir
        dh_testroot
-       dh_installchangelogs  -Xdoc/CHANGES
-       dh_installchangelogs -pkrb5-doc -k doc/CHANGES
-       dh_installdocs
-       dh_installinfo
-       dh_link
-       dh_compress
-       dh_fixperms
-       dh_installdeb
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
+       dh_installchangelogs  -Xdoc/CHANGES $(DH_EXCLUDE)
+       dh_installchangelogs -pkrb5-doc -k $(DH_EXCLUDE) doc/CHANGES
+       dh_installdocs $(DH_EXCLUDE)
+       dh_installinfo $(DH_EXCLUDE)
+       dh_link $(DH_EXCLUDE)
+       dh_compress $(DH_EXCLUDE)
+       dh_fixperms $(DH_EXCLUDE)
+       dh_installdeb $(DH_EXCLUDE)
+       dh_gencontrol $(DH_EXCLUDE)
+       dh_md5sums $(DH_EXCLUDE)
+       dh_builddeb $(DH_EXCLUDE)
 
 # Build architecture-dependent files here.
 # Pass -a to all debhelper commands in this target to reduce clutter.  Strip
@@ -183,27 +200,27 @@ binary-arch: DH_OPTIONS=-a
 binary-arch: build-arch install
        dh_testdir
        dh_testroot
-       dh_installchangelogs  -Xdoc/CHANGES
-       dh_installdocs
-       dh_installdebconf
-       dh_installinit -- defaults 18 18
-       dh_lintian
+       dh_installchangelogs  -Xdoc/CHANGES $(DH_EXCLUDE)
+       dh_installdocs $(DH_EXCLUDE)
+       dh_installdebconf $(DH_EXCLUDE)
+       dh_installinit $(DH_EXCLUDE) -- defaults 18 18
+       dh_lintian $(DH_EXCLUDE)
        set -e ; for pkg in $(LIB_PACKAGES) ; do \
                DH_OPTIONS="" dh_strip -p$$pkg --dbg-package=libkrb5-dbg; \
                DH_OPTIONS="" dh_makeshlibs -p$$pkg 
-Xusr/lib/$(DEB_HOST_MULTIARCH)/krb5/plugins -- -c4 ; \
        done
-       dh_strip
-       dh_link
-       dh_compress
-       dh_fixperms
+       dh_strip $(DH_EXCLUDE)
+       dh_link $(DH_EXCLUDE)
+       dh_compress $(DH_EXCLUDE)
+       dh_fixperms $(DH_EXCLUDE)
        chmod u+s debian/krb5-user/usr/bin/ksu
        chmod 700 debian/krb5-kdc/var/lib/krb5kdc
        chmod 700 debian/krb5-kdc/etc/krb5kdc
-       dh_installdeb
-       dh_shlibdeps
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
+       dh_installdeb $(DH_EXCLUDE)
+       dh_shlibdeps $(DH_EXCLUDE)
+       dh_gencontrol $(DH_EXCLUDE)
+       dh_md5sums $(DH_EXCLUDE)
+       dh_builddeb $(DH_EXCLUDE)
 
 binary: binary-indep binary-arch
 .PHONY: build clean configure binary-indep binary-arch binary install
-- 
2.0.0

Attachment: signature.asc
Description: Digital signature

Reply via email to