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

[PATCH v2] 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.)

v2:
- Minimise changes to gencontrol.py and config schema by writing a
  separate template for each multilib set, as suggested by Bastian
  Blank.
- To support this, fix the debian_linux.gencontrol.Gencontrol.do_extra
  method (which should be committed separately).
- Add arm multilib set for armel and armhf.

Index: linux/debian/bin/gencontrol.py
===================================================================
--- linux/debian/bin/gencontrol.py	(revision 20787)
+++ linux/debian/bin/gencontrol.py	(working copy)
@@ -259,7 +259,18 @@
         config_entry_relations = self.config.merge('relations', arch, featureset, flavour)
 
         compiler = config_entry_base.get('compiler', 'gcc')
-        relations_compiler = PackageRelation(config_entry_relations[compiler])
+
+        # linux-headers packages may depend on an intermediate
+        # meta-package, rather than directly on the compiler we use
+        # at build time.
+        if config_entry_relations.get('headers%' + compiler):
+            relations_compiler_headers = PackageRelation(
+                self.substitute(
+                    config_entry_relations['headers%' + compiler], vars))
+        else:
+            relations_compiler_headers = PackageRelation(
+                config_entry_relations[compiler])
+
         relations_compiler_build_dep = PackageRelation(config_entry_relations[compiler])
         for group in relations_compiler_build_dep:
             for item in group:
@@ -330,7 +341,7 @@
         if config_entry_build.get('modules', True):
             makeflags['MODULES'] = True
             package_headers = self.process_package(headers[0], vars)
-            package_headers['Depends'].extend(relations_compiler)
+            package_headers['Depends'].extend(relations_compiler_headers)
             packages_own.append(package_headers)
             extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package'])
 
Index: linux/debian/changelog
===================================================================
--- linux/debian/changelog	(revision 20787)
+++ linux/debian/changelog	(working copy)
@@ -8,6 +8,8 @@
     - mmap() holds a reference to the union file as well as the branch file
   * [armel/{iop32x,ixp4xx}] Disable BPG_JIT, MEMCG, USER_NS to reduce kernel
     size
+  * [arm,x86,s390,s390x] Introduce linux-compiler meta-packages to allow use
+    of foreign linux-headers packages with a native multilib compiler
 
   [ Thorsten Glaser ]
   * Update m68k config (Closes: #728392):
Index: linux/debian/config/amd64/defines
===================================================================
--- linux/debian/config/amd64/defines	(revision 20786)
+++ linux/debian/config/amd64/defines	(working copy)
@@ -11,6 +11,9 @@
 bootloaders: grub-pc extlinux lilo
 configs:
 
+[relations]
+headers%gcc-4.8: linux-compiler-@version@-x86
+
 [amd64_description]
 hardware: 64-bit PCs
 hardware-long: PCs with AMD64, Intel 64 or VIA Nano processors
Index: linux/debian/config/armel/defines
===================================================================
--- linux/debian/config/armel/defines	(revision 20786)
+++ linux/debian/config/armel/defines	(working copy)
@@ -11,6 +11,9 @@
 [image]
 suggests: fdutils
 
+[relations]
+headers%gcc-4.8: linux-compiler-@version@-arm
+
 [iop32x_build]
 image-file: arch/arm/boot/zImage
 
Index: linux/debian/config/armhf/defines
===================================================================
--- linux/debian/config/armhf/defines	(revision 20786)
+++ linux/debian/config/armhf/defines	(working copy)
@@ -10,6 +10,9 @@
  armel/config
  armhf/config
 
+[relations]
+headers%gcc-4.8: linux-compiler-@version@-arm
+
 [armmp_build]
 image-file: arch/arm/boot/zImage
 
Index: linux/debian/config/i386/defines
===================================================================
--- linux/debian/config/i386/defines	(revision 20786)
+++ linux/debian/config/i386/defines	(working copy)
@@ -14,6 +14,9 @@
 bootloaders: grub-pc extlinux lilo
 configs:
 
+[relations]
+headers%gcc-4.8: linux-compiler-@version@-x86
+
 [486_description]
 hardware: older PCs
 hardware-long: PCs with a single processor not supporting PAE
Index: linux/debian/config/s390/defines
===================================================================
--- linux/debian/config/s390/defines	(revision 20786)
+++ linux/debian/config/s390/defines	(working copy)
@@ -7,6 +7,9 @@
 bootloaders: s390-tools
 configs: s390x/config
 
+[relations]
+headers%gcc-4.8: linux-compiler-@version@-s390
+
 [s390x_build]
 debug-info: true
 
Index: linux/debian/config/s390x/defines
===================================================================
--- linux/debian/config/s390x/defines	(revision 20786)
+++ linux/debian/config/s390x/defines	(working copy)
@@ -6,6 +6,9 @@
 [image]
 bootloaders: s390-tools
 
+[relations]
+headers%gcc-4.8: linux-compiler-@version@-s390
+
 [s390x_build]
 debug-info: true
 
Index: linux/debian/lib/python/debian_linux/gencontrol.py
===================================================================
--- linux/debian/lib/python/debian_linux/gencontrol.py	(revision 20786)
+++ linux/debian/lib/python/debian_linux/gencontrol.py	(working copy)
@@ -129,9 +129,10 @@
         if templates_extra is None:
             return
 
-        packages.extend(self.process_packages(templates_extra, {}))
+        packages_extra = self.process_packages(templates_extra, self.vars)
+        packages.extend(packages_extra)
         extra_arches = {}
-        for package in templates_extra:
+        for package in packages_extra:
             arches = package['Architecture']
             for arch in arches:
                 i = extra_arches.get(arch, [])
@@ -142,12 +143,9 @@
         for arch in archs:
             cmds = []
             for i in extra_arches[arch]:
-                tmp = []
-                if 'X-Version-Overwrite-Epoch' in i:
-                        tmp.append("-v1:%s" % self.version['source'])
-                cmds.append("$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='-p%s' GENCONTROL_ARGS='%s'" % (i['Package'], ' '.join(tmp)))
-            makefile.add('binary-arch_%s' % arch['binary-arch_%s_extra' % arch])
-            makefile.add("binary-arch_%s_extra" % arch, cmds=cmds)
+                cmds.append("$(MAKE) -f debian/rules.real install-dummy ARCH='%s' DH_OPTIONS='-p%s'" % (arch, i['Package']))
+            makefile.add('binary-arch_%s' % arch, [u'binary-arch_%s_extra' % arch])
+            makefile.add("binary-arch_%s_extra" % arch, cmds = cmds)
 
     def do_arch(self, packages, makefile, arch, vars, makeflags, extra):
         vars['arch'] = arch
Index: linux/debian/templates/control.extra.in
===================================================================
--- linux/debian/templates/control.extra.in	(revision 0)
+++ linux/debian/templates/control.extra.in	(working copy)
@@ -0,0 +1,23 @@
+Package: linux-compiler-@version@-arm
+Depends: gcc-4.8, ${misc:Depends}
+Architecture: armel armhf
+Multi-Arch: foreign
+Description: Compiler for Linux @version@ on ARM (meta-package)
+ This package depends on the appropriate compiler version for Linux @version@
+ on ARM.
+
+Package: linux-compiler-@version@-s390
+Depends: gcc-4.8, ${misc:Depends}
+Architecture: s390 s390x
+Multi-Arch: foreign
+Description: Compiler for Linux @version@ on IBM zSeries (meta-package)
+ This package depends on the appropriate compiler version for Linux @version@
+ on zSeries.
+
+Package: linux-compiler-@version@-x86
+Depends: gcc-4.8, ${misc:Depends}
+Architecture: amd64 i386 x32
+Multi-Arch: foreign
+Description: Compiler for Linux @version@ on x86 (meta-package)
+ This package depends on the appropriate compiler version for Linux @version@
+ on x86.

-- 
Ben Hutchings
I haven't lost my mind; it's backed up on tape somewhere.

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


Reply to: