From 3da706e69bf57b923ba235935d74b217f7e6838c Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Fri, 5 Aug 2005 16:38:58 +0000 Subject: [PATCH] * Rewrite gencontrol. * Use debian/arch/defines, debian/arch/$arch/defines, debian/arch/$arch/$subarch/defines and debian/arch/$arch/$subarch/defines.$flavour to gather values. * Remove fdutils from global Suggests. r3646: waldi | 2005-07-31 18:48:39 +0000 * debian/bin/gencontrol.py: Add. * debian/bin/gencontrol: Remove. * debian/rules - Use new gencontrol. - Remove makevars. * debian/templates/control.headers.in * debian/templates/control.headers.subarch.in: Add. * debian/templates/control.image.in: Update. * debian/templates/control.main.in: Remove kernel-tree entry. * debian/templates/control.tree.in: Move kernel-tree entry from control.main.in. * debian/arch/defines, debian/arch/s390/defines, debian/arch/s390/defines.s390, debian/arch/s390/defines.s390x: Add. * debian/arch/s390/desc.s390,debian/arch/s390/desc.s390x: Remove. r3647: waldi | 2005-07-31 18:57:21 +0000 * debian/bin/gencontrol.py: Support desc keyword. r3648: waldi | 2005-07-31 19:06:30 +0000 * debian/arch/alpha/defines, debian/arch/amd64/defines, debian/arch/i386/defines, debian/arch/i386/defines.686, debian/arch/i386/defines.686-smp, debian/arch/i386/defines.k7, debian/arch/i386/defines.k7-smp, debian/arch/ia64/defines, debian/arch/m68k/defines, debian/arch/powerpc/defines, debian/arch/sparc/defines, debian/arch/sparc/defines.sparc64, debian/arch/sparc/defines.sparc64-smp: Add. * debian/arch/i386/desc.686, debian/arch/i386/desc.686-smp, debian/arch/i386/desc.k7, debian/arch/i386/desc.k7-smp, debian/arch/sparc/desc.sparc64, debian/arch/sparc/desc.sparc64-smp: Remove r3649: waldi | 2005-07-31 19:12:49 +0000 * debian/templates/control.image.in: Remove fdutils from Suggests. * debian/arch/arm/defines: Add. * debian/arch/alpha/defines, debian/arch/amd64/defines, debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines, debian/arch/powerpc/defines, debian/arch/sparc/defines: Update. r3650: waldi | 2005-07-31 19:44:25 +0000 * debian/bin/gencontrol.py, debian/templates/control.headers.in: Update. r3680: waldi | 2005-08-03 18:12:37 +0000 * debian/bin/gencontrol.py: Update. * debian/arch/i386/defines, debian/arch/s390/defines, debian/arch/sparc/defines: Move settings. * debian/arch/i386/defines.686, debian/arch/i386/defines.686-smp, debian/arch/i386/defines.k7, debian/arch/i386/defines.k7-smp, debian/arch/s390/defines.s390, debian/arch/s390/defines.s390x, debian/arch/sparc/defines.sparc64, adebian/rch/sparc/defines.sparc64-smp: Delete. r3682: waldi | 2005-08-03 22:38:45 +0000 * debian/arch/ia64/defines: Add class definition.s * debian/arch/ia64/desc.itanium-smp, debian/arch/ia64/desc.itanium debian/arch/ia64/desc.mckinley-smp, debian/arch/ia64/desc.mckinley: Delete. r3687: waldi | 2005-08-05 09:11:10 +0000 * debian/Makefile: Copy control file. r3689: waldi | 2005-08-05 15:36:24 +0000 * debian/rules: Make debian/changelog a prequisite of debian/control. svn path=/trunk/kernel/source/linux-2.6/; revision=3691 --- debian/Makefile | 2 +- debian/arch/alpha/defines | 2 + debian/arch/amd64/defines | 3 + debian/arch/arm/defines | 2 + debian/arch/defines | 2 + debian/arch/i386/defines | 15 + debian/arch/i386/desc.686 | 1 - debian/arch/i386/desc.686-smp | 1 - debian/arch/i386/desc.k7 | 1 - debian/arch/i386/desc.k7-smp | 1 - debian/arch/ia64/defines | 15 + debian/arch/ia64/desc.itanium | 1 - debian/arch/ia64/desc.itanium-smp | 1 - debian/arch/ia64/desc.mckinley | 1 - debian/arch/ia64/desc.mckinley-smp | 1 - debian/arch/m68k/defines | 2 + debian/arch/powerpc/defines | 3 + debian/arch/s390/defines | 10 + debian/arch/s390/desc.s390 | 3 - debian/arch/s390/desc.s390x | 3 - debian/arch/sparc/defines | 9 + debian/arch/sparc/desc.sparc64 | 1 - debian/arch/sparc/desc.sparc64-smp | 1 - debian/bin/gencontrol | 150 --------- debian/bin/gencontrol.py | 321 ++++++++++++++++++++ debian/rules | 29 +- debian/templates/control.headers.in | 5 +- debian/templates/control.headers.subarch.in | 17 ++ debian/templates/control.image.in | 11 +- debian/templates/control.main.in | 27 -- debian/templates/control.tree.in | 25 ++ 31 files changed, 437 insertions(+), 229 deletions(-) create mode 100644 debian/arch/alpha/defines create mode 100644 debian/arch/amd64/defines create mode 100644 debian/arch/arm/defines create mode 100644 debian/arch/defines create mode 100644 debian/arch/i386/defines delete mode 100644 debian/arch/i386/desc.686 delete mode 100644 debian/arch/i386/desc.686-smp delete mode 100644 debian/arch/i386/desc.k7 delete mode 100644 debian/arch/i386/desc.k7-smp create mode 100644 debian/arch/ia64/defines delete mode 100644 debian/arch/ia64/desc.itanium delete mode 100644 debian/arch/ia64/desc.itanium-smp delete mode 100644 debian/arch/ia64/desc.mckinley delete mode 100644 debian/arch/ia64/desc.mckinley-smp create mode 100644 debian/arch/m68k/defines create mode 100644 debian/arch/powerpc/defines create mode 100644 debian/arch/s390/defines delete mode 100644 debian/arch/s390/desc.s390 delete mode 100644 debian/arch/s390/desc.s390x create mode 100644 debian/arch/sparc/defines delete mode 100644 debian/arch/sparc/desc.sparc64 delete mode 100644 debian/arch/sparc/desc.sparc64-smp delete mode 100755 debian/bin/gencontrol create mode 100755 debian/bin/gencontrol.py create mode 100644 debian/templates/control.headers.subarch.in create mode 100644 debian/templates/control.tree.in diff --git a/debian/Makefile b/debian/Makefile index 8faaa5b08..d477e55cc 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -193,7 +193,7 @@ $(kdir): post-install-$(subarch) $(wildcard templates/control.*.in) mkdir -p $(tkdir)/debian cp changelog $(tkdir)/debian cp copyright $(tkdir)/debian - arch=$(karch) subarch=$(subarch) bin/gencontrol > $(tkdir)/debian/control + cp control $(tkdir)/debian/control touch $(tkdir)/debian/official if [ -n '$(patches)' ]; then \ cd $(tkdir); \ diff --git a/debian/arch/alpha/defines b/debian/arch/alpha/defines new file mode 100644 index 000000000..7ffe5c725 --- /dev/null +++ b/debian/arch/alpha/defines @@ -0,0 +1,2 @@ +[DEFAULT] +suggests: aboot, fdutils diff --git a/debian/arch/amd64/defines b/debian/arch/amd64/defines new file mode 100644 index 000000000..6f2715418 --- /dev/null +++ b/debian/arch/amd64/defines @@ -0,0 +1,3 @@ +[DEFAULT] +depends: e2fsprogs (>= 1.35-7) +suggests: lilo (>= 19.1) | grub, fdutils diff --git a/debian/arch/arm/defines b/debian/arch/arm/defines new file mode 100644 index 000000000..942fbbe93 --- /dev/null +++ b/debian/arch/arm/defines @@ -0,0 +1,2 @@ +[DEFAULT] +suggests: fdutils diff --git a/debian/arch/defines b/debian/arch/defines new file mode 100644 index 000000000..d0dea26df --- /dev/null +++ b/debian/arch/defines @@ -0,0 +1,2 @@ +[DEFAULT] +abiname: 1 diff --git a/debian/arch/i386/defines b/debian/arch/i386/defines new file mode 100644 index 000000000..8b3206b98 --- /dev/null +++ b/debian/arch/i386/defines @@ -0,0 +1,15 @@ +[DEFAULT] +suggests: lilo (>= 19.1) | grub, fdutils + +[686] +class: PPro/Celeron/PII/PIII/P4 + +[686-smp] +class: multi-processor PPro/Celeron/PII/PIII/P4 + +[k7] +class: AMD Duron/Athlon/AthlonXP + +[k7-smp] +class: multi-processor AMD Duron/Athlon/AthlonXP + diff --git a/debian/arch/i386/desc.686 b/debian/arch/i386/desc.686 deleted file mode 100644 index 135998dad..000000000 --- a/debian/arch/i386/desc.686 +++ /dev/null @@ -1 +0,0 @@ -class="PPro/Celeron/PII/PIII/P4" diff --git a/debian/arch/i386/desc.686-smp b/debian/arch/i386/desc.686-smp deleted file mode 100644 index 656d8ae85..000000000 --- a/debian/arch/i386/desc.686-smp +++ /dev/null @@ -1 +0,0 @@ -class="multi-processor PPro/Celeron/PII/PIII/P4" diff --git a/debian/arch/i386/desc.k7 b/debian/arch/i386/desc.k7 deleted file mode 100644 index c4db446a4..000000000 --- a/debian/arch/i386/desc.k7 +++ /dev/null @@ -1 +0,0 @@ -class="AMD Duron/Athlon/AthlonXP" diff --git a/debian/arch/i386/desc.k7-smp b/debian/arch/i386/desc.k7-smp deleted file mode 100644 index 972360228..000000000 --- a/debian/arch/i386/desc.k7-smp +++ /dev/null @@ -1 +0,0 @@ -class="multi-processor AMD Duron/Athlon/AthlonXP" diff --git a/debian/arch/ia64/defines b/debian/arch/ia64/defines new file mode 100644 index 000000000..e9ba4a79f --- /dev/null +++ b/debian/arch/ia64/defines @@ -0,0 +1,15 @@ +[DEFAULT] +suggests: elilo, fdutils + +[itanium] +class: Itanium" + +[itanium-smp] +class: multi-processor Itanium" + +[mckinley] +class: Itanium II" + +[mckinley-smp] +class: multi-processor Itanium II" + diff --git a/debian/arch/ia64/desc.itanium b/debian/arch/ia64/desc.itanium deleted file mode 100644 index b43457854..000000000 --- a/debian/arch/ia64/desc.itanium +++ /dev/null @@ -1 +0,0 @@ -class="Itanium" diff --git a/debian/arch/ia64/desc.itanium-smp b/debian/arch/ia64/desc.itanium-smp deleted file mode 100644 index 612cb99b7..000000000 --- a/debian/arch/ia64/desc.itanium-smp +++ /dev/null @@ -1 +0,0 @@ -class="multi-processor Itanium" diff --git a/debian/arch/ia64/desc.mckinley b/debian/arch/ia64/desc.mckinley deleted file mode 100644 index 011e18cbc..000000000 --- a/debian/arch/ia64/desc.mckinley +++ /dev/null @@ -1 +0,0 @@ -class="Itanium II" diff --git a/debian/arch/ia64/desc.mckinley-smp b/debian/arch/ia64/desc.mckinley-smp deleted file mode 100644 index c294086ec..000000000 --- a/debian/arch/ia64/desc.mckinley-smp +++ /dev/null @@ -1 +0,0 @@ -class="multi-processor Itanium II" diff --git a/debian/arch/m68k/defines b/debian/arch/m68k/defines new file mode 100644 index 000000000..50ca56e5a --- /dev/null +++ b/debian/arch/m68k/defines @@ -0,0 +1,2 @@ +[DEFAULT] +suggests: vmelilo, fdutils diff --git a/debian/arch/powerpc/defines b/debian/arch/powerpc/defines new file mode 100644 index 000000000..de1d2b2a0 --- /dev/null +++ b/debian/arch/powerpc/defines @@ -0,0 +1,3 @@ +[DEFAULT] +depends: mkvmlinuz +suggests: fdutils diff --git a/debian/arch/s390/defines b/debian/arch/s390/defines new file mode 100644 index 000000000..74bf73a63 --- /dev/null +++ b/debian/arch/s390/defines @@ -0,0 +1,10 @@ +[DEFAULT] +desc: This kernel has support to IPL (boot) from a VM reader or DASD device. +suggests: s390-tools + +[s390] +class: IBM S/390 + +[s390x] +class: IBM zSeries + diff --git a/debian/arch/s390/desc.s390 b/debian/arch/s390/desc.s390 deleted file mode 100644 index 5c03deb76..000000000 --- a/debian/arch/s390/desc.s390 +++ /dev/null @@ -1,3 +0,0 @@ -class="IBM S/390-class" -desc=" . - This kernel has support to IPL (boot) from a VM reader or DASD device." diff --git a/debian/arch/s390/desc.s390x b/debian/arch/s390/desc.s390x deleted file mode 100644 index 70d543319..000000000 --- a/debian/arch/s390/desc.s390x +++ /dev/null @@ -1,3 +0,0 @@ -class="IBM zSeries-class" -desc=" . - This kernel has support to IPL (boot) from a VM reader or DASD device." diff --git a/debian/arch/sparc/defines b/debian/arch/sparc/defines new file mode 100644 index 000000000..396eee765 --- /dev/null +++ b/debian/arch/sparc/defines @@ -0,0 +1,9 @@ +[DEFAULT] +suggests: silo, fdutils + +[sparc64] +class: uniprocessor 64-bit UltraSPARC class + +[sparc64-smp] +class: multi-processor 64-bit UltraSPARC class + diff --git a/debian/arch/sparc/desc.sparc64 b/debian/arch/sparc/desc.sparc64 deleted file mode 100644 index 9315a5f8a..000000000 --- a/debian/arch/sparc/desc.sparc64 +++ /dev/null @@ -1 +0,0 @@ -class="uniprocessor 64-bit UltraSPARC class" diff --git a/debian/arch/sparc/desc.sparc64-smp b/debian/arch/sparc/desc.sparc64-smp deleted file mode 100644 index 7440b95cf..000000000 --- a/debian/arch/sparc/desc.sparc64-smp +++ /dev/null @@ -1 +0,0 @@ -class="multi-processor 64-bit UltraSPARC class" diff --git a/debian/bin/gencontrol b/debian/bin/gencontrol deleted file mode 100755 index ebf0cb2c2..000000000 --- a/debian/bin/gencontrol +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# -# If the arch/subarch environment variables are set by the caller, -# we assume that we are called to generate the control file for the -# particular image build. Otherwise we'll generate master control -# file, including all arch/subarch/flavour combinations. -# -if [ -d debian ]; then - basedir='debian' -else - basedir='.' -fi -# -# This is created by the debian/makevars target in the rules file. -# -. ${basedir}/makevars -# -# Various arch-specific substitutions to kludge around the fact -# that we cannot have the arch-specific Depends, Suggests and -# Recommends. Note that currently Depends and Suggests fields -# for the images are guaranteed non-empty, but Recommends is -# only non-empty on i386, so we have to treat it slightly -# differently. -# -arch_depends_amd64='e2fsprogs (>= 1.35-7)' -arch_depends_hppa='palo' -arch_depends_powerpc='mkvmlinuz' - -arch_suggests_alpha='aboot' -arch_suggests_amd64='lilo (>= 19.1) | grub' -arch_suggests_i386='lilo (>= 19.1) | grub' -arch_suggests_ia64='elilo' -arch_suggests_m68k='vmelilo' -arch_suggests_mips='arcboot (>= 0.3.8)' -arch_suggests_mipsel='colo, delo' -arch_suggests_s390='s390-tools' -arch_suggests_sparc='silo' - -arch_recommends_i386='irqbalance' - -list_arches() { - find ${basedir}/arch -mindepth 1 -maxdepth 1 \ - ! -name '*.svn*' -type d -printf '%f\n' -} - -# -# Parameters: -# ${1} - architecture to list the subarches for -# ${2} - if non-zero, the value of this argument is returned -# -list_subarches() { - if [ -n "${2}" ]; then - echo "${2}" - else - echo "none" - find ${basedir}/arch/${1} -mindepth 1 -maxdepth 1 \ - ! -name '*.svn*' -type d -printf '%f\n' - fi -} - -# -# Parameters: -# ${1} - architecture -# ${2} - subarchitecture ('none' if there are no subarches) -# -list_flavours() { - find ${basedir}/arch/${1}/${2#none} -name 'config.*' \ - ! -name '*.svn*' -printf '%f\n' | sed 's/^config\.//' -} - -# -# Parameters: -# ${1} - filename to use as a template -# ${2} - arch -# ${3} - subarch ('none', if the subarch is empty) -# ${4} - flavour -# -substitute() { - if [ "${3}" = "none" ]; then - sa="" - sdir="${basedir}/arch/${2}" - else - sa="${3}-" - sdir="${basedir}/arch/${2}/${3}" - fi - class="${4}-class" - longclass="" - desc="" - [ -f "${sdir}/desc.${4}" ] && . "${sdir}/desc.${4}" - [ -z "${longclass}" ] && longclass="${class}" - - eval "arch_depends=\${arch_depends_${2}}" - if [ -n "${arch_depends}" ]; then - arch_depends=", ${arch_depends}" - fi - eval "arch_suggests=\${arch_suggests_${2}}" - if [ -n "${arch_suggests}" ]; then - arch_suggests=", ${arch_suggests}" - fi - eval "arch_recommends=\${arch_recommends_${2}}" - if [ -n "${arch_recommends}" ]; then - arch_recommends="Recommends: ${arch_recommends}" - fi - - cat ${basedir}/templates/control.${1} | \ - sed -e "s#@version@#${version}#g" \ - -e "s#@major@#${major}#g" \ - -e "s#@arch@#${2}#g" \ - -e "s#@subarch@#${sa}#g" \ - -e "s#@flavour@#${4}#g" \ - -e "s#@class@#${class}#g" \ - -e "s#@longclass@#${longclass}#g" \ - -e "s#@ltver@#${ltver}#g" \ - -e "s#@srcver@#${srcver}#g" \ - -e "s#@lt_depends@#${lt_depends}#g" \ - -e "s#@lt_provides@#${lt_provides}#g" \ - -e "s#@abiname@#${abiname}#g" \ - -e "s#@arch_depends@#${arch_depends}#g" \ - -e "s#@arch_suggests@#${arch_suggests}#g" \ - -e "s#@arch_recommends@#${arch_recommends}#g" - [ -z "${5}" ] || printf "${desc}\n" -} -# -# Main routine -# -rm -f control.tmp 2>/dev/null - -substitute source.in "" "none" >> control.tmp -if [ -n "${arch}" ]; then - test -z "${subarch}" && subarch='none' -else - substitute main.in "" "none" >> control.tmp - arch="$(list_arches)" -fi -substitute headers.in "" "none" >> control.tmp - -for a in ${arch}; do - for s in $(list_subarches ${a} ${subarch}); do - for f in $(list_flavours ${a} ${s}); do - substitute headers.flavour.in ${a} ${s} ${f} >> control.tmp - substitute image.in ${a} ${s} ${f} "1" >> control.tmp - done - done -done -# -# Output it all to the stdout -# -sed -e '/^[[:space:]]*$/d' control.tmp | \ -sed -e 's/^Package:/\n&/g' | grep -v '^#' -rm -rf control.tmp diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py new file mode 100755 index 000000000..a3b13b173 --- /dev/null +++ b/debian/bin/gencontrol.py @@ -0,0 +1,321 @@ +#!/usr/bin/env python +import os, os.path, re, sys, textwrap, ConfigParser + +class entry(dict): + __slots__ = ('_list') + + def __init__(self): + super(entry, self).__init__() + self._list = [] + + def __delitem__(self, key): + super(entry, self).__delitem__(key) + self._list.remove(key) + + def __setitem__(self, key, value): + super(entry, self).__setitem__(key, value) + if key.startswith('_'): + return + if key not in self._list: + if 'Description' in self._list: + self._list.insert(len(self._list)-1, key) + else: + self._list.append(key) + + def iterkeys(self): + for i in self._list: + yield i + + def iteritems(self): + for i in self._list: + yield (i, self[i]) + +def config(): + c = ConfigParser.ConfigParser() + c.read("debian/arch/defines") + return c + +def config_arch(arch): + c = config() + c.read("debian/arch/%s/defines" % arch) + return c + +def config_subarch(arch, subarch): + c = config_arch(arch) + if subarch is not None: + c.read("debian/arch/%s/%s/defines" % (arch, subarch)) + return c + +def list_dirs(dir): + ret = [] + for i in os.listdir(dir): + if i not in ('.svn',) and os.path.isdir(os.path.join(dir, i)): + ret.append(i) + return ret + +def list_files(dir): + ret = [] + for i in os.listdir(dir): + if os.path.isfile(os.path.join(dir, i)): + ret.append(i) + return ret + +def list_arches(): + return list_dirs("debian/arch") + +def list_subarches(arch): + ret = [None] + ret.extend(list_dirs("debian/arch/%s" % arch)) + return ret + +def list_flavours(arch, subarch): + dir = "debian/arch/%s" % arch + if subarch is not None: + dir += "/%s" % subarch + tmp = list_files(dir) + ret = [] + for i in tmp: + if i[:7] == 'config.': + ret.append(i[7:]) + return ret + +def read_changelog(): + r = re.compile(r""" +^ +( + (?P
+ (?P\w[-+0-9a-z.]+)\ \((?P[^\(\)\ \t]+)\)((\s+[-0-9a-zA-Z]+)+)\; + ) +) +""", re.VERBOSE) + f = file("debian/changelog") + entries = [] + while True: + line = f.readline() + if not line: + break + line = line.strip('\n') + match = r.match(line) + if not match: + continue + if match.group('header'): + e = entry() + e['Source'] = match.group('header_source') + e['Version'] = match.group('header_version') + entries.append(e) + return entries + +def read_rfc822(f): + entries = [] + + while True: + e = entry() + while True: + line = f.readline() + if not line: + break + line = line.strip('\n') + if not line: + break + if line[0] in ' \t': + if not last: + raise ValueError('Continuation line seen before first header') + e[last] += '\n' + line + continue + i = line.find(':') + if i < 0: + raise ValueError("Not a header, not a continuation: ``%s''" % line) + last = line[:i] + e[last] = line[i+1:].lstrip() + if not e: + break + + entries.append(e) + + return entries + +def read_template(name): + return read_rfc822(file("debian/templates/control.%s.in" % name)) + +def parse_version(version): + match = re.match("^((\d+\.\d+)\..+?)-([^-]+)$", version) + return (match.group(0), match.group(1), match.group(2), match.group(3)) + +def process_depends(key, e, in_e, vars): + in_dep = in_e[key].split(',') + dep = [] + for d in in_dep: + d = d.strip() + d = substitute(d, vars) + if d: + dep.append(d) + if dep: + t = ', '.join(dep) + e[key] = t + +def process_entry(in_entry, vars): + e = entry() + for i in in_entry.iterkeys(): + if i in (('Depends', 'Provides', 'Suggests')): + process_depends(i, e, in_entry, vars) + else: + e[i] = substitute(in_entry[i], vars) + return e + +def process_entries(in_entries, vars): + entries = [] + for i in in_entries: + entries.append(process_entry(i, vars)) + return entries + +def process_real_image(in_entry, vars): + entry = process_entry(in_entry, vars) + for i in (('Depends', 'Provides', 'Suggests')): + value = [] + tmp = entry.get(i, None) + if tmp: + tmp = tmp.split(',') + for t in tmp: + value.append(t.strip()) + if i == 'Depends': + t = vars.get('depends', None) + if t is not None: + value.append(t) + elif i == 'Provides': + t = vars.get('provides', None) + if t is not None: + value.append(t) + elif i == 'Suggests': + t = vars.get('suggests', None) + if t is not None: + value.append(t) + entry[i] = ', '.join(value) + if vars.has_key('desc'): + entry['Description'] += '\n .\n ' + '\n '.join(textwrap.wrap(vars['desc'])) + return entry + +def process_real_tree(in_entry, changelog, vars): + entry = process_entry(in_entry, vars) + tmp = changelog[0]['Source'] + versions = [] + for i in changelog: + if i['Source'] != tmp: + break + versions.insert(0, i['Version']) + for i in (('Depends', 'Provides')): + value = [] + tmp = entry.get(i, None) + if tmp: + tmp = tmp.split(',') + for t in tmp: + value.append(t.strip()) + if i == 'Depends': + tmp = [] + for v in versions: + v = parse_version(v) + tmp.append("linux-source-%s (= %s)" % (v[1], v[0])) + value.append(' | '.join(tmp)) + elif i == 'Provides': + for v in versions: + v = parse_version(v) + value.append("linux-tree-%s" % v[0]) + entry[i] = ', '.join(value) + return entry + +def substitute(s, vars): + def subst(match): + return vars[match.group(1)] + return re.sub(r'@([^@]+)@', subst, s) + +def vars_changelog(vars, changelog): + version = parse_version(changelog[0]['Version']) + vars['srcver'] = version[0] + vars['version'] = version[1] + vars['major'] = version[2] + return vars + +def write_control(list): + write_rfc822(file("debian/control", 'w'), list) + +def write_rfc822(f, list): + for i in list: + for j in i.iteritems(): + f.write("%s: %s\n" % j) + f.write('\n') + +if __name__ == '__main__': + changelog = read_changelog() + + vars = {} + vars = vars_changelog(vars, changelog) + vars.update(config().defaults()) + + arches = {} + subarches_architecture = {} + for arch in list_arches(): + t1 = {} + for subarch in list_subarches(arch): + t2 = {} + for flavour in list_flavours(arch, subarch): + t2[flavour] = True + t1[subarch] = t2 + t3 = subarches_architecture.get(subarch, {}) + t3[arch] = True + subarches_architecture[subarch] = t3 + arches[arch] = t1 + + packages = [] + + source = read_template("source") + packages.append(process_entry(source[0], vars)) + + main = read_template("main") + packages.extend(process_entries(main, vars)) + + tree = read_template("tree") + packages.append(process_real_tree(tree[0], changelog, vars)) + + headers = read_template("headers") + a = subarches_architecture[None].keys() + a.sort() + b = vars.copy() + b['arch'] = ' '.join(a) + packages.extend(process_entries(headers, b)) + + headers_flavour = read_template("headers.flavour") + image = read_template("image") + + i1 = arches.keys() + i1.sort() + for arch in i1: + arch_vars = vars.copy() + arch_vars['arch'] = arch + arch_vars.update(config_arch(arch).defaults()) + i2 = arches[arch].keys() + i2.sort() + for subarch in i2: + subarch_config = config_subarch(arch, subarch) + subarch_vars = arch_vars.copy() + subarch_vars.update(subarch_config.defaults()) + if subarch is not None: + subarch_vars['subarch'] = '%s-' % subarch + else: + subarch_vars['subarch'] = '' + i3 = arches[arch][subarch].keys() + i3.sort() + for flavour in i3: + flavour_vars = subarch_vars.copy() + flavour_vars['flavour'] = flavour + try: + flavour_vars.update(dict(subarch_config.items(flavour))) + except ConfigParser.NoSectionError: pass + if not flavour_vars.has_key('class'): + flavour_vars['class'] = '%s-class' % flavour + if not flavour_vars.has_key('longclass'): + flavour_vars['longclass'] = flavour_vars['class'] + + packages.extend(process_entries(headers_flavour, flavour_vars)) + packages.append(process_real_image(image[0], flavour_vars)) + + write_control(packages) + diff --git a/debian/rules b/debian/rules index 61884a1b0..11edb85b3 100755 --- a/debian/rules +++ b/debian/rules @@ -17,13 +17,6 @@ major := $(major_v).$(minor_v) release := $(version)-$(ltver) uver := $(subst .,_,$(version)) # -# Construct depends and provides for the linux-tree -# -lt_depends += $(shell seq -f 'linux-source-$(version) (= $(version)-%g)' \ - -s ' | ' 1 $(ltver)) -lt_provides := $(shell seq -f 'linux-tree-$(version)-%g' -s ', ' 1 $(ltver)) -lt_provides := $(strip $(lt_provides)) -# # If we are not passed a subarchs variable, we obtain the complete # subarch list as a list of subdirectories in arch/$(karch). We # also export the flavours variables, which allows to control which @@ -178,7 +171,7 @@ debian/doc-stamp: debian/patch-stamp touch debian/doc-stamp unpack: debian/unpack-stamp -debian/unpack-stamp: debian/patch-stamp debian/makevars +debian/unpack-stamp: debian/patch-stamp dh_testdir cd debian; \ for i in $(subarchs); do \ @@ -188,7 +181,7 @@ debian/unpack-stamp: debian/patch-stamp debian/makevars touch debian/unpack-stamp build: debian/build-stamp -debian/build-stamp: debian/unpack-stamp debian/makevars +debian/build-stamp: debian/unpack-stamp dh_testdir cd debian; \ for i in $(subarchs); do \ @@ -215,11 +208,11 @@ clean: unpatch cd debian; \ rm -f *-stamp-* *-stamp config.* *.kpatches.arch; \ rm -f header-install-* post-install-* bin/touch.orig; \ - rm -rf linux-source-* build-* install-* makevars + rm -rf linux-source-* build-* install-* dh_clean binary-indep: source tree patch-debian doc -binary-arch: build debian/makevars +binary-arch: build dh_testdir cd debian; \ for i in $(subarchs); do \ @@ -232,17 +225,7 @@ binary: binary-indep binary-arch # Makes the master debian/control file by substituting # variable values into the template. # -debian/control: $(wildcard debian/templates/control.*.in) debian/makevars - debian/bin/gencontrol > debian/control - -debian/makevars: - echo 'version='\''$(version)'\' > debian/makevars - echo 'major='\''$(major)'\' >> debian/makevars - echo 'srcver='\''$(srcver)'\' >> debian/makevars - echo 'ltver='\''$(ltver)'\' >> debian/makevars - echo 'lt_depends='\''$(srcver)'\' >> debian/makevars - echo 'lt_depends='\''$(lt_depends)'\' >> debian/makevars - echo 'lt_provides='\''$(lt_provides)'\' >> debian/makevars - echo 'abiname='\''$(abiname)'\' >> debian/makevars +debian/control: debian/changelog $(wildcard debian/templates/control.*.in) + debian/bin/gencontrol.py .PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree diff --git a/debian/templates/control.headers.in b/debian/templates/control.headers.in index 01f05b610..5b336a683 100644 --- a/debian/templates/control.headers.in +++ b/debian/templates/control.headers.in @@ -1,5 +1,5 @@ -Package: linux-headers-@subarch@@version@-@abiname@ -Architecture: alpha amd64 arm hppa i386 ia64 m68k powerpc s390 sparc +Package: linux-headers-@version@-@abiname@ +Architecture: @arch@ Section: devel Priority: optional Depends: coreutils | fileutils (>= 4.0) @@ -11,7 +11,6 @@ Description: Common architecture-specific header files for Linux kernel @version the linux-headers-@version@-@abiname@-(flavour) package, matching the flavour of the kernel you intend the build for. To obtain such a set for the currently running kernel it is sufficient to run a command - apt-get install linux-headers-@version@-@abiname@-$(uname -r) . and it will be unpacked in /usr/src/linux-headers-@version@-@abiname@-(flavour). diff --git a/debian/templates/control.headers.subarch.in b/debian/templates/control.headers.subarch.in new file mode 100644 index 000000000..313e1c7d1 --- /dev/null +++ b/debian/templates/control.headers.subarch.in @@ -0,0 +1,17 @@ +Package: linux-headers-@subarch@@version@-@abiname@ +Architecture: @arch@ +Section: devel +Priority: optional +Depends: coreutils | fileutils (>= 4.0) +Provides: linux-headers, linux-headers-@major@ +Description: Common architecture-specific header files for Linux kernel @version@ + This package provides the (sub)architecture-specific common kernel header files + for Linux kernel version @version@, generally used for building out-of-tree + kernel modules. To obtain a complete set of headers you also need to install + the linux-headers-@version@-@abiname@-(flavour) package, matching the + flavour of the kernel you intend the build for. To obtain such a set for the + currently running kernel it is sufficient to run a command + . + apt-get install linux-headers-@subarch@@version@-@abiname@-$(uname -r) + . + and it will be unpacked in /usr/src/linux-headers-@subarch@@version@-@abiname@-(flavour). diff --git a/debian/templates/control.image.in b/debian/templates/control.image.in index edcba4067..f86cdf56d 100644 --- a/debian/templates/control.image.in +++ b/debian/templates/control.image.in @@ -1,18 +1,11 @@ -# -# If you would like to change the arch-specific Depends, Suggests, -# or Recommends, have a look at the debian/bin/gencontrol file. Note -# that arch_depends and arch_suggests substitutions will start with -# a comma and a space if they are non-empty. -# Package: linux-image-@subarch@@version@-@abiname@-@flavour@ Architecture: @arch@ Section: base Priority: optional Provides: linux-image, linux-image-@major@ -Depends: initrd-tools (>= 0.1.78), coreutils | fileutils (>= 4.0), module-init-tools (>= 0.9.13)@arch_depends@ +Depends: initrd-tools (>= 0.1.78), coreutils | fileutils (>= 4.0), module-init-tools (>= 0.9.13) Conflicts: hotplug (<< 0.0.20040105-1) -Suggests: fdutils, linux-doc-@version@ | linux-source-@version@@arch_suggests@ -@arch_recommends@ +Suggests: linux-doc-@version@ | linux-source-@version@ Description: Linux kernel @version@ image on @class@ machines This package provides the binary image and pre-built loadable modules for Linux kernel @version@ on @class@ machines. diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index 518558d28..6032c1a74 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -42,30 +42,3 @@ Description: Debian patches to version @version@ of the Linux kernel patches. Note that these patches do NOT apply against a pristine Linux @version@ kernel but only against the kernel tarball linux-source-@version@_@version@.orig.tar.gz from the Debian archive. - -Package: linux-tree-@version@ -Architecture: all -Section: devel -Priority: optional -Depends: linux-patch-debian-@version@ (= @srcver@), @lt_depends@ -Provides: @lt_provides@ -Description: Linux kernel source tree for building Debian kernel images - This meta package is used as a build dependency of Debian - linux-image packages to prevent a version discrepancy between - the linux-image and corresponding linux-sources packages in the - fast-moving unstable archive. The package's dependency relations - are structured so that a linux-image package's build - dependencies can always be satisfied, even if the linux-source - package that had been used to compile the image has been - superseeded by a newer Debian revision since the last build. - . - The package provides a list of virtual packages, corresponding to - Debian revisions of a linux-source package. The Debian - linux-patch contains the information needed to roll back the - current linux-source to any of the revisions identified by the - provided virtual packages. Therefore, the linux-tree package - ensures the availability of the Linux kernel source tree corresponding - to each of the virtual packages listed. - . - The package serves no purpose outside of the Debian build and - archive infrastructure. diff --git a/debian/templates/control.tree.in b/debian/templates/control.tree.in new file mode 100644 index 000000000..36d4c42db --- /dev/null +++ b/debian/templates/control.tree.in @@ -0,0 +1,25 @@ +Package: linux-tree-@version@ +Architecture: all +Section: devel +Priority: optional +Depends: linux-patch-debian-@version@ (= @srcver@) +Description: Linux kernel source tree for building Debian kernel images + This meta package is used as a build dependency of Debian + linux-image packages to prevent a version discrepancy between + the linux-image and corresponding linux-sources packages in the + fast-moving unstable archive. The package's dependency relations + are structured so that a linux-image package's build + dependencies can always be satisfied, even if the linux-source + package that had been used to compile the image has been + superseeded by a newer Debian revision since the last build. + . + The package provides a list of virtual packages, corresponding to + Debian revisions of a linux-source package. The Debian + linux-patch contains the information needed to roll back the + current linux-source to any of the revisions identified by the + provided virtual packages. Therefore, the linux-tree package + ensures the availability of the Linux kernel source tree corresponding + to each of the virtual packages listed. + . + The package serves no purpose outside of the Debian build and + archive infrastructure.