diff options
author | Bastian Blank <waldi@debian.org> | 2006-01-04 19:33:32 +0000 |
---|---|---|
committer | Bastian Blank <waldi@debian.org> | 2006-01-04 19:33:32 +0000 |
commit | f5ea6ce5082dac2e03ede3f9a47bf1f3f85e7ffa (patch) | |
tree | 271e4f0fb25ae317c018be4a550815d0e9a16da2 /debian/lib/python/debian_linux/utils.py | |
parent | 9ddce5fa578efd29a3319d79a7f2d718a1855fcd (diff) | |
download | kernel_replicant_linux-f5ea6ce5082dac2e03ede3f9a47bf1f3f85e7ffa.tar.gz kernel_replicant_linux-f5ea6ce5082dac2e03ede3f9a47bf1f3f85e7ffa.tar.bz2 kernel_replicant_linux-f5ea6ce5082dac2e03ede3f9a47bf1f3f85e7ffa.zip |
* Move most parts of debian/bin/gencontrol.py to debian/lib.
* 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
Diffstat (limited to 'debian/lib/python/debian_linux/utils.py')
-rw-r--r-- | debian/lib/python/debian_linux/utils.py | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/debian/lib/python/debian_linux/utils.py b/debian/lib/python/debian_linux/utils.py new file mode 100644 index 000000000000..22c93b20904d --- /dev/null +++ b/debian/lib/python/debian_linux/utils.py @@ -0,0 +1,175 @@ +import re, textwrap + +class _sorted_dict(dict): + __slots__ = ('_list') + + def __init__(self, entries = None): + super(_sorted_dict, self).__init__() + self._list = [] + if entries is not None: + for key, value in entries: + self[key] = value + + def __delitem__(self, key): + super(_sorted_dict, self).__delitem__(key) + self._list.remove(key) + + def iterkeys(self): + for i in iter(self._list): + yield i + + def iteritems(self): + for i in iter(self._list): + yield (i, self[i]) + + def itervalues(self): + for i in iter(self._list): + yield self[i] + +class sorted_dict(_sorted_dict): + __slots__ = () + + def __setitem__(self, key, value): + super(sorted_dict, self).__setitem__(key, value) + if key not in self._list: + self._list.append(key) + +class field_list(list): + TYPE_WHITESPACE = object() + TYPE_COMMATA = object() + + def __init__(self, value = None, type = TYPE_WHITESPACE): + self.type = type + if isinstance(value, field_list): + self.type = value.type + self.extend(value) + elif isinstance(value, (list, tuple)): + self.extend(value) + else: + self._extend(value) + + def __str__(self): + if self.type is self.TYPE_WHITESPACE: + type = ' ' + elif self.type is self.TYPE_COMMATA: + type = ', ' + return type.join(self) + + def _extend(self, value): + if self.type is self.TYPE_WHITESPACE: + type = '\s' + elif self.type is self.TYPE_COMMATA: + type = ',' + if value is not None: + self.extend([j.strip() for j in re.split(type, value.strip())]) + + def extend(self, value): + if isinstance(value, str): + self._extend(value) + else: + super(field_list, self).extend(value) + +class field_list_commata(field_list): + def __init__(self, value = None): + super(field_list_commata, self).__init__(value, field_list.TYPE_COMMATA) + +class field_string(str): + def __str__(self): + return '\n '.join(self.split('\n')) + +class package(dict): + _fields = sorted_dict(( + ('Package', str), + ('Source', str), + ('Architecture', field_list), + ('Section', str), + ('Priority', str), + ('Maintainer', str), + ('Uploaders', str), + ('Standards-Version', str), + ('Build-Depends', str), + ('Build-Depends-Indep', str), + ('Provides', field_list_commata), + ('Depends', field_list_commata), + ('Recommends', field_list_commata), + ('Suggests', field_list_commata), + ('Replaces', field_list_commata), + ('Conflicts', field_list_commata), + ('Description', field_string), + )) + + def __setitem__(self, key, value): + try: + value = self._fields[key](value) + except KeyError: pass + super(package, self).__setitem__(key, value) + + def iterkeys(self): + for i in self._fields.iterkeys(): + if self.has_key(i) and self[i]: + yield i + + def iteritems(self): + for i in self._fields.iterkeys(): + if self.has_key(i) and self[i]: + yield (i, self[i]) + + def itervalues(self): + for i in self._fields.iterkeys(): + if self.has_key(i) and self[i]: + yield self[i] + +class templates(dict): + def __init__(self, dir = None): + if dir is None: + self.dir = "debian/templates" + else: + self.dir = dir + + def __getitem__(self, key): + try: + return dict.__getitem__(self, key) + except KeyError: pass + ret = self._read(key) + dict.__setitem__(self, key, ret) + return ret + + def __setitem__(self, key, value): + raise NotImplemented() + + def _read(self, filename): + entries = [] + + f = file("%s/%s.in" % (self.dir, filename)) + + while True: + e = package() + while True: + line = f.readline() + if not line: + break + line = line.strip('\n') + if not line: + break + if line[0] in ' \t': + if not last: + raise ValueError('Continuation line seen before first header') + e[last] += '\n' + line.lstrip() + continue + i = line.find(':') + if i < 0: + raise ValueError("Not a header, not a continuation: ``%s''" % line) + last = line[:i] + e[last] = line[i+1:].lstrip() + if not e: + break + + entries.append(e) + + return entries + +class wrap(textwrap.TextWrapper): + wordsep_re = re.compile( + r'(\s+|' # any whitespace + r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash + |