[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Allow building a subset of flavous in kernel/udeb build



Hi,

When doing kernel packaging bits work I often find it useful to hack the
package to only build a subset of the normal flavours (for speed etc).
However since udeb support was added this has stopped working (example
below for building only the kirkwood flavour on armel). The problem is
that we are still trying to build the udebs for flavours which are not
enabled and hence can't find the files.

The attached patches allow the kernel build to propagate the flavours it
is interested in to the kernel-wedge side of things and therefore avoid
attempting to build the uninteresting udebs.

I tried to make it such that it was a linux packaging only change but
that would seem to involve parsing the package names output by
gen-control in order to determine which are related to the flavours we
are actually building so we can include only those in the udeb_packages
list, which becomes $(PACKAGE_NAMES) in rules.gen. It seemed like it
would be a bit fragile, although I didn't actually build it.

Since this is a developer "feature" I don't think we particularly need
to bump the build deps for it.

Thoughts?

Is it possible that the same issue exists for disabling featuresets? I
didn't look.

Cheers,
Ian.

/usr/bin/make -f debian/rules.real install-udeb_armel ABINAME='3.2.0-1'
ABINAME_PART='-1' ARCH='armel' KERNEL_ARCH='arm'
SOURCEVERSION='3.2.1-2.1local2' UPSTREAMVERSION='3.2' VERSION='3.2'
PACKAGE_NAMES='kernel-image-3.2.0-1-iop32x-di [...dozens...]'
make[2]: Entering directory
`/local/scratch/ianc/devel/debian/linux-2.6-3.2.1'
dh_testdir
dh_prep
kernel-wedge install-files 3.2.0-1
could not find kernel image
at /usr/share/kernel-wedge/commands/install-files line 103, <KVERS> line
2.
make[2]: *** [install-udeb_armel] Error 2
make[2]: Leaving directory
`/local/scratch/ianc/devel/debian/linux-2.6-3.2.1'
make[1]: *** [binary-arch_armel] Error 2
make[1]: Leaving directory
`/local/scratch/ianc/devel/debian/linux-2.6-3.2.1'
make: *** [binary-arch] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary-arch gave error
exit status 2

-- 
Ian Campbell


 Be warned, I have a keyboard I can use to beat luser's heads
          in, and then continue to use... (=:]
 Mercury: Oh, an IBM. :)

diff -u linux-2.6-3.2.1/debian/rules.real linux-2.6-3.2.1/debian/rules.real
--- linux-2.6-3.2.1/debian/rules.real
+++ linux-2.6-3.2.1/debian/rules.real
@@ -467,6 +467,7 @@
 
 install-udeb_$(ARCH): export KW_DEFCONFIG_DIR=debian/installer
 install-udeb_$(ARCH): export KW_CONFIG_DIR=debian/installer/$(ARCH)
+install-udeb_$(ARCH): export KW_FLAVOURS=$(FLAVOURS)
 install-udeb_$(ARCH): DH_OPTIONS=$(PACKAGE_NAMES:%=-p%)
 install-udeb_$(ARCH):
 	dh_testdir
diff -u linux-2.6-3.2.1/debian/bin/gencontrol.py linux-2.6-3.2.1/debian/bin/gencontrol.py
--- linux-2.6-3.2.1/debian/bin/gencontrol.py
+++ linux-2.6-3.2.1/debian/bin/gencontrol.py
@@ -104,12 +104,17 @@
         # Add udebs using kernel-wedge
         installer_def_dir = 'debian/installer'
         installer_arch_dir = os.path.join(installer_def_dir, arch)
+        flavours = []
+        for featureset in self.config['base', arch].get('featuresets', ()):
+            for flavour in self.config['base', arch, featureset]['flavours']:
+                if flavour not in flavours: flavours += [flavour]
         if os.path.isdir(installer_arch_dir):
             kw_env = os.environ.copy()
             kw_env['KW_DEFCONFIG_DIR'] = installer_def_dir
             kw_env['KW_CONFIG_DIR'] = installer_arch_dir
+            kw_env['KW_FLAVOURS'] = ' '.join(flavours)
             kw_proc = subprocess.Popen(
                 ['kernel-wedge', 'gen-control',
                  self.abiname],
                 stdout=subprocess.PIPE,
                 env=kw_env)
@@ -126,9 +132,10 @@
             makefile.add(
                 'binary-arch_%s' % arch,
                 cmds=["$(MAKE) -f debian/rules.real install-udeb_%s %s "
-                        "PACKAGE_NAMES='%s'" %
+                        "PACKAGE_NAMES='%s' FLAVOURS='%s'" %
                         (arch, makeflags,
-                         ' '.join(p['Package'] for p in udeb_packages))])
+                         ' '.join(p['Package'] for p in udeb_packages),
+                         ' '.join(flavours))])
 
     def do_featureset_setup(self, vars, makeflags, arch, featureset, extra):
         config_base = self.config.merge('base', arch, featureset)
diff --git a/commands/gen-control b/commands/gen-control
index afffa2d..9f3b68d 100755
--- a/commands/gen-control
+++ b/commands/gen-control
@@ -13,6 +13,7 @@ my %excluded;
 
 my $defconfigdir = ($ENV{KW_DEFCONFIG_DIR} || '/usr/share/kernel-wedge');
 my $configdir = ($ENV{KW_CONFIG_DIR} || '.');
+my @flavours = split(' ', $ENV{KW_FLAVOURS} || '');
 
 my $fixkernelversion = $ARGV[0];
 
@@ -33,6 +34,8 @@ while (<KVERS>) {
 	if (! length $arch || ! length $kernelversion || ! length $flavour) {
 		die "parse error";
 	}
+	next if ( @flavours && !grep { $_ eq $flavour} @flavours );
+
 	if (defined($fixkernelversion)) {
 		$kernelversion = $fixkernelversion;
 	}
diff --git a/commands/install-files b/commands/install-files
index 039a812..1ff3eed 100755
--- a/commands/install-files
+++ b/commands/install-files
@@ -14,6 +14,7 @@ chomp $hostarch;
 
 my $configdir = ($ENV{KW_CONFIG_DIR} || '.');
 my $fixsourcedir = $ENV{SOURCEDIR};
+my @flavours = split(' ', $ENV{KW_FLAVOURS} || '');
 
 my $fixkernelversion = $ARGV[0];
 
@@ -30,6 +31,7 @@ while (<KVERS>) {
 		die "parse error: $_";
 	}
 	next unless $arch eq $hostarch;
+	next if ( @flavours && !grep { $_ eq $flavour} @flavours );
 
 	if (defined($fixkernelversion)) {
 		$kernelversion = $fixkernelversion;
diff --git a/debian/changelog b/debian/changelog
index f78301b..67402f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,13 @@
 kernel-wedge (2.84) UNRELEASED; urgency=low
 
+  [ Joey Hess ]
   * Removed all the linux module list files. These have moved to the
     linux-2.6 source package (see debian/installer/ there).
     Closes: #651439
 
+  [ Ian Campbell ]
+  * Allow selection of flavours to operate on via KW_FLAVOURS environment var.
+
  -- Joey Hess <joeyh@debian.org>  Thu, 08 Dec 2011 15:16:41 -0400
 
 kernel-wedge (2.83) unstable; urgency=low

Reply to: