diff options
author | Bastian Blank <waldi@debian.org> | 2008-04-27 06:26:15 +0000 |
---|---|---|
committer | Bastian Blank <waldi@debian.org> | 2008-04-27 06:26:15 +0000 |
commit | fb5a6dc08c171a94d70292000bc48d8e2dca58c7 (patch) | |
tree | 57d51c92fb2687c7d46ec33a9a0bf365c117048e /debian/bin | |
parent | badb42f93c5046f7541dc6f038ccf11652099e15 (diff) | |
download | kernel_replicant_linux-fb5a6dc08c171a94d70292000bc48d8e2dca58c7.tar.gz kernel_replicant_linux-fb5a6dc08c171a94d70292000bc48d8e2dca58c7.tar.bz2 kernel_replicant_linux-fb5a6dc08c171a94d70292000bc48d8e2dca58c7.zip |
debian/bin, debian/lib: Infrastructure was declared irrelevant, drop it.
svn path=/dists/trunk/linux-2.6/; revision=11213
Diffstat (limited to 'debian/bin')
-rwxr-xr-x | debian/bin/abicheck.py | 101 | ||||
-rwxr-xr-x | debian/bin/abiupdate.py | 182 | ||||
-rwxr-xr-x | debian/bin/check-patches.sh | 13 | ||||
-rwxr-xr-x | debian/bin/gencontrol.py | 320 | ||||
-rwxr-xr-x | debian/bin/genorig.py | 117 | ||||
-rwxr-xr-x | debian/bin/kconfig.py | 13 |
6 files changed, 0 insertions, 746 deletions
diff --git a/debian/bin/abicheck.py b/debian/bin/abicheck.py deleted file mode 100755 index 3dea267cb091..000000000000 --- a/debian/bin/abicheck.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append('debian/lib/python') - -from debian_linux.abi import * -from debian_linux.config import ConfigCoreDump -from debian_linux.debian import * - -class checker(object): - def __init__(self, dir, arch, featureset, flavour): - self.arch, self.featureset, self.flavour = arch, featureset, flavour - self.config = ConfigCoreDump(fp = file("debian/config.defines.dump")) - self.filename_new = "%s/Module.symvers" % dir - - changelog = Changelog(version = VersionLinux)[0] - version = changelog.version.linux_version - abiname = self.config['abi',]['abiname'] - self.filename_ref = "debian/abi/%s-%s/%s_%s_%s" % (version, abiname, arch, featureset, flavour) - - def __call__(self, out): - ret = 0 - - new = symbols(self.filename_new) - try: - ref = symbols(self.filename_ref) - except IOError: - out.write("Can't read ABI reference. ABI not checked! Continuing.\n") - return 0 - - add_info, change_info, remove_info = ref.cmp(new) - add = set(add_info.keys()) - change = set(change_info.keys()) - remove = set(remove_info.keys()) - ignore = self._ignore(add_info, change_info, remove_info) - - add_effective = add - ignore - change_effective = change - ignore - remove_effective = remove - ignore - - if change_effective or remove_effective: - out.write("ABI has changed! Refusing to continue.\n") - ret = 1 - elif change or remove: - out.write("ABI has changed but all changes have been ignored. Continuing.\n") - elif add_effective: - out.write("New symbols have been added. Continuing.\n") - elif add: - out.write("New symbols have been added but have been ignored. Continuing.\n") - else: - out.write("No ABI changes.\n") - if add: - out.write("\nAdded symbols:\n") - t = list(add) - t.sort() - for symbol in t: - info = [] - if symbol in ignore: - info.append("ignored") - for i in ('module', 'version', 'export'): - info.append("%s: %s" % (i, add_info[symbol][i])) - out.write("%-48s %s\n" % (symbol, ", ".join(info))) - if change: - out.write("\nChanged symbols:\n") - t = list(change) - t.sort() - for symbol in t: - info = [] - if symbol in ignore: - info.append("ignored") - s = change_info[symbol] - changes = s['changes'] - for i in ('module', 'version', 'export'): - if changes.has_key(i): - info.append("%s: %s -> %s" % (i, s['ref'][i], s['new'][i])) - else: - info.append("%s: %s" % (i, new[symbol][i])) - out.write("%-48s %s\n" % (symbol, ", ".join(info))) - if remove: - out.write("\nRemoved symbols:\n") - t = list(remove) - t.sort() - for symbol in t: - info = [] - if symbol in ignore: - info.append("ignored") - for i in ('module', 'version', 'export'): - info.append("%s: %s" % (i, remove_info[symbol][i])) - out.write("%-48s %s\n" % (symbol, ", ".join(info))) - - return ret - - def _ignore(self, add, change, remove): - config = self.config.merge('abi', self.arch, self.featureset, self.flavour) - ignores = config.get('ignore-changes', None) - if ignores is None: - return set() - return set(ignores.split()) - -if __name__ == '__main__': - sys.exit(checker(*sys.argv[1:])(sys.stdout)) diff --git a/debian/bin/abiupdate.py b/debian/bin/abiupdate.py deleted file mode 100755 index cbe305ab8b2f..000000000000 --- a/debian/bin/abiupdate.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append(sys.path[0] + "/../lib/python") - -import optparse, os, shutil, tempfile, urllib2 -from debian_linux.abi import * -from debian_linux.config import * -from debian_linux.debian import * - -default_url_base = "http://ftp.de.debian.org/debian/" -default_url_base_incoming = "http://incoming.debian.org/" - -class url_debian_flat(object): - def __init__(self, base): - self.base = base - - def __call__(self, source, filename): - return self.base + filename - -class url_debian_pool(object): - def __init__(self, base): - self.base = base - - def __call__(self, source, filename): - return self.base + "pool/main/" + source[0] + "/" + source + "/" + filename - -class main(object): - dir = None - - def __init__(self, url, url_config = None, arch = None, featureset = None, flavour = None): - self.log = sys.stdout.write - - self.url = self.url_config = url - if url_config is not None: - self.url_config = url_config - self.override_arch = arch - self.override_featureset = featureset - self.override_flavour = flavour - - changelog = Changelog(version = VersionLinux) - while changelog[0].distribution == 'UNRELEASED': - changelog.pop(0) - changelog = changelog[0] - - self.source = changelog.source - self.version = changelog.version.linux_version - self.version_source = changelog.version.complete - - local_config = ConfigCoreDump(fp = file("debian/config.defines.dump")) - - self.version_abi = self.version + '-' + local_config['abi',]['abiname'] - - def __call__(self): - self.dir = tempfile.mkdtemp(prefix = 'abiupdate') - try: - self.log("Retreive config\n") - config = self.get_config() - if self.override_arch: - arches = [self.override_arch] - else: - arches = config[('base',)]['arches'] - for arch in arches: - self.update_arch(config, arch) - finally: - shutil.rmtree(self.dir) - - def extract_package(self, filename, base): - base_out = self.dir + "/" + base - os.mkdir(base_out) - os.system("dpkg-deb --extract %s %s" % (filename, base_out)) - return base_out - - def get_abi(self, arch, prefix): - filename = "linux-headers-%s-%s_%s_%s.deb" % (self.version_abi, prefix, self.version_source, arch) - f = self.retrieve_package(self.url, filename) - d = self.extract_package(f, "linux-headers-%s_%s" % (prefix, arch)) - f1 = d + "/usr/src/linux-headers-%s-%s/Module.symvers" % (self.version_abi, prefix) - s = symbols(f1) - shutil.rmtree(d) - return s - - def get_config(self): - filename = "linux-support-%s_%s_all.deb" % (self.version_abi, self.version_source) - f = self.retrieve_package(self.url_config, filename) - d = self.extract_package(f, "linux-support") - c = d + "/usr/src/linux-support-" + self.version_abi + "/config.defines.dump" - config = ConfigCoreDump(fp = file(c)) - shutil.rmtree(d) - return config - - def retrieve_package(self, url, filename): - u = url(self.source, filename) - filename_out = self.dir + "/" + filename - f_in = urllib2.urlopen(u) - f_out = file(filename_out, 'w') - while 1: - r = f_in.read() - if not r: - break - f_out.write(r) - return filename_out - - def save_abi(self, symbols, arch, featureset, flavour): - dir = "debian/abi/%s" % self.version_abi - if not os.path.exists(dir): - os.makedirs(dir) - out = "%s/%s_%s_%s" % (dir, arch, featureset, flavour) - symbols.write(file(out, 'w')) - - def update_arch(self, config, arch): - if self.override_featureset: - featuresets = [self.override_featureset] - else: - featuresets = config[('base', arch)]['featuresets'] - for featureset in featuresets: - self.update_featureset(config, arch, featureset) - - def update_featureset(self, config, arch, featureset): - config_base = config.merge('base', arch, featureset) - - if not config_base.get('enabled', True): - return - - if self.override_flavour: - flavours = [self.override_flavour] - else: - flavours = config_base['flavours'] - for flavour in flavours: - self.update_flavour(config, arch, featureset, flavour) - - def update_flavour(self, config, arch, featureset, flavour): - config_base = config.merge('base', arch, featureset, flavour) - - if not config_base.get('modules', True): - return - - self.log("Updating ABI for arch %s, featureset %s, flavour %s: " % (arch, featureset, flavour)) - try: - if featureset == 'none': - localversion = flavour - else: - localversion = featureset + '-' + flavour - - abi = self.get_abi(arch, localversion) - self.save_abi(abi, arch, featureset, flavour) - self.log("Ok.\n") - except KeyboardInterrupt: - self.log("Interrupted!\n") - sys.exit(1) - except Exception, e: - self.log("FAILED! (%s)\n" % str(e)) - -if __name__ == '__main__': - options = optparse.OptionParser() - options.add_option("-i", "--incoming", action = "store_true", dest = "incoming") - options.add_option("--incoming-config", action = "store_true", dest = "incoming_config") - options.add_option("-u", "--url-base", dest = "url_base", default = default_url_base) - options.add_option("--url-base-incoming", dest = "url_base_incoming", default = default_url_base_incoming) - - opts, args = options.parse_args() - - kw = {} - if len(args) >= 1: - kw['arch'] =args[0] - if len(args) >= 2: - kw['featureset'] =args[1] - if len(args) >= 3: - kw['flavour'] =args[2] - - url_base = url_debian_pool(opts.url_base) - url_base_incoming = url_debian_flat(opts.url_base_incoming) - if opts.incoming_config: - url = url_config = url_base_incoming - else: - url_config = url_base - if opts.incoming: - url = url_base_incoming - else: - url = url_base - - main(url, url_config, **kw)() diff --git a/debian/bin/check-patches.sh b/debian/bin/check-patches.sh deleted file mode 100755 index 3a733fae3602..000000000000 --- a/debian/bin/check-patches.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -e - -TMPDIR=$(mktemp -d) -trap "rm -rf $TMPDIR" EXIT -grep -v "^#" debian/patches/series/* | awk '{if (NF >= 2) print "debian/patches/" $2}' | sort -u > $TMPDIR/used -find debian/patches ! -path '*/series*' -type f -name "*.diff" -o -name "*.patch" -printf "%p\n" | sort > $TMPDIR/avail -echo "Used patches" -echo "==============" -cat $TMPDIR/used -echo -echo "Unused patches" -echo "==============" -fgrep -v -f $TMPDIR/used $TMPDIR/avail diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py deleted file mode 100755 index 42290ac18bd7..000000000000 --- a/debian/bin/gencontrol.py +++ /dev/null @@ -1,320 +0,0 @@ -#!/usr/bin/env python - -import os, sys -sys.path.append("debian/lib/python") - -from debian_linux.config import ConfigCoreHierarchy -from debian_linux.debian import * -from debian_linux.gencontrol import Gencontrol as Base -from debian_linux.utils import Templates - -class Gencontrol(Base): - def __init__(self, config_dirs = ["debian/config"], template_dirs = ["debian/templates"]): - super(Gencontrol, self).__init__(ConfigCoreHierarchy(config_dirs), Templates(template_dirs), VersionLinux) - self.process_changelog() - self.config_dirs = config_dirs - - def do_main_setup(self, vars, makeflags, extra): - super(Gencontrol, self).do_main_setup(vars, makeflags, extra) - vars.update(self.config['image',]) - makeflags.update({ - 'MAJOR': self.version.linux_major, - 'VERSION': self.version.linux_version, - 'UPSTREAMVERSION': self.version.linux_upstream, - 'ABINAME': self.abiname, - 'SOURCEVERSION': self.version.complete, - }) - - def do_main_packages(self, packages, extra): - packages.extend(self.process_packages(self.templates["control.main"], self.vars)) - packages.append(self.process_real_tree(self.templates["control.tree"][0], self.vars)) - packages.extend(self.process_packages(self.templates["control.support"], self.vars)) - - def do_arch_setup(self, vars, makeflags, arch, extra): - config_base = self.config.merge('base', arch) - vars.update(self.config.merge('image', arch)) - config_libc_dev = self.config.merge('libc-dev', arch) - makeflags['LIBC_DEV_ARCH'] = config_libc_dev.get('arch', config_base.get('kernel-arch')) - - def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra): - headers_arch = self.templates["control.headers.arch"] - packages_headers_arch = self.process_packages(headers_arch, vars) - - libc_dev = self.templates["control.libc-dev"] - packages_headers_arch[0:0] = self.process_packages(libc_dev, {}) - - extra['headers_arch_depends'] = packages_headers_arch[-1]['Depends'] = PackageRelation() - - for package in packages_headers_arch: - name = package['Package'] - if packages.has_key(name): - package = packages.get(name) - package['Architecture'].append(arch) - else: - package['Architecture'] = [arch] - packages.append(package) - - cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags] - cmds_source = ["$(MAKE) -f debian/rules.real source-arch %s" % makeflags] - makefile.add('binary-arch_%s_real' % arch, cmds = cmds_binary_arch) - makefile.add('source_%s_real' % arch, cmds = cmds_source) - - def do_featureset_setup(self, vars, makeflags, arch, featureset, extra): - vars.update(self.config.merge('image', arch, featureset)) - makeflags['LOCALVERSION_HEADERS'] = vars['localversion_headers'] = vars['localversion'] - makeflags['KERNEL_HEADER_DIRS'] = vars.get('kernel-header-dirs', vars.get('kernel-arch')) - - def do_featureset_packages(self, packages, makefile, arch, featureset, vars, makeflags, extra): - headers_featureset = self.templates["control.headers.featureset"] - package_headers = self.process_package(headers_featureset[0], vars) - - name = package_headers['Package'] - if packages.has_key(name): - package_headers = packages.get(name) - package_headers['Architecture'].append(arch) - else: - package_headers['Architecture'] = [arch] - packages.append(package_headers) - - cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-featureset %s" % makeflags] - cmds_source = ["$(MAKE) -f debian/rules.real source-featureset %s" % makeflags] - makefile.add('binary-arch_%s_%s_real' % (arch, featureset), cmds = cmds_binary_arch) - makefile.add('source_%s_%s_real' % (arch, featureset), cmds = cmds_source) - - def do_flavour_setup(self, vars, makeflags, arch, featureset, flavour, extra): - config_image = self.config.merge('image', arch, featureset, flavour) - - vars.update(config_image) - - vars['localversion-image'] = vars['localversion'] - override_localversion = config_image.get('override-localversion', None) - if override_localversion is not None: - vars['localversion-image'] = vars['localversion_headers'] + '-' + override_localversion - - for i in ( - ('compiler', 'COMPILER'), - ('kernel-arch', 'KERNEL_ARCH'), - ('localversion', 'LOCALVERSION'), - ('type', 'TYPE'), - ): - makeflags[i[1]] = vars[i[0]] - for i in ( - ('cflags', 'CFLAGS'), - ('initramfs', 'INITRAMFS'), - ('kpkg-arch', 'KPKG_ARCH'), - ('kpkg-subarch', 'KPKG_SUBARCH'), - ('localversion-image', 'LOCALVERSION_IMAGE'), - ('override-host-type', 'OVERRIDE_HOST_TYPE'), - ): - if vars.has_key(i[0]): - makeflags[i[1]] = vars[i[0]] - makeflags['KERNEL_HEADER_DIRS'] = vars.get('kernel-header-dirs', vars.get('kernel-arch')) - - def do_flavour_packages(self, packages, makefile, arch, featureset, flavour, vars, makeflags, extra): - headers = self.templates["control.headers"] - - config_entry_base = self.config.merge('base', arch, featureset, flavour) - config_entry_relations = self.config.merge('relations', arch, featureset, flavour) - - compiler = config_entry_base.get('compiler', 'gcc') - relations_compiler = 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: - item.arches = [arch] - packages['source']['Build-Depends'].extend(relations_compiler_build_dep) - - image_relations = { - 'conflicts': PackageRelation(), - 'depends': PackageRelation(), - } - if vars.get('initramfs', True): - generators = vars['initramfs-generators'] - config_entry_commands_initramfs = self.config.merge('commands-image-initramfs-generators', arch, featureset, flavour) - commands = [config_entry_commands_initramfs[i] for i in generators if config_entry_commands_initramfs.has_key(i)] - makeflags['INITRD_CMD'] = ' '.join(commands) - l_depends = PackageRelationGroup() - for i in generators: - i = config_entry_relations.get(i, i) - l_depends.append(i) - a = PackageRelationEntry(i) - if a.operator is not None: - a.operator = -a.operator - image_relations['conflicts'].append(PackageRelationGroup([a])) - image_relations['depends'].append(l_depends) - - packages_dummy = [] - packages_own = [] - - if vars['type'] == 'plain-s390-tape': - image = self.templates["control.image.type-standalone"] - build_modules = False - elif vars['type'] == 'plain-xen': - image = self.templates["control.image.type-modulesextra"] - build_modules = True - config_entry_xen = self.config.merge('xen', arch, featureset, flavour) - if config_entry_xen.get('dom0-support', True): - p = self.process_packages(self.templates['control.xen-linux-system'], vars) - l = PackageRelationGroup() - for version in config_entry_xen['versions']: - l.append("xen-hypervisor-%s-%s" % (version, config_entry_xen['flavour'])) - makeflags['XEN_VERSIONS'] = ' '.join(['%s-%s' % (i, config_entry_xen['flavour']) for i in config_entry_xen['versions']]) - p[0]['Depends'].append(l) - packages_dummy.extend(p) - else: - build_modules = True - image = self.templates["control.image.type-%s" % vars['type']] - #image = self.templates["control.image.type-modulesinline"] - - if not vars.has_key('desc'): - vars['desc'] = None - - packages_own.append(self.process_real_image(image[0], image_relations, config_entry_relations, vars)) - packages_own.extend(self.process_packages(image[1:], vars)) - - if build_modules: - makeflags['MODULES'] = True - package_headers = self.process_package(headers[0], vars) - package_headers['Depends'].extend(relations_compiler) - packages_own.append(package_headers) - extra['headers_arch_depends'].append('%s (= ${Source-Version})' % packages_own[-1]['Package']) - - for package in packages_own + packages_dummy: - name = package['Package'] - if packages.has_key(name): - package = packages.get(name) - package['Architecture'].append(arch) - else: - package['Architecture'] = [arch] - packages.append(package) - - if vars['type'] == 'plain-xen': - for i in ('postinst', 'postrm', 'prerm'): - j = self.substitute(self.templates["image.xen.%s" % i], vars) - file("debian/%s.%s" % (packages_own[0]['Package'], i), 'w').write(j) - - def get_config(*entry_name): - entry_real = ('image',) + entry_name - entry = self.config.get(entry_real, None) - if entry is None: - return None - return entry.get('configs', None) - - def check_config_default(fail, f): - for d in self.config_dirs[::-1]: - f1 = d + '/' + f - if os.path.exists(f1): - return [f1] - if fail: - raise RuntimeError("%s unavailable" % f) - return [] - - def check_config_files(files): - ret = [] - for f in files: - for d in self.config_dirs[::-1]: - f1 = d + '/' + f - if os.path.exists(f1): - ret.append(f1) - break - else: - raise RuntimeError("%s unavailable" % f) - return ret - - def check_config(default, fail, *entry_name): - configs = get_config(*entry_name) - if configs is None: - return check_config_default(fail, default) - return check_config_files(configs) - - kconfig = check_config('config', True) - kconfig.extend(check_config("%s/config" % arch, True, arch)) - kconfig.extend(check_config("%s/config.%s" % (arch, flavour), False, arch, None, flavour)) - kconfig.extend(check_config("featureset-%s/config" % featureset, False, None, featureset)) - kconfig.extend(check_config("%s/%s/config" % (arch, featureset), False, arch, featureset)) - kconfig.extend(check_config("%s/%s/config.%s" % (arch, featureset, flavour), False, arch, featureset, flavour)) - makeflags['KCONFIG'] = ' '.join(kconfig) - - cmds_binary_arch = [] - cmds_binary_arch.append("$(MAKE) -f debian/rules.real binary-arch-flavour %s" % makeflags) - if packages_dummy: - cmds_binary_arch.append("$(MAKE) -f debian/rules.real install-dummy DH_OPTIONS='%s' %s" % (' '.join(["-p%s" % i['Package'] for i in packages_dummy]), makeflags)) - cmds_build = ["$(MAKE) -f debian/rules.real build %s" % makeflags] - cmds_setup = ["$(MAKE) -f debian/rules.real setup-flavour %s" % makeflags] - makefile.add('binary-arch_%s_%s_%s_real' % (arch, featureset, flavour), cmds = cmds_binary_arch) - makefile.add('build_%s_%s_%s_real' % (arch, featureset, flavour), cmds = cmds_build) - makefile.add('setup_%s_%s_%s_real' % (arch, featureset, flavour), cmds = cmds_setup) - - def do_extra(self, packages, makefile): - apply = self.templates['patch.apply'] - - vars = { - 'revisions': 'orig ' + ' '.join([i.debian for i in self.versions[::-1]]), - 'upstream': self.version.upstream, - 'linux_upstream': self.version.linux_upstream, - 'abiname': self.abiname, - } - - apply = self.substitute(apply, vars) - - file('debian/bin/patch.apply', 'w').write(apply) - - def process_changelog(self): - act_upstream = self.changelog[0].version.linux_upstream - versions = [] - for i in self.changelog: - if i.version.linux_upstream != act_upstream: - break - versions.append(i.version) - self.versions = versions - self.version = self.changelog[0].version - if self.version.linux_modifier is not None: - self.abiname = '' - else: - self.abiname = '-%s' % self.config['abi',]['abiname'] - self.vars = { - 'upstreamversion': self.version.linux_upstream, - 'version': self.version.linux_version, - 'source_upstream': self.version.upstream, - 'major': self.version.linux_major, - 'abiname': self.abiname, - } - self.config['version',] = {'source': self.version.complete, 'abiname': self.abiname} - - def process_real_image(self, in_entry, relations, config, vars): - entry = self.process_package(in_entry, vars) - for field in 'Depends', 'Provides', 'Suggests', 'Recommends', 'Conflicts': - value = entry.get(field, PackageRelation()) - t = vars.get(field.lower(), []) - value.extend(t) - t = relations.get(field.lower(), []) - value.extend(t) - if value: - entry[field] = value - return entry - - def process_real_tree(self, in_entry, vars): - entry = self.process_package(in_entry, vars) - for i in (('Depends', 'Provides')): - value = PackageRelation() - value.extend(entry.get(i, [])) - if i == 'Depends': - v = self.changelog[0].version - value.append("linux-patch-debian-%s (= %s)" % (v.linux_version, v.complete)) - value.append(' | '.join(["linux-source-%s (= %s)" % (v.linux_version, v.complete) for v in self.versions])) - elif i == 'Provides': - value.extend(["linux-tree-%s" % v.complete.replace('~', '-') for v in self.versions]) - entry[i] = value - return entry - - def write(self, packages, makefile): - self.write_config() - super(Gencontrol, self).write(packages, makefile) - - def write_config(self): - f = file("debian/config.defines.dump", 'w') - self.config.dump(f) - f.close() - -if __name__ == '__main__': - Gencontrol()() diff --git a/debian/bin/genorig.py b/debian/bin/genorig.py deleted file mode 100755 index d0d598274124..000000000000 --- a/debian/bin/genorig.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python - -import sys -sys.path.append("debian/lib/python") - -import os, os.path, re, shutil -from debian_linux.debian import Changelog, VersionLinux -from debian_linux.patches import PatchSeries - -class Main(object): - def __init__(self, input_tar, input_patch, override_version): - self.log = sys.stdout.write - - self.input_tar = input_tar - self.input_patch = input_patch - - changelog = Changelog(version = VersionLinux)[0] - source = changelog.source - version = changelog.version - - if override_version: - version = VersionLinux('%s-undef' % override_version) - - self.version_dfsg = version.linux_dfsg - if self.version_dfsg is None: - self.version_dfsg = '0' - - self.log('Using source name %s, version %s, dfsg %s\n' % (source, version.upstream, self.version_dfsg)) - - self.orig = '%s-%s' % (source, version.upstream) - self.orig_tar = '%s_%s.orig.tar.gz' % (source, version.upstream) - - def __call__(self): - import tempfile - self.dir = tempfile.mkdtemp(prefix = 'genorig', dir = 'debian') - try: - self.upstream_extract() - self.upstream_patch() - self.debian_patch() - self.tar() - finally: - shutil.rmtree(self.dir) - - def upstream_extract(self): - self.log("Extracting tarball %s\n" % self.input_tar) - match = re.match(r'(^|.*/)(?P<dir>linux-\d+\.\d+\.\d+(-\S+)?)\.tar(\.(?P<extension>(bz2|gz)))?$', self.input_tar) - if not match: - raise RuntimeError("Can't identify name of tarball") - cmdline = ['tar -xf', self.input_tar, '-C', self.dir] - if match.group('extension') == 'bz2': - cmdline.append('-j') - elif match.group('extension') == 'gz': - cmdline.append('-z') - if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]): - raise RuntimeError("Can't extract tarball") - os.rename(os.path.join(self.dir, match.group('dir')), os.path.join(self.dir, self.orig)) - - def upstream_patch(self): - if self.input_patch is None: - return - self.log("Patching source with %s\n" % self.input_patch) - match = re.match(r'(^|.*/)patch-\d+\.\d+\.\d+(-\S+?)?(\.(?P<extension>(bz2|gz)))?$', self.input_patch) - if not match: - raise RuntimeError("Can't identify name of patch") - cmdline = [] - if match.group('extension') == 'bz2': - cmdline.append('bzcat') - elif match.group('extension') == 'gz': - cmdline.append('zcat') - else: - cmdline.append('cat') - cmdline.append(self.input_patch) - cmdline.append('| (cd %s; patch -p1 -f -s -t --no-backup-if-mismatch)' % os.path.join(self.dir, self.orig)) - if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]): - raise RuntimeError("Can't patch source") - - def debian_patch(self): - name = "orig-" + self.version_dfsg - self.log("Patching source with debian patch (series %s)\n" % name) - fp = file("debian/patches/series/" + name) - series = PatchSeries(name, "debian/patches", fp) - series(dir = os.path.join(self.dir, self.orig)) - - def tar(self): - out = os.path.join("../orig", self.orig_tar) - try: - os.mkdir("../orig") - except OSError: pass - try: - os.stat(out) - raise RuntimeError("Destination already exists") - except OSError: pass - self.log("Generate tarball %s\n" % out) - cmdline = ['tar -czf', out, '-C', self.dir, self.orig] - try: - if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]): - raise RuntimeError("Can't patch source") - os.chmod(out, 0644) - except: - try: - os.unlink(out) - except OSError: - pass - raise - -if __name__ == '__main__': - from optparse import OptionParser - parser = OptionParser(usage = "%prog [OPTION]... TAR [PATCH]") - parser.add_option("-V", "--override-version", dest = "override_version", help = "Override version", metavar = "VERSION") - options, args = parser.parse_args() - - input_tar = args[0] - input_patch = None - if len(args) > 1: - input_patch = args[1] - - Main(input_tar, input_patch, options.override_version)() diff --git a/debian/bin/kconfig.py b/debian/bin/kconfig.py deleted file mode 100755 index a8fee49468fd..000000000000 --- a/debian/bin/kconfig.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python - -import optparse, os.path, sys -from debian_linux.kconfig import * - -def merge(output, *config): - kconfig = KconfigFile() - for c in config: - kconfig.read(file(c)) - file(output, "w").write(str(kconfig)) - -if __name__ == '__main__': - sys.exit(merge(*sys.argv[1:])) |