[kernel] r5999 -
people/waldi/linux-2.6/debian/lib/python/debian_linux
Bastian Blank
waldi at costa.debian.org
Thu Mar 2 00:09:55 UTC 2006
Author: waldi
Date: Thu Mar 2 00:09:54 2006
New Revision: 5999
Modified:
people/waldi/linux-2.6/debian/lib/python/debian_linux/config.py
Log:
Revert r5918.
Modified: people/waldi/linux-2.6/debian/lib/python/debian_linux/config.py
==============================================================================
--- people/waldi/linux-2.6/debian/lib/python/debian_linux/config.py (original)
+++ people/waldi/linux-2.6/debian/lib/python/debian_linux/config.py Thu Mar 2 00:09:54 2006
@@ -36,7 +36,6 @@
def __init__(self, underlay = None):
self._underlay = underlay
- self.tree = {}
self._read_base()
def __getitem__(self, key):
@@ -49,17 +48,19 @@
ret.append(os.path.join('debian/arch', name))
return ret
- def _read_arch(self, tree_item, arch):
+ def _read_arch(self, arch):
files = self._get_files("%s/%s" % (arch, self.config_name))
config = config_parser(self.schema, files)
- flavours = config['base',].get('flavours', [])
subarches = config['base',].get('subarches', [])
+ flavours = config['base',].get('flavours', [])
for section in iter(config):
real = list(section)
- if real[-1] in subarches + flavours:
+ if real[-1] in subarches:
real[0:0] = ['base', arch]
+ elif real[-1] in flavours:
+ real[0:0] = ['base', arch, 'none']
else:
real[0:] = [real.pop(), arch]
real = tuple(real)
@@ -67,8 +68,23 @@
s.update(config[section])
self[tuple(real)] = s
- self._read_flavours(flavours, tree_item, arch, ())
- self._read_variants(subarches, tree_item, arch, ())
+ for subarch in subarches:
+ if self.has_key(('base', arch, subarch)):
+ avail = self['base', arch, subarch].get('available', True)
+ else:
+ avail = True
+ if avail:
+ self._read_subarch(arch, subarch)
+
+ if flavours:
+ base = self['base', arch]
+ subarches.insert(0, 'none')
+ base['subarches'] = subarches
+ del base['flavours']
+ self['base', arch] = base
+ self['base', arch, 'none'] = {'flavours': flavours}
+ for flavour in flavours:
+ self._read_flavour(arch, 'none', flavour)
def _read_base(self):
files = self._get_files(self.config_name)
@@ -89,64 +105,34 @@
avail = self['base', arch].get('available', True)
except KeyError:
avail = True
- self.tree[arch] = item = {'available': avail, 'key': (arch,), 'recurse': {}, 'type': 'arch'}
if avail:
- self._read_arch(item['recurse'], arch)
+ self._read_arch(arch)
- import pprint
- pprint.pprint(self.tree)
- pprint.pprint(self)
- raise SystemExit
-
- def _read_flavour(self, arch, variants, flavour):
- key = ('base', arch) + variants + (flavour,)
- if not self.has_key(key):
+ def _read_flavour(self, arch, subarch, flavour):
+ if not self.has_key(('base', arch, subarch, flavour)):
import warnings
- warnings.warn('No config entry for flavour %s, variant %s, arch %s' % (flavour, '-'.join(variants), arch), DeprecationWarning)
- self[key] = {}
+ warnings.warn('No config entry for flavour %s, subarch %s, arch %s' % (flavour, subarch, arch), DeprecationWarning)
+ self['base', arch, subarch, flavour] = {}
- def _read_flavours(self, check, tree_item, arch, variants):
- for flavour in check:
- key = ('base', arch,) + variants + (flavour,)
- if self.has_key(key):
- avail = self[key].get('available', True)
- else:
- avail = True
- tree_item[flavour] = item = {'available': avail, 'key': key[1:], 'type': 'flavour'}
- if avail:
- self._read_flavour(arch, variants, flavour)
-
- def _read_variant(self, tree_item, arch, variants):
- files = self._get_files("/".join((arch,) + variants + (self.config_name,)))
+ def _read_subarch(self, arch, subarch):
+ files = self._get_files("%s/%s/%s" % (arch, subarch, self.config_name))
config = config_parser(self.schema, files)
flavours = config['base',].get('flavours', [])
- subarches = config['base',].get('subarches', [])
for section in iter(config):
real = list(section)
- if real[-1] in flavours + subarches:
- real[0:0] = ['base', arch] + variants
+ if real[-1] in flavours:
+ real[0:0] = ['base', arch, subarch]
else:
- real[0:] = (real.pop(), arch,) + variants
+ real[0:] = [real.pop(), arch, subarch]
real = tuple(real)
s = self.get(real, {})
s.update(config[section])
self[tuple(real)] = s
- self._read_flavours(flavours, tree_item, arch, variants)
- self._read_variants(subarches, tree_item, arch, variants)
-
- def _read_variants(self, check, tree_item, arch, variants):
- for variant in check:
- key = ('base', arch) + variants + (variant,)
- if self.has_key(key):
- avail = self[key].get('available', True)
- else:
- avail = True
- tree_item[variant] = item = {'available': avail, 'key': key[1:], 'recurse': {}, 'type': 'variant'}
- if avail:
- self._read_variant(item['recurse'], arch, variants + (variant,))
+ for flavour in flavours:
+ self._read_flavour(arch, subarch, flavour)
def _update(self, ret, inputkey):
for key, value in super(config_reader, self).get(tuple(inputkey), {}).iteritems():
More information about the Kernel-svn-changes
mailing list