mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 03:50:24 +09:00
* Implement subarch. * Rewrite patch handling to integrate arch and subarch specific patches. r4300: waldi | 2005-10-03 22:23:02 +0200 debian/rules.real: Remove old definitions. r4304: waldi | 2005-10-03 23:02:13 +0200 Move template reading to lib. * debian/bin/gencontrol.py - Remove RFC822 routines. - Use templates class. * debian/lib/python/debian_linux.py: Add templates class. r4738: waldi | 2005-11-07 15:51:30 +0100 debian/bin/gencontrol.py: Set TYPE. r4796: waldi | 2005-11-13 15:09:40 +0100 * debian/bin/gencontrol.py: Use config_reader. * debian/lib/python/debian_linux: Add directory. * debian/lib/python/debian_linux/__init__.py: Move from debian/lib/python/python/debian_linux.py. * debian/lib/python/debian_linux/config.py: Add config_reader and config_parser. r4797: waldi | 2005-11-13 15:45:12 +0100 * debian/bin/gencontrol.py: Move code away. For now only use imported code. * debian/lib/python/debian_linux/__init__.py: Remove utils. * debian/lib/python/debian_linux/config.py: Update. * debian/lib/python/debian_linux/debian.py: Add debian packaging specific code. * debian/lib/python/debian_linux/gencontrol.py: Add code. * debian/lib/python/debian_linux/utils.py: Add utils. r4798: waldi | 2005-11-13 15:56:37 +0100 debian/lib/python/debian_linux/gencontrol.py: Don't try to generation extra packages if the template does not exist. r4799: waldi | 2005-11-13 16:04:25 +0100 debian/lib/python/debian_linux/gencontrol.py: Begin to split methods in smaller pieces. r4800: waldi | 2005-11-13 16:26:03 +0100 debian/lib/python/debian_linux/gencontrol.py: Split more code. r4802: waldi | 2005-11-13 16:40:08 +0100 debian/lib/python/debian_linux/gencontrol.py: Also allow strings in makefile write list. r4806: waldi | 2005-11-13 16:55:48 +0100 debian/bin/gencontrol.py: Move linux-2.6 specific code from debian/lib/python/debian_linux/gencontrol.py. r4807: waldi | 2005-11-13 17:07:26 +0100 debian/bin/gencontrol.py, debian/lib/python/debian_linux/gencontrol.py: Update. r4808: waldi | 2005-11-13 17:08:53 +0100 debian/bin/gencontrol.py: Move code from debian/lib/python/debian_linux/gencontrol.py. r4810: waldi | 2005-11-13 17:10:30 +0100 debian/bin/gencontrol.py - Move code from debian/lib/python/debian_linux/gencontrol.py. - Update. r4811: waldi | 2005-11-13 17:33:47 +0100 debian/bin/gencontrol.py: Move code from debian/lib/python/debian_linux/gencontrol.py. r4812: waldi | 2005-11-13 17:36:38 +0100 debian/bin/gencontrol.py: Update. r4813: waldi | 2005-11-13 18:36:28 +0100 debian/lib/python/debian_linux/config.py: Remove old code. r4814: waldi | 2005-11-13 18:38:50 +0100 * debian/bin/gencontrol.py, debian/lib/python/debian_linux/gencontrol.py, debian/lib/python/debian_linux/utils.py: Teach package object how to work with list attributes. * debian/lib/python/debian_linux/debian.py: Don't use utils.entry. r4815: waldi | 2005-11-13 18:41:55 +0100 * debian/lib/python/debian_linux/gencontrol.py - Use utils.package. - Remove debugging code. * debian/lib/python/debian_linux/utils.py - Use utils.package. - Remove utils.entry. r4816: waldi | 2005-11-13 18:47:46 +0100 debian/lib/python/debian_linux/utils.py: Don't output empty fields. r4965: waldi | 2005-12-04 12:36:20 +0100 Rewrite config reader to support more than one section per (arch, subarch, flavour). * debian/bin/gencontrol.py, debian/lib/python/debian_linux/gencontrol.py: Explicitely Use base entries. * debian/lib/python/debian_linux/config.py - Rewrite. - Loose support for entry merging for now. r5175: waldi | 2006-01-02 20:46:46 +0100 debian/bin/gencontrol.py: Fix. r5176: waldi | 2006-01-02 21:09:17 +0100 * debian/bin/apply: Don't expect upstream version in series file names. * debian/patches-debian/series/0experimental.1: Move from debian/patches-debian/series/2.6.14+2.6.15-rc7-0experimental.1. * debian/patches-debian/series/0experimental.2: Move from debian/patches-debian/series/2.6.14+2.6.15-rc7-0experimental.2. r5177: waldi | 2006-01-02 22:31:28 +0100 First prototype of improved patch util. debian/bin/apply.py: Add. r5178: waldi | 2006-01-02 23:40:11 +0100 * debian/bin/apply.py: Finish implementation. * debian/rules.real: Use apply.py. r5179: waldi | 2006-01-03 00:15:05 +0100 * debian/bin/apply.py: Implement arch and subarch specific patches. * debian/bin/unpatch: Remove old code. * debian/rules.real: Fix patch package installation. r5180: waldi | 2006-01-03 00:16:05 +0100 debian/bin/apply: Remove. r5181: waldi | 2006-01-03 00:16:56 +0100 * debian/bin/gencontrol.py: Readd missing build target. * debian/lib/python/debian_linux/debian.py: Raise if version is not parsable. r5192: waldi | 2006-01-03 15:32:43 +0100 debian/bin/apply.py - Add version_file class. - Use correct series for deapply. r5193: waldi | 2006-01-03 15:41:53 +0100 debian/bin/apply.py - Remove extra version handling from series class. - Add check for extra version in patch setup. r5194: waldi | 2006-01-03 15:45:49 +0100 debian/bin/apply.py: Move complete reverse logic into series class. r5195: waldi | 2006-01-03 16:14:33 +0100 debian/bin/apply.py: Implement patch per arch and subarch. It is currently done by completely deapply the arch specific patches if it needs to change set of general patches. r5196: waldi | 2006-01-03 16:18:55 +0100 debian/bin/apply.py: Don't record extra version without patch. r5197: waldi | 2006-01-03 16:25:03 +0100 debian/bin/apply.py: Record shortest possible extra version in version file. r5198: waldi | 2006-01-03 16:28:00 +0100 * debian/patches-debian/series/0experimental.3-extra: Add. * debian/patches-debian/hppa-incompatible.patch: Move from debian/patches-arch/hppa.diff. * debian/patches-debian/m68k-incompatible.patch Move from debian/patches-arch/m68k.diff. * debian/patches-arch: Remove. r5200: waldi | 2006-01-03 16:30:03 +0100 debian/rules.real: Use new apply script for arch and subarch patches. r5207: waldi | 2006-01-03 17:12:52 +0100 * debian/rules.real: Remove old arch patches installation. * debian/templates/control.source.in: Remove dh-kpatches from Buld-Depends-Indep. r5208: waldi | 2006-01-03 17:21:21 +0100 debian/lib/python/debian_linux: Set svn:ignore property. r5210: waldi | 2006-01-03 17:24:09 +0100 debian/templates/control.main.in: Fix depends of patch package. r5212: waldi | 2006-01-03 17:54:18 +0100 * debian/rules: Fix clean. * debian/rules.real - Remove definition of old arch patches. - Use a variable for patch command. r5213: waldi | 2006-01-03 20:45:41 +0100 * debian/templates: Move subarch part in package names in front of flavour. * debian/lib/python/debian_linux/gencontrol.py: Fix subarch text setting. r5214: waldi | 2006-01-03 20:46:05 +0100 debian/lib/python/debian_linux/config.py: Support subarches. r5215: waldi | 2006-01-04 00:51:46 +0100 Update svn:ignore property. r5216: waldi | 2006-01-04 00:53:20 +0100 debian/bin/apply.py - Use correct length in extra check. - Check for correct length of extra entries. r5217: waldi | 2006-01-04 00:54:38 +0100 debian/rules.real - Append subarch to kernel version. - Fix base of kconfig.ml call. r5234: waldi | 2006-01-04 15:34:59 +0100 * debian/bin/gencontrol.py: Use config entry merging when needed. * lib/python/debian_linux/config.py: Readd config entry merging. r5235: waldi | 2006-01-04 16:00:38 +0100 * debian/bin/install-image: Use DEBIAN_LOCALVERSION and DEBIAN_LOCALVERSION_HEADERS. * debian/rules.real: Set LOCALVERSION for scripts. r5240: waldi | 2006-01-04 17:50:12 +0100 debian/rules.real: Fix version of subarch headers package. svn path=/dists/trunk/linux-2.6/; revision=5242
259 lines
9.8 KiB
Python
259 lines
9.8 KiB
Python
from config import *
|
|
from debian import *
|
|
from utils import *
|
|
|
|
class packages_list(sorted_dict):
|
|
def append(self, package):
|
|
self[package['Package']] = package
|
|
|
|
def extend(self, packages):
|
|
for package in packages:
|
|
self[package['Package']] = package
|
|
|
|
class gencontrol(object):
|
|
def __init__(self):
|
|
self.changelog = read_changelog()
|
|
self.config = config_reader()
|
|
self.templates = templates()
|
|
self.version, self.abiname, self.kpkg_abiname, self.changelog_vars = self.process_changelog({})
|
|
|
|
def __call__(self):
|
|
packages = packages_list()
|
|
makefile = []
|
|
|
|
self.do_source(packages)
|
|
self.do_main(packages, makefile)
|
|
self.do_extra(packages, makefile)
|
|
|
|
self.write_control(packages.itervalues())
|
|
self.write_makefile(makefile)
|
|
|
|
def do_source(self, packages):
|
|
source = self.templates["control.source"]
|
|
packages['source'] = self.process_package(source[0], self.changelog_vars)
|
|
|
|
def do_main(self, packages, makefile):
|
|
makeflags = {
|
|
'VERSION': self.version['version'],
|
|
'SOURCE_UPSTREAM': self.version['source_upstream'],
|
|
'SOURCE_VERSION': self.version['source'],
|
|
'UPSTREAM_VERSION': self.version['upstream'],
|
|
'ABINAME': self.abiname,
|
|
'KPKG_ABINAME': self.kpkg_abiname,
|
|
'REVISIONS': ' '.join([i['Version']['debian'] for i in self.changelog[::-1]]),
|
|
}
|
|
|
|
self.do_main_packages(packages)
|
|
self.do_main_makefile(makefile, makeflags)
|
|
|
|
for arch in iter(self.config['base',]['arches']):
|
|
self.do_arch(packages, makefile, arch, self.changelog_vars.copy(), makeflags.copy())
|
|
|
|
def do_main_makefile(self, makefile, makeflags):
|
|
makeflags_string = ' '.join(["%s='%s'" % i for i in makeflags.iteritems()])
|
|
|
|
cmds_binary_indep = []
|
|
cmds_binary_indep.append(("$(MAKE) -f debian/rules.real binary-indep %s" % makeflags_string,))
|
|
makefile.append(("binary-indep:", cmds_binary_indep))
|
|
|
|
def do_main_packages(self, packages):
|
|
pass
|
|
|
|
def do_extra(self, packages, makefile):
|
|
try:
|
|
templates_extra = self.templates["control.extra"]
|
|
except IOError:
|
|
return
|
|
|
|
packages.extend(self.process_packages(templates_extra, {}))
|
|
extra_arches = {}
|
|
for package in templates_extra:
|
|
arches = package['Architecture']
|
|
for arch in arches:
|
|
i = extra_arches.get(arch, [])
|
|
i.append(package)
|
|
extra_arches[arch] = i
|
|
archs = extra_arches.keys()
|
|
archs.sort()
|
|
for arch in archs:
|
|
cmds = []
|
|
for i in extra_arches[arch]:
|
|
tmp = []
|
|
if i.has_key('X-Version-Overwrite-Epoch'):
|
|
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.append("binary-arch-%s:: binary-arch-%s-extra" % (arch, arch))
|
|
makefile.append(("binary-arch-%s-extra:" % arch, cmds))
|
|
|
|
def do_arch(self, packages, makefile, arch, vars, makeflags):
|
|
config_entry = self.config['base', arch]
|
|
vars.update(config_entry)
|
|
|
|
if not config_entry.get('available', True):
|
|
for i in ('binary-arch', 'build', 'setup'):
|
|
makefile.append(("%s-%s:" % (i, arch), ["@echo Architecture %s is not available!" % arch, "@exit 1"]))
|
|
return
|
|
|
|
extra = {}
|
|
makeflags['ARCH'] = arch
|
|
self.do_arch_makeflags(makeflags, arch)
|
|
self.do_arch_makefile(makefile, arch, makeflags)
|
|
self.do_arch_packages(packages, makefile, arch, vars, makeflags, extra)
|
|
|
|
for subarch in config_entry['subarches']:
|
|
self.do_subarch(packages, makefile, arch, subarch, vars.copy(), makeflags.copy(), extra)
|
|
|
|
self.do_arch_packages_post(packages, makefile, arch, vars, makeflags, extra)
|
|
|
|
def do_arch_makeflags(self, makeflags, arch):
|
|
pass
|
|
|
|
def do_arch_makefile(self, makefile, arch, makeflags):
|
|
for i in (('binary-arch', 'build', 'setup',)):
|
|
makefile.append("%s-%s:: %s-%s-real" % (i, arch, i, arch))
|
|
|
|
def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra):
|
|
pass
|
|
|
|
def do_arch_packages_post(self, packages, makefile, arch, vars, makeflags, extra):
|
|
pass
|
|
|
|
def do_subarch(self, packages, makefile, arch, subarch, vars, makeflags, extra):
|
|
if subarch == 'none':
|
|
vars['subarch'] = ''
|
|
else:
|
|
vars['subarch'] = '-%s' % subarch
|
|
config_entry = self.config['base', arch, subarch]
|
|
vars.update(config_entry)
|
|
|
|
makeflags['SUBARCH'] = subarch
|
|
self.do_subarch_makeflags(makeflags, arch, subarch)
|
|
self.do_subarch_makefile(makefile, arch, subarch, makeflags)
|
|
self.do_subarch_packages(packages, makefile, arch, subarch, vars, makeflags, extra)
|
|
|
|
for flavour in config_entry['flavours']:
|
|
self.do_flavour(packages, makefile, arch, subarch, flavour, vars.copy(), makeflags.copy(), extra)
|
|
|
|
def do_subarch_makeflags(self, makeflags, arch, subarch):
|
|
pass
|
|
|
|
def do_subarch_makefile(self, makefile, arch, subarch, makeflags):
|
|
for i in ('binary-arch', 'build', 'setup'):
|
|
makefile.append("%s-%s:: %s-%s-%s" % (i, arch, i, arch, subarch))
|
|
makefile.append("%s-%s-%s:: %s-%s-%s-real" % (i, arch, subarch, i, arch, subarch))
|
|
|
|
def do_subarch_packages(self, packages, makefile, arch, subarch, vars, makeflags, extra):
|
|
pass
|
|
|
|
def do_flavour(self, packages, makefile, arch, subarch, flavour, vars, makeflags, extra):
|
|
config_entry = self.config['base', arch, subarch, flavour]
|
|
vars.update(config_entry)
|
|
|
|
vars['flavour'] = flavour
|
|
if not vars.has_key('class'):
|
|
vars['class'] = '%s-class' % flavour
|
|
if not vars.has_key('longclass'):
|
|
vars['longclass'] = vars['class']
|
|
|
|
makeflags['FLAVOUR'] = flavour
|
|
self.do_flavour_makeflags(makeflags, arch, subarch, flavour)
|
|
self.do_flavour_makefile(makefile, arch, subarch, flavour, makeflags)
|
|
self.do_flavour_packages(packages, makefile, arch, subarch, flavour, vars, makeflags, extra)
|
|
|
|
def do_flavour_makeflags(self, makeflags, arch, subarch, flavour):
|
|
pass
|
|
|
|
def do_flavour_makefile(self, makefile, arch, subarch, flavour, makeflags):
|
|
for i in ('binary-arch', 'build', 'setup'):
|
|
makefile.append("%s-%s-%s:: %s-%s-%s-%s" % (i, arch, subarch, i, arch, subarch, flavour))
|
|
makefile.append("%s-%s-%s-%s:: %s-%s-%s-%s-real" % (i, arch, subarch, flavour, i, arch, subarch, flavour))
|
|
|
|
def do_flavour_packages(self, packages, makefile, arch, subarch, flavour, vars, makeflags, extra):
|
|
pass
|
|
|
|
def process_changelog(self, in_vars):
|
|
ret = [None, None, None, None]
|
|
ret[0] = version = self.changelog[0]['Version']
|
|
vars = in_vars.copy()
|
|
if version['modifier'] is not None:
|
|
ret[1] = vars['abiname'] = version['modifier']
|
|
ret[2] = ""
|
|
else:
|
|
ret[1] = vars['abiname'] = self.config['base',]['abiname']
|
|
ret[2] = "-%s" % vars['abiname']
|
|
vars['version'] = version['version']
|
|
vars['major'] = version['major']
|
|
ret[3] = vars
|
|
return ret
|
|
|
|
def process_relation(self, key, e, in_e, vars):
|
|
in_dep = in_e[key]
|
|
dep = type(in_dep)()
|
|
for d in in_dep:
|
|
d = self.substitute(d, vars)
|
|
if d:
|
|
dep.append(d)
|
|
e[key] = dep
|
|
|
|
def process_description(self, e, in_e, vars):
|
|
desc = in_e['Description']
|
|
desc_short, desc_long = desc.split ("\n", 1)
|
|
desc_pars = [self.substitute(i, vars) for i in desc_long.split ("\n.\n")]
|
|
desc_pars_wrapped = []
|
|
w = wrap(width = 74, fix_sentence_endings = True)
|
|
for i in desc_pars:
|
|
desc_pars_wrapped.append(w.fill(i))
|
|
e['Description'] = "%s\n%s" % (self.substitute(desc_short, vars), '\n.\n'.join(desc_pars_wrapped))
|
|
|
|
def process_package(self, in_entry, vars):
|
|
e = package()
|
|
for key in in_entry.iterkeys():
|
|
if key in (('Depends', 'Provides', 'Suggests', 'Recommends', 'Conflicts')):
|
|
self.process_relation(key, e, in_entry, vars)
|
|
elif key == 'Description':
|
|
self.process_description(e, in_entry, vars)
|
|
elif key[:2] == 'X-':
|
|
pass
|
|
else:
|
|
e[key] = self.substitute(in_entry[key], vars)
|
|
return e
|
|
|
|
def process_packages(self, in_entries, vars):
|
|
entries = []
|
|
for i in in_entries:
|
|
entries.append(self.process_package(i, vars))
|
|
return entries
|
|
|
|
def substitute(self, s, vars):
|
|
if isinstance(s, (list, tuple)):
|
|
for i in xrange(len(s)):
|
|
s[i] = self.substitute(s[i], vars)
|
|
return s
|
|
def subst(match):
|
|
return vars[match.group(1)]
|
|
return re.sub(r'@([a-z_]+)@', subst, s)
|
|
|
|
def write_control(self, list):
|
|
self.write_rfc822(file("debian/control", 'w'), list)
|
|
|
|
def write_makefile(self, out_list):
|
|
out = file("debian/rules.gen", 'w')
|
|
for item in out_list:
|
|
if isinstance(item, (list, tuple)):
|
|
out.write("%s\n" % item[0])
|
|
cmd_list = item[1]
|
|
if isinstance(cmd_list, basestring):
|
|
cmd_list = cmd_list.split('\n')
|
|
for j in cmd_list:
|
|
out.write("\t%s\n" % j)
|
|
else:
|
|
out.write("%s\n" % item)
|
|
|
|
def write_rfc822(self, f, list):
|
|
for entry in list:
|
|
for key, value in entry.iteritems():
|
|
f.write("%s: %s\n" % (key, value))
|
|
f.write('\n')
|
|
|
|
|