[kernel] r6009 - in people/waldi/linux-2.6/debian: bin
lib/python/debian_linux
Bastian Blank
waldi at costa.debian.org
Thu Mar 2 11:15:22 UTC 2006
Author: waldi
Date: Thu Mar 2 11:15:21 2006
New Revision: 6009
Modified:
people/waldi/linux-2.6/debian/bin/gencontrol.py
people/waldi/linux-2.6/debian/lib/python/debian_linux/debian.py
people/waldi/linux-2.6/debian/lib/python/debian_linux/gencontrol.py
people/waldi/linux-2.6/debian/lib/python/debian_linux/utils.py
Log:
* bin/gencontrol.py: Fix image description addition.
* lib/python/debian_linux/debian.py: Parse Description also.
* lib/python/debian_linux/gencontrol.py: Fix Description setup.
* lib/python/debian_linux/utils.py: Always provide the complete text.
Modified: people/waldi/linux-2.6/debian/bin/gencontrol.py
==============================================================================
--- people/waldi/linux-2.6/debian/bin/gencontrol.py (original)
+++ people/waldi/linux-2.6/debian/bin/gencontrol.py Thu Mar 2 11:15:21 2006
@@ -135,10 +135,9 @@
makefile.append(("setup-%s-%s-%s-real:" % (arch, subarch, flavour), cmds_setup))
def process_real_image(self, in_entry, vars):
- in_entry = in_entry.copy()
- if vars.has_key('desc'):
- in_entry['Description'] += "\n.\n" + vars['desc']
entry = self.process_package(in_entry, vars)
+ if vars.has_key('desc'):
+ entry['Description'].long[1:1] = [vars['desc']]
for field in 'Depends', 'Provides', 'Suggests', 'Recommends', 'Conflicts':
value = entry.get(field, package_relation_list())
t = vars.get(field.lower(), [])
Modified: people/waldi/linux-2.6/debian/lib/python/debian_linux/debian.py
==============================================================================
--- people/waldi/linux-2.6/debian/lib/python/debian_linux/debian.py (original)
+++ people/waldi/linux-2.6/debian/lib/python/debian_linux/debian.py Thu Mar 2 11:15:21 2006
@@ -81,6 +81,25 @@
ret['source_upstream'] = ret['upstream']
return ret
+class package_description(object):
+ __slots__ = "short", "long"
+
+ def __init__(self, value = None):
+ if value is not None:
+ self.short, long = value.split ("\n", 1)
+ self.long = long.split ("\n.\n")
+ else:
+ self.short = None
+ self.long = []
+
+ def __str__(self):
+ ret = self.short + '\n'
+ w = utils.wrap(width = 74, fix_sentence_endings = True)
+ pars = []
+ for i in self.long:
+ pars.append('\n '.join(w.wrap(i)))
+ return self.short + '\n ' + '\n .\n '.join(pars)
+
class package_relation(object):
__slots__ = "name", "version", "arches"
@@ -183,12 +202,14 @@
('Suggests', package_relation_list),
('Replaces', package_relation_list),
('Conflicts', package_relation_list),
- ('Description', utils.field_string),
+ ('Description', package_description),
))
def __setitem__(self, key, value):
try:
- value = self._fields[key](value)
+ cls = self._fields[key]
+ if not isinstance(value, cls):
+ value = cls(value)
except KeyError: pass
super(package, self).__setitem__(key, value)
Modified: people/waldi/linux-2.6/debian/lib/python/debian_linux/gencontrol.py
==============================================================================
--- people/waldi/linux-2.6/debian/lib/python/debian_linux/gencontrol.py (original)
+++ people/waldi/linux-2.6/debian/lib/python/debian_linux/gencontrol.py Thu Mar 2 11:15:21 2006
@@ -227,14 +227,12 @@
e[key] = dep
def process_description(self, e, in_e, vars):
- desc = in_e['Description']
- desc_short, desc_long = desc.split ("\n", 1)
- desc_pars = [self.substitute(i, vars) for i in desc_long.split ("\n.\n")]
- desc_pars_wrapped = []
- w = wrap(width = 74, fix_sentence_endings = True)
- for i in desc_pars:
- desc_pars_wrapped.append(w.fill(i))
- e['Description'] = "%s\n%s" % (self.substitute(desc_short, vars), '\n.\n'.join(desc_pars_wrapped))
+ in_desc = in_e['Description']
+ desc = in_desc.__class__()
+ desc.short = self.substitute(in_desc.short, vars)
+ for i in in_desc.long:
+ desc.long.append(self.substitute(i, vars))
+ e['Description'] = desc
def process_package(self, in_entry, vars):
e = package()
Modified: people/waldi/linux-2.6/debian/lib/python/debian_linux/utils.py
==============================================================================
--- people/waldi/linux-2.6/debian/lib/python/debian_linux/utils.py (original)
+++ people/waldi/linux-2.6/debian/lib/python/debian_linux/utils.py Thu Mar 2 11:15:21 2006
@@ -99,6 +99,8 @@
while True:
e = debian.package()
+ last = None
+ lines = []
while True:
line = f.readline()
if not line:
@@ -109,13 +111,17 @@
if line[0] in ' \t':
if not last:
raise ValueError('Continuation line seen before first header')
- e[last] += '\n' + line.lstrip()
+ lines.append(line.lstrip())
continue
+ if last:
+ e[last] = '\n'.join(lines)
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()
+ lines = [line[i+1:].lstrip()]
+ if last:
+ e[last] = '\n'.join(lines)
if not e:
break
More information about the Kernel-svn-changes
mailing list