debian/bin: PEP8 and other style fixes.
svn path=/dists/trunk/linux-2.6/; revision=18489
This commit is contained in:
parent
9863acaddd
commit
a4a27ffb31
|
@ -3,7 +3,12 @@
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(sys.path[0] + "/../lib/python")
|
sys.path.append(sys.path[0] + "/../lib/python")
|
||||||
|
|
||||||
import optparse, os, shutil, tempfile, urllib2
|
import optparse
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
import urllib2
|
||||||
|
|
||||||
from debian_linux.abi import Symbols
|
from debian_linux.abi import Symbols
|
||||||
from debian_linux.config import *
|
from debian_linux.config import *
|
||||||
from debian_linux.debian import *
|
from debian_linux.debian import *
|
||||||
|
@ -11,6 +16,7 @@ from debian_linux.debian import *
|
||||||
default_url_base = "http://ftp.de.debian.org/debian/"
|
default_url_base = "http://ftp.de.debian.org/debian/"
|
||||||
default_url_base_incoming = "http://incoming.debian.org/"
|
default_url_base_incoming = "http://incoming.debian.org/"
|
||||||
|
|
||||||
|
|
||||||
class url_debian_flat(object):
|
class url_debian_flat(object):
|
||||||
def __init__(self, base):
|
def __init__(self, base):
|
||||||
self.base = base
|
self.base = base
|
||||||
|
@ -18,6 +24,7 @@ class url_debian_flat(object):
|
||||||
def __call__(self, source, filename):
|
def __call__(self, source, filename):
|
||||||
return self.base + filename
|
return self.base + filename
|
||||||
|
|
||||||
|
|
||||||
class url_debian_pool(object):
|
class url_debian_pool(object):
|
||||||
def __init__(self, base):
|
def __init__(self, base):
|
||||||
self.base = base
|
self.base = base
|
||||||
|
@ -25,10 +32,11 @@ class url_debian_pool(object):
|
||||||
def __call__(self, source, filename):
|
def __call__(self, source, filename):
|
||||||
return self.base + "pool/main/" + source[0] + "/" + source + "/" + filename
|
return self.base + "pool/main/" + source[0] + "/" + source + "/" + filename
|
||||||
|
|
||||||
class main(object):
|
|
||||||
|
class Main(object):
|
||||||
dir = None
|
dir = None
|
||||||
|
|
||||||
def __init__(self, url, url_config = None, arch = None, featureset = None, flavour = None):
|
def __init__(self, url, url_config=None, arch=None, featureset=None, flavour=None):
|
||||||
self.log = sys.stdout.write
|
self.log = sys.stdout.write
|
||||||
|
|
||||||
self.url = self.url_config = url
|
self.url = self.url_config = url
|
||||||
|
@ -38,7 +46,7 @@ class main(object):
|
||||||
self.override_featureset = featureset
|
self.override_featureset = featureset
|
||||||
self.override_flavour = flavour
|
self.override_flavour = flavour
|
||||||
|
|
||||||
changelog = Changelog(version = VersionLinux)
|
changelog = Changelog(version=VersionLinux)
|
||||||
while changelog[0].distribution == 'UNRELEASED':
|
while changelog[0].distribution == 'UNRELEASED':
|
||||||
changelog.pop(0)
|
changelog.pop(0)
|
||||||
changelog = changelog[0]
|
changelog = changelog[0]
|
||||||
|
@ -47,12 +55,12 @@ class main(object):
|
||||||
self.version = changelog.version.linux_version
|
self.version = changelog.version.linux_version
|
||||||
self.version_source = changelog.version.complete
|
self.version_source = changelog.version.complete
|
||||||
|
|
||||||
local_config = ConfigCoreDump(fp = file("debian/config.defines.dump"))
|
local_config = ConfigCoreDump(fp=file("debian/config.defines.dump"))
|
||||||
|
|
||||||
self.version_abi = local_config['version',]['abiname']
|
self.version_abi = local_config['version', ]['abiname']
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
self.dir = tempfile.mkdtemp(prefix = 'abiupdate')
|
self.dir = tempfile.mkdtemp(prefix='abiupdate')
|
||||||
try:
|
try:
|
||||||
self.log("Retreive config\n")
|
self.log("Retreive config\n")
|
||||||
config = self.get_config()
|
config = self.get_config()
|
||||||
|
@ -85,7 +93,7 @@ class main(object):
|
||||||
f = self.retrieve_package(self.url_config, filename)
|
f = self.retrieve_package(self.url_config, filename)
|
||||||
d = self.extract_package(f, "linux-support")
|
d = self.extract_package(f, "linux-support")
|
||||||
c = d + "/usr/src/linux-support-" + self.version_abi + "/config.defines.dump"
|
c = d + "/usr/src/linux-support-" + self.version_abi + "/config.defines.dump"
|
||||||
config = ConfigCoreDump(fp = file(c))
|
config = ConfigCoreDump(fp=file(c))
|
||||||
shutil.rmtree(d)
|
shutil.rmtree(d)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -155,20 +163,20 @@ class main(object):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
options = optparse.OptionParser()
|
options = optparse.OptionParser()
|
||||||
options.add_option("-i", "--incoming", action = "store_true", dest = "incoming")
|
options.add_option("-i", "--incoming", action="store_true", dest="incoming")
|
||||||
options.add_option("--incoming-config", action = "store_true", dest = "incoming_config")
|
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("-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)
|
options.add_option("--url-base-incoming", dest="url_base_incoming", default=default_url_base_incoming)
|
||||||
|
|
||||||
opts, args = options.parse_args()
|
opts, args = options.parse_args()
|
||||||
|
|
||||||
kw = {}
|
kw = {}
|
||||||
if len(args) >= 1:
|
if len(args) >= 1:
|
||||||
kw['arch'] =args[0]
|
kw['arch'] = args[0]
|
||||||
if len(args) >= 2:
|
if len(args) >= 2:
|
||||||
kw['featureset'] =args[1]
|
kw['featureset'] = args[1]
|
||||||
if len(args) >= 3:
|
if len(args) >= 3:
|
||||||
kw['flavour'] =args[2]
|
kw['flavour'] = args[2]
|
||||||
|
|
||||||
url_base = url_debian_pool(opts.url_base)
|
url_base = url_debian_pool(opts.url_base)
|
||||||
url_base_incoming = url_debian_flat(opts.url_base_incoming)
|
url_base_incoming = url_debian_flat(opts.url_base_incoming)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class CheckAbi(object):
|
||||||
|
|
||||||
changelog = Changelog(version=VersionLinux)[0]
|
changelog = Changelog(version=VersionLinux)[0]
|
||||||
version = changelog.version.linux_version
|
version = changelog.version.linux_version
|
||||||
abiname = self.config['abi',]['abiname']
|
abiname = self.config['abi', ]['abiname']
|
||||||
self.filename_ref = "debian/abi/%s-%s/%s_%s_%s" % (version, abiname, arch, featureset, flavour)
|
self.filename_ref = "debian/abi/%s-%s/%s_%s_%s" % (version, abiname, arch, featureset, flavour)
|
||||||
|
|
||||||
def __call__(self, out):
|
def __call__(self, out):
|
||||||
|
@ -163,7 +163,7 @@ class CheckAbi(object):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
return filtered
|
return filtered
|
||||||
|
|
||||||
|
|
||||||
class CheckImage(object):
|
class CheckImage(object):
|
||||||
def __init__(self, config, dir, arch, featureset, flavour):
|
def __init__(self, config, dir, arch, featureset, flavour):
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os, os.path, subprocess, sys
|
import sys
|
||||||
sys.path.append("debian/lib/python")
|
sys.path.append("debian/lib/python")
|
||||||
|
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from debian_linux.config import ConfigCoreHierarchy
|
from debian_linux.config import ConfigCoreHierarchy
|
||||||
from debian_linux.debian import *
|
from debian_linux.debian import *
|
||||||
from debian_linux.gencontrol import Gencontrol as Base
|
from debian_linux.gencontrol import Gencontrol as Base
|
||||||
from debian_linux.utils import Templates, read_control
|
from debian_linux.utils import Templates, read_control
|
||||||
|
|
||||||
|
|
||||||
class Gencontrol(Base):
|
class Gencontrol(Base):
|
||||||
def __init__(self, config_dirs = ["debian/config"], template_dirs = ["debian/templates"]):
|
def __init__(self, config_dirs=["debian/config"], template_dirs=["debian/templates"]):
|
||||||
super(Gencontrol, self).__init__(ConfigCoreHierarchy(config_dirs), Templates(template_dirs), VersionLinux)
|
super(Gencontrol, self).__init__(ConfigCoreHierarchy(config_dirs), Templates(template_dirs), VersionLinux)
|
||||||
self.process_changelog()
|
self.process_changelog()
|
||||||
self.config_dirs = config_dirs
|
self.config_dirs = config_dirs
|
||||||
|
@ -53,7 +58,7 @@ class Gencontrol(Base):
|
||||||
|
|
||||||
libc_dev = self.templates["control.libc-dev"]
|
libc_dev = self.templates["control.libc-dev"]
|
||||||
packages_headers_arch[0:0] = self.process_packages(libc_dev, {})
|
packages_headers_arch[0:0] = self.process_packages(libc_dev, {})
|
||||||
|
|
||||||
packages_headers_arch[-1]['Depends'].extend(PackageRelation())
|
packages_headers_arch[-1]['Depends'].extend(PackageRelation())
|
||||||
extra['headers_arch_depends'] = packages_headers_arch[-1]['Depends']
|
extra['headers_arch_depends'] = packages_headers_arch[-1]['Depends']
|
||||||
|
|
||||||
|
@ -61,8 +66,8 @@ class Gencontrol(Base):
|
||||||
|
|
||||||
cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags]
|
cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags]
|
||||||
cmds_source = ["$(MAKE) -f debian/rules.real source-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('binary-arch_%s_real' % arch, cmds=cmds_binary_arch)
|
||||||
makefile.add('source_%s_real' % arch, cmds = cmds_source)
|
makefile.add('source_%s_real' % arch, cmds=cmds_source)
|
||||||
|
|
||||||
# Shortcut to aid architecture bootstrapping
|
# Shortcut to aid architecture bootstrapping
|
||||||
makefile.add('binary-libc-dev_%s' % arch,
|
makefile.add('binary-libc-dev_%s' % arch,
|
||||||
|
@ -94,7 +99,7 @@ class Gencontrol(Base):
|
||||||
# per-featureset packages.
|
# per-featureset packages.
|
||||||
makefile.add(
|
makefile.add(
|
||||||
'binary-arch_%s' % arch,
|
'binary-arch_%s' % arch,
|
||||||
cmds = ["$(MAKE) -f debian/rules.real install-udeb_%s %s "
|
cmds=["$(MAKE) -f debian/rules.real install-udeb_%s %s "
|
||||||
"PACKAGE_NAMES='%s'" %
|
"PACKAGE_NAMES='%s'" %
|
||||||
(arch, makeflags,
|
(arch, makeflags,
|
||||||
' '.join(p['Package'] for p in udeb_packages))])
|
' '.join(p['Package'] for p in udeb_packages))])
|
||||||
|
@ -111,8 +116,8 @@ class Gencontrol(Base):
|
||||||
|
|
||||||
cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-featureset %s" % makeflags]
|
cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-featureset %s" % makeflags]
|
||||||
cmds_source = ["$(MAKE) -f debian/rules.real source-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('binary-arch_%s_%s_real' % (arch, featureset), cmds=cmds_binary_arch)
|
||||||
makefile.add('source_%s_%s_real' % (arch, featureset), cmds = cmds_source)
|
makefile.add('source_%s_%s_real' % (arch, featureset), cmds=cmds_source)
|
||||||
|
|
||||||
flavour_makeflags_base = (
|
flavour_makeflags_base = (
|
||||||
('compiler', 'COMPILER', False),
|
('compiler', 'COMPILER', False),
|
||||||
|
@ -299,9 +304,9 @@ class Gencontrol(Base):
|
||||||
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_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_build = ["$(MAKE) -f debian/rules.real build %s" % makeflags]
|
||||||
cmds_setup = ["$(MAKE) -f debian/rules.real setup-flavour %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('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('build_%s_%s_%s_real' % (arch, featureset, flavour), cmds=cmds_build)
|
||||||
makefile.add('setup_%s_%s_%s_real' % (arch, featureset, flavour), cmds = cmds_setup)
|
makefile.add('setup_%s_%s_%s_real' % (arch, featureset, flavour), cmds=cmds_setup)
|
||||||
|
|
||||||
def do_extra(self, packages, makefile):
|
def do_extra(self, packages, makefile):
|
||||||
apply = self.templates['patch.apply']
|
apply = self.templates['patch.apply']
|
||||||
|
@ -348,7 +353,7 @@ class Gencontrol(Base):
|
||||||
if self.version.linux_modifier is not None:
|
if self.version.linux_modifier is not None:
|
||||||
self.abiname_part = ''
|
self.abiname_part = ''
|
||||||
else:
|
else:
|
||||||
self.abiname_part = '-%s' % self.config['abi',]['abiname']
|
self.abiname_part = '-%s' % self.config['abi', ]['abiname']
|
||||||
# XXX: We need to add another part until after wheezy
|
# XXX: We need to add another part until after wheezy
|
||||||
self.abiname = (re.sub('^(\d+\.\d+)(?=-|$)', r'\1.0',
|
self.abiname = (re.sub('^(\d+\.\d+)(?=-|$)', r'\1.0',
|
||||||
self.version.linux_upstream)
|
self.version.linux_upstream)
|
||||||
|
@ -360,7 +365,7 @@ class Gencontrol(Base):
|
||||||
'source_package': self.changelog[0].source,
|
'source_package': self.changelog[0].source,
|
||||||
'abiname': self.abiname,
|
'abiname': self.abiname,
|
||||||
}
|
}
|
||||||
self.config['version',] = {'source': self.version.complete, 'abiname': self.abiname}
|
self.config['version', ] = {'source': self.version.complete, 'abiname': self.abiname}
|
||||||
|
|
||||||
distribution = self.changelog[0].distribution
|
distribution = self.changelog[0].distribution
|
||||||
if distribution in ('unstable', ):
|
if distribution in ('unstable', ):
|
||||||
|
|
|
@ -12,13 +12,14 @@ import subprocess
|
||||||
from debian_linux.debian import Changelog, VersionLinux
|
from debian_linux.debian import Changelog, VersionLinux
|
||||||
from debian_linux.patches import PatchSeries
|
from debian_linux.patches import PatchSeries
|
||||||
|
|
||||||
|
|
||||||
class Main(object):
|
class Main(object):
|
||||||
def __init__(self, input_files, override_version):
|
def __init__(self, input_files, override_version):
|
||||||
self.log = sys.stdout.write
|
self.log = sys.stdout.write
|
||||||
|
|
||||||
self.input_files = input_files
|
self.input_files = input_files
|
||||||
|
|
||||||
changelog = Changelog(version = VersionLinux)[0]
|
changelog = Changelog(version=VersionLinux)[0]
|
||||||
source = changelog.source
|
source = changelog.source
|
||||||
version = changelog.version
|
version = changelog.version
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ class Main(object):
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
import tempfile
|
import tempfile
|
||||||
self.dir = tempfile.mkdtemp(prefix = 'genorig', dir = 'debian')
|
self.dir = tempfile.mkdtemp(prefix='genorig', dir='debian')
|
||||||
try:
|
try:
|
||||||
if os.path.isdir(self.input_files[0]):
|
if os.path.isdir(self.input_files[0]):
|
||||||
self.upstream_export(self.input_files[0])
|
self.upstream_export(self.input_files[0])
|
||||||
|
@ -103,17 +104,19 @@ class Main(object):
|
||||||
self.log("Patching source with debian patch (series %s)\n" % name)
|
self.log("Patching source with debian patch (series %s)\n" % name)
|
||||||
fp = file("debian/patches/series/" + name)
|
fp = file("debian/patches/series/" + name)
|
||||||
series = PatchSeries(name, "debian/patches", fp)
|
series = PatchSeries(name, "debian/patches", fp)
|
||||||
series(dir = os.path.join(self.dir, self.orig))
|
series(dir=os.path.join(self.dir, self.orig))
|
||||||
|
|
||||||
def tar(self):
|
def tar(self):
|
||||||
out = os.path.join("../orig", self.orig_tar)
|
out = os.path.join("../orig", self.orig_tar)
|
||||||
try:
|
try:
|
||||||
os.mkdir("../orig")
|
os.mkdir("../orig")
|
||||||
except OSError: pass
|
except OSError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
os.stat(out)
|
os.stat(out)
|
||||||
raise RuntimeError("Destination already exists")
|
raise RuntimeError("Destination already exists")
|
||||||
except OSError: pass
|
except OSError:
|
||||||
|
pass
|
||||||
self.log("Generate tarball %s\n" % out)
|
self.log("Generate tarball %s\n" % out)
|
||||||
cmdline = ['tar -czf', out, '-C', self.dir, self.orig]
|
cmdline = ['tar -czf', out, '-C', self.dir, self.orig]
|
||||||
try:
|
try:
|
||||||
|
@ -129,8 +132,8 @@ class Main(object):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
parser = OptionParser(usage = "%prog [OPTION]... {TAR [PATCH] | REPO}")
|
parser = OptionParser(usage="%prog [OPTION]... {TAR [PATCH] | REPO}")
|
||||||
parser.add_option("-V", "--override-version", dest = "override_version", help = "Override version", metavar = "VERSION")
|
parser.add_option("-V", "--override-version", dest="override_version", help="Override version", metavar="VERSION")
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
|
|
||||||
assert 1 <= len(args) <= 2
|
assert 1 <= len(args) <= 2
|
||||||
|
|
|
@ -7,6 +7,7 @@ import sys
|
||||||
|
|
||||||
from debian_linux.kconfig import *
|
from debian_linux.kconfig import *
|
||||||
|
|
||||||
|
|
||||||
def merge(output, configs, overrides):
|
def merge(output, configs, overrides):
|
||||||
kconfig = KconfigFile()
|
kconfig = KconfigFile()
|
||||||
for c in configs:
|
for c in configs:
|
||||||
|
@ -15,6 +16,7 @@ def merge(output, configs, overrides):
|
||||||
kconfig.set(key, value)
|
kconfig.set(key, value)
|
||||||
file(output, "w").write(str(kconfig))
|
file(output, "w").write(str(kconfig))
|
||||||
|
|
||||||
|
|
||||||
def opt_callback_dict(option, opt, value, parser):
|
def opt_callback_dict(option, opt, value, parser):
|
||||||
match = re.match('^\s*(\S+)=(\S+)\s*$', value)
|
match = re.match('^\s*(\S+)=(\S+)\s*$', value)
|
||||||
if not match:
|
if not match:
|
||||||
|
@ -23,8 +25,9 @@ def opt_callback_dict(option, opt, value, parser):
|
||||||
data = getattr(parser.values, dest)
|
data = getattr(parser.values, dest)
|
||||||
data[match.group(1)] = match.group(2)
|
data[match.group(1)] = match.group(2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = optparse.OptionParser(usage = "%prog [OPTION]... FILE...")
|
parser = optparse.OptionParser(usage="%prog [OPTION]... FILE...")
|
||||||
parser.add_option('-o', '--override',
|
parser.add_option('-o', '--override',
|
||||||
action='callback',
|
action='callback',
|
||||||
callback=opt_callback_dict,
|
callback=opt_callback_dict,
|
||||||
|
|
Loading…
Reference in New Issue