* debian/bin/abicheck.py, debian/bin/abiupdate.py: Use config dump.
* debian/bin/gencontrol.py - Read real config. - Write version infos into config. - Generate config dump. * debian/changelog: Update. * debian/lib/python/debian_linux/config.py: Support config dumps. * debian/lib/python/debian_linux/gencontrol.py - Don't specify type of config. - Split result writing. * debian/rules: Remove dumped config. * debian/rules.real (install-support) - Install only dumped config. - Don't install recursive. svn path=/dists/trunk/linux-2.6/; revision=9664
This commit is contained in:
parent
f9158ce70c
commit
b4308079b0
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('debian/lib/python')
|
||||
|
||||
from debian_linux.abi import *
|
||||
from debian_linux.config import *
|
||||
from debian_linux.config import ConfigCoreDump
|
||||
|
||||
class checker(object):
|
||||
def __init__(self, dir, arch, featureset, flavour):
|
||||
self.config = ConfigReaderCore(["debian/config"])
|
||||
self.config = ConfigCoreDump(fp = file("debian/config.defines.dump"))
|
||||
self.filename_new = "%s/Module.symvers" % dir
|
||||
abiname = self.config['abi',]['abiname']
|
||||
self.filename_ref = "debian/abi/%s/%s_%s_%s" % (abiname, arch, featureset, flavour)
|
||||
|
|
|
@ -47,7 +47,7 @@ class main(object):
|
|||
self.version = changelog.version.linux_version
|
||||
self.version_source = changelog.version.complete
|
||||
|
||||
local_config = ConfigReaderCore(["debian/config"])
|
||||
local_config = ConfigCoreDump(fp = file("debian/config.defines.dump"))
|
||||
|
||||
self.abiname = local_config['abi',]['abiname']
|
||||
self.version_abi = self.version + '-' + self.abiname
|
||||
|
@ -72,11 +72,7 @@ class main(object):
|
|||
os.system("dpkg-deb --extract %s %s" % (filename, base_out))
|
||||
return base_out
|
||||
|
||||
def get_abi(self, arch, featureset, flavour):
|
||||
if featureset == 'none':
|
||||
prefix = flavour
|
||||
else:
|
||||
prefix = featureset + '-' + flavour
|
||||
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))
|
||||
|
@ -89,8 +85,8 @@ class main(object):
|
|||
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")
|
||||
dir = d + "/usr/src/linux-support-" + self.version_abi + "/config"
|
||||
config = ConfigReaderCore([dir])
|
||||
c = d + "/usr/src/linux-support-" + self.version_abi + "/config.defines.dump"
|
||||
config = ConfigCoreDump(fp = file(c))
|
||||
shutil.rmtree(d)
|
||||
return config
|
||||
|
||||
|
@ -122,23 +118,32 @@ class main(object):
|
|||
self.update_featureset(config, arch, featureset)
|
||||
|
||||
def update_featureset(self, config, arch, featureset):
|
||||
config_entry = config[('base', arch, featureset)]
|
||||
if not config_entry.get('modules', True):
|
||||
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_entry['flavours']
|
||||
flavours = config_base['flavours']
|
||||
for flavour in flavours:
|
||||
self.update_flavour(config, arch, featureset, flavour)
|
||||
|
||||
def update_flavour(self, config, arch, featureset, flavour):
|
||||
config_entry = config[('base', arch, featureset, flavour)]
|
||||
if not config_entry.get('modules', True):
|
||||
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:
|
||||
abi = self.get_abi(arch, featureset, flavour)
|
||||
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:
|
||||
|
|
|
@ -3,12 +3,14 @@
|
|||
import os, sys
|
||||
sys.path.append("debian/lib/python")
|
||||
|
||||
from debian_linux.gencontrol import Gencontrol as Base
|
||||
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__(config_dirs = config_dirs, template_dirs = template_dirs)
|
||||
super(Gencontrol, self).__init__(ConfigCoreHierarchy(config_dirs), Templates(template_dirs))
|
||||
self.process_changelog()
|
||||
self.config_dirs = config_dirs
|
||||
|
||||
|
@ -267,6 +269,7 @@ class Gencontrol(Base):
|
|||
else:
|
||||
self.abiname = '-%s' % self.config['abi',]['abiname']
|
||||
self.vars = self.process_version_linux(self.version, 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)
|
||||
|
@ -295,5 +298,14 @@ class Gencontrol(Base):
|
|||
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()()
|
||||
|
|
|
@ -82,6 +82,8 @@ linux-2.6 (2.6.23-1~experimental.1) UNRELEASED; urgency=low
|
|||
- Broadcom NetXtremeII support
|
||||
* Add -common to common header package names.
|
||||
* Drop provides from common header packages.
|
||||
* Update plain image type.
|
||||
* Put only a config dump into linux-support.
|
||||
|
||||
[ Aurelien Jarno ]
|
||||
* [mips, mipsel] Add a 64-bit image (5kc-malta) for the MIPS Malta board.
|
||||
|
@ -98,10 +100,7 @@ linux-2.6 (2.6.23-1~experimental.1) UNRELEASED; urgency=low
|
|||
[ dann frazier ]
|
||||
* [ia64] Re-enable various unintentionally disabled config options
|
||||
|
||||
[ Bastian Blank ]
|
||||
* Update plain image type.
|
||||
|
||||
-- Bastian Blank <waldi@debian.org> Sun, 14 Oct 2007 12:37:43 +0200
|
||||
-- Bastian Blank <waldi@debian.org> Sun, 14 Oct 2007 16:23:53 +0200
|
||||
|
||||
linux-2.6 (2.6.22-5) unstable; urgency=low
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import os, os.path, re, sys, textwrap
|
||||
|
||||
__all__ = [
|
||||
'ConfigCoreDump',
|
||||
'ConfigCoreHierarchy',
|
||||
'ConfigParser',
|
||||
'ConfigReaderCore',
|
||||
]
|
||||
|
||||
class SchemaItemBoolean(object):
|
||||
|
@ -24,7 +25,51 @@ class SchemaItemList(object):
|
|||
return []
|
||||
return [j.strip() for j in re.split(self.type, i)]
|
||||
|
||||
class ConfigReaderCore(dict):
|
||||
class ConfigCore(dict):
|
||||
def merge(self, section, arch = None, featureset = None, flavour = None):
|
||||
ret = {}
|
||||
ret.update(self.get((section,), {}))
|
||||
if featureset:
|
||||
ret.update(self.get((section, None, featureset), {}))
|
||||
if arch:
|
||||
ret.update(self.get((section, arch), {}))
|
||||
if arch and featureset:
|
||||
ret.update(self.get((section, arch, featureset), {}))
|
||||
if arch and featureset and flavour:
|
||||
ret.update(self.get((section, arch, None, flavour), {}))
|
||||
ret.update(self.get((section, arch, featureset, flavour), {}))
|
||||
return ret
|
||||
|
||||
def dump(self, fp):
|
||||
sections = self.keys()
|
||||
sections.sort()
|
||||
for section in sections:
|
||||
fp.write('[%r]\n' % (section,))
|
||||
items = self[section]
|
||||
items_keys = items.keys()
|
||||
items_keys.sort()
|
||||
for item in items:
|
||||
fp.write('%s: %r\n' % (item, items[item]))
|
||||
fp.write('\n')
|
||||
|
||||
class ConfigCoreDump(ConfigCore):
|
||||
def __init__(self, config = None, fp = None):
|
||||
super(ConfigCoreDump, self).__init__(self)
|
||||
if config is not None:
|
||||
self.update(config)
|
||||
if fp is not None:
|
||||
from ConfigParser import RawConfigParser
|
||||
config = RawConfigParser()
|
||||
config.readfp(fp)
|
||||
for section in config.sections():
|
||||
section_real = eval(section)
|
||||
data = {}
|
||||
for key, value in config.items(section):
|
||||
value_real = eval(value)
|
||||
data[key] = value_real
|
||||
self[section_real] = data
|
||||
|
||||
class ConfigCoreHierarchy(ConfigCore):
|
||||
config_name = "defines"
|
||||
|
||||
schemas = {
|
||||
|
@ -49,6 +94,7 @@ class ConfigReaderCore(dict):
|
|||
}
|
||||
|
||||
def __init__(self, dirs = []):
|
||||
super(ConfigCoreHierarchy, self).__init__()
|
||||
self._dirs = dirs
|
||||
self._read_base()
|
||||
|
||||
|
@ -98,7 +144,7 @@ class ConfigReaderCore(dict):
|
|||
config.read(self.get_files(self.config_name))
|
||||
|
||||
arches = config['base',]['arches']
|
||||
featuresets = config['base',]['featuresets']
|
||||
featuresets = config['base',].get('featuresets', [])
|
||||
|
||||
for section in iter(config):
|
||||
if section[0].startswith('featureset-'):
|
||||
|
@ -125,20 +171,6 @@ class ConfigReaderCore(dict):
|
|||
def get_files(self, name):
|
||||
return [os.path.join(i, name) for i in self._dirs if i]
|
||||
|
||||
def merge(self, section, arch = None, featureset = None, flavour = None):
|
||||
ret = {}
|
||||
ret.update(self.get((section,), {}))
|
||||
if featureset:
|
||||
ret.update(self.get((section, None, featureset), {}))
|
||||
if arch:
|
||||
ret.update(self.get((section, arch), {}))
|
||||
if arch and featureset:
|
||||
ret.update(self.get((section, arch, featureset), {}))
|
||||
if arch and featureset and flavour:
|
||||
ret.update(self.get((section, arch, None, flavour), {}))
|
||||
ret.update(self.get((section, arch, featureset, flavour), {}))
|
||||
return ret
|
||||
|
||||
class ConfigParser(object):
|
||||
__slots__ = '_config', 'schemas'
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from config import *
|
||||
from debian import *
|
||||
from utils import *
|
||||
from utils import SortedDict
|
||||
|
||||
class PackagesList(SortedDict):
|
||||
def append(self, package):
|
||||
|
@ -70,9 +69,8 @@ class MakeFlags(dict):
|
|||
class Gencontrol(object):
|
||||
makefile_targets = ('binary-arch', 'build', 'setup', 'source')
|
||||
|
||||
def __init__(self, config_dirs, template_dirs):
|
||||
self.config = ConfigReaderCore(config_dirs)
|
||||
self.templates = Templates(template_dirs)
|
||||
def __init__(self, config, templates):
|
||||
self.config, self.templates = config, templates
|
||||
|
||||
def __call__(self):
|
||||
packages = PackagesList()
|
||||
|
@ -82,8 +80,7 @@ class Gencontrol(object):
|
|||
self.do_main(packages, makefile)
|
||||
self.do_extra(packages, makefile)
|
||||
|
||||
self.write_control(packages.itervalues())
|
||||
self.write_makefile(makefile)
|
||||
self.write(packages, makefile)
|
||||
|
||||
def do_source(self, packages):
|
||||
source = self.templates["control.source"]
|
||||
|
@ -296,6 +293,15 @@ class Gencontrol(object):
|
|||
return vars[match.group(1)]
|
||||
return re.sub(r'@([-_a-z]+)@', subst, s)
|
||||
|
||||
def write(self, packages, makefile):
|
||||
self.write_control(packages.itervalues())
|
||||
self.write_makefile(makefile)
|
||||
|
||||
def write_config(self):
|
||||
f = file("debian/config.dump", 'w')
|
||||
self.config.write(f)
|
||||
f.close()
|
||||
|
||||
def write_control(self, list):
|
||||
self.write_rfc822(file("debian/control", 'w'), list)
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ else
|
|||
endif
|
||||
|
||||
maintainerclean:
|
||||
rm -f debian/control debian/control.md5sum debian/rules.gen debian/bin/patch.* debian/linux-*
|
||||
rm -f debian/config.defines.dump debian/control debian/control.md5sum debian/rules.gen debian/bin/patch.* debian/linux-*
|
||||
rm -rf $(filter-out debian .svk .svn, $(wildcard * .[^.]*))
|
||||
|
||||
clean: debian/control
|
||||
|
|
|
@ -341,14 +341,17 @@ install-libc-dev_$(ARCH):
|
|||
install-support: PACKAGE_NAME = linux-support-$(UPSTREAMVERSION)$(ABINAME)
|
||||
install-support: DH_OPTIONS = -p$(PACKAGE_NAME)
|
||||
install-support: PACKAGE_DIR = debian/$(PACKAGE_NAME)
|
||||
install-support: PACKAGE_ROOT = /usr/src/$(PACKAGE_NAME)
|
||||
install-support:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k -d
|
||||
chmod a+x debian/modules/gencontrol.py
|
||||
dh_install debian/config debian/lib debian/modules /usr/src/$(PACKAGE_NAME)
|
||||
dh_installdirs $(PACKAGE_ROOT)/lib/python/debian_linux $(PACKAGE_ROOT)/modules
|
||||
cp debian/config.defines.dump $(PACKAGE_DIR)$(PACKAGE_ROOT)
|
||||
cp debian/lib/python/debian_linux/*.py $(PACKAGE_DIR)$(PACKAGE_ROOT)/lib/python/debian_linux
|
||||
cp debian/modules/* $(PACKAGE_DIR)$(PACKAGE_ROOT)/modules
|
||||
chmod a+x $(PACKAGE_DIR)$(PACKAGE_ROOT)/modules/gencontrol.py
|
||||
dh_pycentral /usr/src/$(PACKAGE_NAME)/lib/python
|
||||
echo -e "[version]\nsource: $(SOURCEVERSION)\nabiname: $(ABINAME)" > $(PACKAGE_DIR)/usr/src/$(PACKAGE_NAME)/version
|
||||
$(MAKE_SELF) install-base
|
||||
|
||||
install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): REAL_VERSION = $(UPSTREAMVERSION)$(ABINAME)$(LOCALVERSION)
|
||||
|
|
Loading…
Reference in New Issue