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

[PATCH] Allow use of foreign linux-headers packages with a native compiler



Currently it is possible and useful to install some foreign linux-image
packages, specifically linux-image-<version>-amd64:amd64 on i386 and
linux-image-<version>-s390x:s390x on s390.  However it is not practical
to install a foreign linux-headers package because it depends a compiler
package which is correctly neither M-A:same nor M-A:foreign.

This would ideally be solved by either:
1. A compiler meta-package for each target architecture that depends on
either the native or cross-compiler (according to its own architecture)
and is M-A:foreign.  The linux-headers packages could then depend on
these.
2. Making the linux-headers packages depend on any compiler package from
one of several specific architectures.

The meta-packages do not exist and cross-architecture dependencies are
not supported by dak or britney.  So for now, introduce our own
meta-packages where we need them.

(Following this, it should be possible to remove the i386/amd64 and
s390/s390x flavours.)

Index: linux/debian/bin/gencontrol.py
===================================================================
--- linux/debian/bin/gencontrol.py	(revision 20735)
+++ linux/debian/bin/gencontrol.py	(working copy)
@@ -21,6 +21,9 @@
         'abi': {
             'ignore-changes': config.SchemaItemList(),
         },
+        'base': {
+            'compiler-multilib-names': config.SchemaItemList(),
+         },
         'build': {
             'debug-info': config.SchemaItemBoolean(),
             'modules': config.SchemaItemBoolean(),
@@ -149,6 +152,12 @@
         self.merge_packages(packages, packages_headers_arch, arch)
 
         cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags]
+        for compiler_multilib in self.config['base',]['compiler-multilib-names']:
+            if arch in self.config['base', 'compiler', compiler_multilib]['arches']:
+                cmds_binary_arch.append(
+                    "$(MAKE) -f debian/rules.real install-dummy"
+                    " DH_OPTIONS='-plinux-compiler-%s-%s' %s" %
+                    (self.version.linux_version, compiler_multilib, makeflags))
         makefile.add('binary-arch_%s_real' % arch, cmds=cmds_binary_arch)
 
         # Shortcut to aid architecture bootstrapping
@@ -326,10 +335,36 @@
         if config_entry_build.get('modules', True):
             makeflags['MODULES'] = True
             package_headers = self.process_package(headers[0], vars)
-            package_headers['Depends'].extend(relations_compiler)
+            compiler_multilib = self.config['base', arch].get('compiler-multilib')
+            if compiler_multilib:
+                # We cannot directly depend on all valid compilers
+                # without specifying package:arch, which is not
+                # supported by dak.  Use an intermediate meta-package.
+                package_headers['Depends'].extend(
+                    PackageRelation('linux-compiler-%s-%s' %
+                                    (self.version.linux_version,
+                                     compiler_multilib)))
+            else:
+                package_headers['Depends'].extend(relations_compiler)
+
             packages_own.append(package_headers)
             extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package'])
 
+        for compiler_multilib in self.config['base',]['compiler-multilib-names']:
+            if arch in self.config['base', 'compiler', compiler_multilib]['arches']:
+                vars['compiler-multilib'] = compiler_multilib
+                vars['compiler-arches'] = ' '.join(
+                    self.config['base', 'compiler', compiler_multilib]['arches'])
+                vars['compiler-desc'] = \
+                    self.config['base', 'compiler', compiler_multilib]['description']
+                package_compiler_meta, = \
+                    self.process_packages(self.templates["control.compiler"],
+                                          vars)
+                # XXX: Should check that the compiler is the same for
+                # all arches building this meta-package.
+                package_compiler_meta['Depends'].extend(relations_compiler)
+                packages.append(package_compiler_meta)
+
         build_debug = config_entry_build.get('debug-info')
 
         if os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'):
Index: linux/debian/changelog
===================================================================
--- linux/debian/changelog	(revision 20735)
+++ linux/debian/changelog	(working copy)
@@ -2,6 +2,10 @@
 
   * New upstream release candidate
 
+  [ Ben Hutchings ]
+  * [x86,s390,s390x] Introduce linux-compiler meta-packages to allow use of
+    foreign linux-headers packages with a native compiler
+
  -- Ben Hutchings <ben@decadent.org.uk>  Fri, 18 Oct 2013 02:06:38 +0100
 
 linux (3.11.5-1) unstable; urgency=low
Index: linux/debian/config/amd64/defines
===================================================================
--- linux/debian/config/amd64/defines	(revision 20735)
+++ linux/debian/config/amd64/defines	(working copy)
@@ -2,6 +2,7 @@
 featuresets:
  none
  rt
+compiler-multilib: x86
 kernel-arch: x86
 
 [build]
Index: linux/debian/config/defines
===================================================================
--- linux/debian/config/defines	(revision 20735)
+++ linux/debian/config/defines	(working copy)
@@ -24,10 +24,26 @@
  sparc64
  x32
 compiler: gcc-4.8
+compiler-multilib-names:
+ s390
+ x86
 featuresets:
  none
  rt
 
+[compiler-s390_base]
+arches:
+ s390
+ s390x
+description: s390/s390x
+
+[compiler-x86_base]
+arches:
+ amd64
+ i386
+ x32
+description: x86
+
 [featureset-rt_base]
 enabled: false
 
Index: linux/debian/config/i386/defines
===================================================================
--- linux/debian/config/i386/defines	(revision 20735)
+++ linux/debian/config/i386/defines	(working copy)
@@ -2,6 +2,7 @@
 featuresets:
  none
  rt
+compiler-multilib: x86
 kernel-arch: x86
 
 [description]
Index: linux/debian/config/s390/defines
===================================================================
--- linux/debian/config/s390/defines	(revision 20737)
+++ linux/debian/config/s390/defines	(working copy)
@@ -1,6 +1,7 @@
 [base]
 flavours:
  s390x
+compiler-multilib: s390
 kernel-arch: s390
 
 [image]
Index: linux/debian/config/s390x/defines
===================================================================
--- linux/debian/config/s390x/defines	(revision 20737)
+++ linux/debian/config/s390x/defines	(working copy)
@@ -1,6 +1,7 @@
 [base]
 flavours:
  s390x
+compiler-multilib: s390
 kernel-arch: s390
 
 [image]
Index: linux/debian/lib/python/debian_linux/config.py
===================================================================
--- linux/debian/lib/python/debian_linux/config.py	(revision 20735)
+++ linux/debian/lib/python/debian_linux/config.py	(working copy)
@@ -174,6 +174,8 @@
             for section in iter(config):
                 if section[0].startswith('featureset-'):
                     real = (section[-1], None, section[0][11:])
+                elif section[0].startswith('compiler-'):
+                    real = (section[-1], 'compiler', section[0][9:])
                 else:
                     real = (section[-1],) + section[1:]
                 ret[real] = config[section]
Index: linux/debian/templates/control.compiler.in
===================================================================
--- linux/debian/templates/control.compiler.in	(revision 0)
+++ linux/debian/templates/control.compiler.in	(working copy)
@@ -0,0 +1,7 @@
+Package: linux-compiler-@version@-@compiler-multilib@
+Depends: ${misc:Depends}
+Architecture: @compiler-arches@
+Multi-Arch: foreign
+Description: Compiler for Linux @version@ on @compiler-desc@ (meta-package)
+ This package depends on the appropriate compiler version for Linux @version@
+ on @compiler-desc@.

-- 
Ben Hutchings
Teamwork is essential - it allows you to blame someone else.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: