Package: debhelper Version: 8.0.0 Severity: normal Tags: patch Hi Joey,
The attached patch adds support for the following new sequences: • build-arch • build-indep • install-arch • install-indep These new targets are required to properly support use of Build-Depends-Indep and autobuilding of arch-all packages. (Well, that's the ultimate goal for wheezy; getting tool support for them in tools such as debhelper and cdbs is the first part of that.) Bug #604397 is the policy proposal to make these "must be provided" targets as opposed to the current "may be provided". Getting widespread use of these targets is required before Policy can be changed. dpkg-buildpackage can't realistically be changed to actually use these targets until they are in Policy and using them won't cause widespread breakage. Regarding debhelper conformance to Policy: adding the new targets won't be premature, since they are already specified in Policy, but are optional. The binary sequence is untouched, binary-arch and binary-indep should behave identically as well; the sequence commands are also unchanged, but are logically dependent upon the content of the install-arch/install-indep sequences, which are in turn dependent upon the content of the build-arch/build-indep sequences. The content of these is all the same; the only difference is that link build-arch/build-indep, the -a/-i options are added to DH_INTERNAL_OPTIONS. So there should be absolutely no change in behaviour for existing users. The install-arch and install-indep sequences are not defined in Policy, as for the install sequence. They are provided because they are a logical part of the arch/indep separation (if you're going to build separately, you're probably going to want to install separately too). In addition to the patch, I've attached a sample rules file for schroot in unstable to replace the rules file in the source package. This package was already using build-arch/build-indep and was correctly autobuildable. That's still the case with the attached conversion to use dh (with this patch) in place of a lot of custom rules. It might be useful for testing if you wanted a working example to play with. The only defect in the above testcase is that dh_auto_configure runs configure twice; once for build-arch and once for build-indep. This is not breaking anything, but it's less efficient--the old stamp files took care of this where the debian/*.log files created by dh don't. This is my first use of dh, so I may be overlooking something, and I could always tweak this in the override--I just didn't find time for that yet. Thanks for your consideration, Roger -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (550, 'unstable'), (400, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.36-trunk-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages debhelper depends on: ii binutils 2.20.1-15 The GNU assembler, linker and bina ii dpkg-dev 1.15.8.5 Debian package development tools ii file 5.04-5 Determines file type using "magic" ii html2text 1.3.2a-15 advanced HTML to text converter ii man-db 2.5.7-6 on-line manual pager ii perl 5.10.1-16 Larry Wall's Practical Extraction ii perl-base 5.10.1-16 minimal Perl system ii po-debconf 1.0.16+nmu1 tool for managing templates file t debhelper recommends no packages. Versions of packages debhelper suggests: ii dh-make 0.55 tool that converts source archives -- no debconf information
>From 355bf9d9ae1dcfc41ba035f1fa4c729417680dc3 Mon Sep 17 00:00:00 2001 From: Roger Leigh <rle...@debian.org> Date: Mon, 22 Nov 2010 20:58:20 +0000 Subject: [PATCH] dh: Add support for build-arch, build-indep, install-arch and install-indep sequences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing binary-arch and binary-indep sequences depend upon these new sequences, leading to the following possible orders: binary → install → build binary-arch → install-arch → build-arch binary-indep → install-indep → build-indep This is the logical dependency ordering of the sequences; the actual order is of course in reverse so that build is followed by install and binary. Signed-off-by: Roger Leigh <rle...@debian.org> --- dh | 44 ++++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/dh b/dh index d2771ab..3e014fb 100755 --- a/dh +++ b/dh @@ -16,13 +16,15 @@ B<dh> I<sequence> [B<--with> I<addon>[B<,>I<addon> ...]] [B<--list>] [B<--until> =head1 DESCRIPTION B<dh> runs a sequence of debhelper commands. The supported I<sequence>s -correspond to the targets of a F<debian/rules> file: B<build>, B<clean>, +correspond to the targets of a F<debian/rules> file: B<build-arch>, +B<build-indep>, B<build>, B<clean>, B<install-indep>, B<install-arch>, B<install>, B<binary-arch>, B<binary-indep>, and B<binary>. -Commands in the B<binary-indep> sequence are passed the B<-i> option to ensure -they only work on binary independent packages, and commands in the -B<binary-arch> sequences are passed the B<-a> option to ensure they only work -on architecture dependent packages. +Commands in the B<build-indep>, B<install-indep> and B<binary-indep> +sequences are passed the B<-i> option to ensure they only work on +binary independent packages, and commands in the B<build-arch>, +B<install-arch> and B<binary-arch> sequences are passed the B<-a> +option to ensure they only work on architecture dependent packages. If F<debian/rules> contains a target with a name like B<override_>I<dh_command>, then when it would normally run I<dh_command>, B<dh> will instead call that @@ -322,12 +324,14 @@ $sequences{build} = [qw{ dh_auto_build dh_auto_test }], +$sequences{'build-indep'} = [...@{$sequences{build}}]; +$sequences{'build-arch'} = [...@{$sequences{build}}]; $sequences{clean} = [qw{ dh_testdir dh_auto_clean dh_clean }]; -$sequences{install} = [...@{$sequences{build}}, qw{ +my @i = qw{ dh_testroot dh_prep dh_installdirs @@ -366,20 +370,24 @@ $sequences{install} = [...@{$sequences{build}}, qw{ dh_link dh_compress dh_fixperms -}]; +}; +$sequences{'install'} = [...@{$sequences{build}}, @i]; +$sequences{'install-indep'} = [...@{$sequences{'build-indep'}}, @i]; +$sequences{'install-arch'} = [...@{$sequences{'build-arch'}}, @i]; +my @ba=qw{ + dh_strip + dh_makeshlibs + dh_shlibdeps +}; my @b=qw{ dh_installdeb dh_gencontrol dh_md5sums dh_builddeb }; -$sequences{'binary-indep'} = [...@{$sequences{install}}, @b]; -$sequences{binary} = [...@{$sequences{install}}, qw{ - dh_strip - dh_makeshlibs - dh_shlibdeps -}, @b]; -$sequences{'binary-arch'} = [...@{$sequences{binary}}]; +$sequences{binary} = [...@{$sequences{install}}, @ba, @b]; +$sequences{'binary-indep'} = [...@{$sequences{'install-indep'}}, @b]; +$sequences{'binary-arch'} = [...@{$sequences{'install-arch'}}, @ba, @b]; # Additional command options my %command_opts; @@ -514,14 +522,18 @@ my @packag...@{$dh{dopackages}}; # Get the options to pass to commands in the sequence. # Filter out options intended only for this program. my @options; -if ($sequence eq 'binary-arch') { +if ($sequence eq 'build-arch' || + $sequence eq 'install-arch' || + $sequence eq 'binary-arch') { push @options, "-a"; # as an optimisation, remove from the list any packages # that are not arch dependent my %arch_packages = map { $_ => 1 } getpackages("arch"); @packages = grep { $arch_packages{$_} } @packages; } -elsif ($sequence eq 'binary-indep') { +elsif ($sequence eq 'build-indep' || + $sequence eq 'install-indep' || + $sequence eq 'binary-indep') { push @options, "-i"; # ditto optimisation for arch indep my %indep_packages = map { $_ => 1 } getpackages("indep"); -- 1.7.2.3
#!/usr/bin/make -f DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) ifneq ($(DEB_HOST_ARCH_OS),linux) LVMSNAP_OPTIONS = --disable-lvm-snapshot BTRFSSNAP_OPTIONS = --disable-btrfs-snapshot else LVMSNAP_OPTIONS = --enable-lvm-snapshot BTRFSSNAP_OPTIONS = --enable-btrfs-snapshot endif %: dh $@ --with autotools_dev --builddirectory=debian/build --parallel CFLAGS = -Wall -g ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif AUTO_OPTS = -Bdebian/build --parallel override_dh_auto_configure: dh_auto_configure $(AUTO_OPTS) -- \ --libexecdir=/usr/lib \ --enable-dchroot --enable-dchroot-dsa \ --enable-static --disable-shared \ --with-bash-completion-dir=/etc/bash_completion.d \ $(LVMSNAP_OPTIONS) $(BTRFSSNAP_OPTIONS) \ BTRFS=/sbin/btrfs \ BTRFSCTL=/sbin/btrfsctl \ LVCREATE=/sbin/lvcreate \ LVREMOVE=/sbin/lvremove # Build arch-indep packages only if needed. override_dh_auto_build: ifneq (,$(filter schroot, $(shell dh_listpackages))) $(MAKE) -C debian/build all endif ifneq (,$(filter libsbuild-doc, $(shell dh_listpackages))) $(MAKE) -C debian/build doc endif # Build arch-indep packages only if needed. override_dh_auto_test: ifneq (,$(filter schroot, $(shell dh_listpackages))) dh_auto_test endif # Install arch-indep packages only if needed. override_dh_auto_install: ifneq (,$(filter schroot, $(shell dh_listpackages))) $(MAKE) -C debian/build install DESTDIR=$(CURDIR)/debian/install mkdir -p $(CURDIR)/debian/dchroot/usr/share/lintian/overrides mkdir -p $(CURDIR)/debian/dchroot-dsa/usr/share/lintian/overrides mkdir -p $(CURDIR)/debian/schroot/usr/share/lintian/overrides cp $(CURDIR)/debian/dchroot.lintian-overrides $(CURDIR)/debian/dchroot/usr/share/lintian/overrides/dchroot cp $(CURDIR)/debian/dchroot-dsa.lintian-overrides $(CURDIR)/debian/dchroot-dsa/usr/share/lintian/overrides/dchroot-dsa cp $(CURDIR)/debian/schroot.lintian-overrides $(CURDIR)/debian/schroot/usr/share/lintian/overrides/schroot endif ifneq (,$(filter schroot-common, $(shell dh_listpackages))) $(MAKE) -C debian/build/po install DESTDIR=$(CURDIR)/debian/install endif override_dh_installchangelogs: dh_installchangelogs ChangeLog override_dh_installdocs: dh_installdocs ifneq (,$(filter dchroot, $(shell dh_listpackages))) rm -rf $(CURDIR)/debian/dchroot/usr/share/doc/dchroot ln -sf schroot $(CURDIR)/debian/dchroot/usr/share/doc/dchroot endif ifneq (,$(filter dchroot-dsa, $(shell dh_listpackages))) rm -rf $(CURDIR)/debian/dchroot-dsa/usr/share/doc/dchroot-dsa ln -sf schroot $(CURDIR)/debian/dchroot-dsa/usr/share/doc/dchroot-dsa endif ifneq (,$(filter libsbuild-doc, $(shell dh_listpackages))) find $(CURDIR)/debian/libsbuild-doc/usr/share/doc/libsbuild-doc -name '*.map' -print0 | xargs -0 rm -f find $(CURDIR)/debian/libsbuild-doc/usr/share/doc/libsbuild-doc -name '*.md5' -print0 | xargs -0 rm -f endif override_dh_fixperms: dh_fixperms ifneq (,$(filter dchroot, $(shell dh_listpackages))) chmod 4755 $(CURDIR)/debian/dchroot/usr/bin/dchroot endif ifneq (,$(filter dchroot-dsa, $(shell dh_listpackages))) chmod 4755 $(CURDIR)/debian/dchroot-dsa/usr/bin/dchroot-dsa endif ifneq (,$(filter schroot, $(shell dh_listpackages))) chmod 4755 $(CURDIR)/debian/schroot/usr/bin/schroot endif override_dh_installinit: dh_installinit --no-start --update-rcd-params='start 75 S .' override_dh_strip: dh_strip --dbg-package=schroot-dbg