2006-02-25 22:41:56 +00:00
|
|
|
import itertools, os.path, re, utils
|
2006-01-04 19:33:32 +00:00
|
|
|
|
2006-02-25 22:41:56 +00:00
|
|
|
def read_changelog(dir = ''):
|
2006-01-04 19:33:32 +00:00
|
|
|
r = re.compile(r"""
|
|
|
|
^
|
|
|
|
(
|
|
|
|
(?P<header>
|
|
|
|
(?P<header_source>
|
|
|
|
\w[-+0-9a-z.]+
|
|
|
|
)
|
|
|
|
\
|
|
|
|
\(
|
|
|
|
(?P<header_version>
|
|
|
|
[^\(\)\ \t]+
|
|
|
|
)
|
|
|
|
\)
|
|
|
|
\s+
|
|
|
|
(?P<header_distribution>
|
|
|
|
[-0-9a-zA-Z]+
|
|
|
|
)
|
|
|
|
\;
|
|
|
|
)
|
|
|
|
)
|
|
|
|
""", re.VERBOSE)
|
2006-02-25 22:41:56 +00:00
|
|
|
f = file(os.path.join(dir, "debian/changelog"))
|
2006-01-04 19:33:32 +00:00
|
|
|
entries = []
|
|
|
|
act_upstream = None
|
|
|
|
while True:
|
|
|
|
line = f.readline()
|
|
|
|
if not line:
|
|
|
|
break
|
|
|
|
line = line.strip('\n')
|
|
|
|
match = r.match(line)
|
|
|
|
if not match:
|
|
|
|
continue
|
|
|
|
if match.group('header'):
|
|
|
|
e = {}
|
|
|
|
e['Distribution'] = match.group('header_distribution')
|
|
|
|
e['Source'] = match.group('header_source')
|
|
|
|
version = parse_version(match.group('header_version'))
|
|
|
|
e['Version'] = version
|
|
|
|
if act_upstream is None:
|
|
|
|
act_upstream = version['upstream']
|
|
|
|
elif version['upstream'] != act_upstream:
|
|
|
|
break
|
|
|
|
entries.append(e)
|
|
|
|
return entries
|
|
|
|
|
|
|
|
def parse_version(version):
|
|
|
|
version_re = ur"""
|
|
|
|
^
|
|
|
|
(?P<source>
|
|
|
|
(?P<parent>
|
|
|
|
\d+\.\d+\.\d+\+
|
|
|
|
)?
|
|
|
|
(?P<upstream>
|
|
|
|
(?P<version>
|
|
|
|
(?P<major>\d+\.\d+)
|
|
|
|
\.
|
|
|
|
\d+
|
|
|
|
)
|
|
|
|
(?:
|
|
|
|
-
|
|
|
|
(?P<modifier>
|
|
|
|
.+?
|
|
|
|
)
|
|
|
|
)?
|
|
|
|
)
|
|
|
|
-
|
|
|
|
(?P<debian>[^-]+)
|
|
|
|
)
|
|
|
|
$
|
|
|
|
"""
|
|
|
|
match = re.match(version_re, version, re.X)
|
|
|
|
if match is None:
|
|
|
|
raise ValueError
|
|
|
|
ret = match.groupdict()
|
|
|
|
if ret['parent'] is not None:
|
|
|
|
ret['source_upstream'] = ret['parent'] + ret['upstream']
|
|
|
|
else:
|
|
|
|
ret['source_upstream'] = ret['upstream']
|
|
|
|
return ret
|
|
|
|
|
r6005: waldi | 2006-03-02 11:06:40 +0100
* debian/lib/python/debian_linux/gencontrol.py:
Populate UPSTREAMVERSION, ABINAME and LOCALVERSION in an stable fashion.
* debian/rules.real: Use UPSTREAMVERSION, ABINAME and LOCALVERSION.
* debian/templates/control.headers.arch.in,
debian/templates/control.headers.in,
debian/templates/control.headers.latest.in,
debian/templates/control.headers.subarch.in,
debian/templates/control.image.in,
debian/templates/control.image.latest.in:
Use upstreamversion and localversion substitutions.
r6006: waldi | 2006-03-02 11:16:14 +0100
* debian/lib/python/debian_linux/gencontrol.py: Add SOURCEVERSION.
* debian/rules.real
- Use SOURCEVERSION.
- Fix another brocken ABINAME usage.
r6007: waldi | 2006-03-02 11:41:01 +0100
* debian/arch/defines, debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/arm/defines, debian/arch/armeb/defines, debian/arch/hppa/defines,
debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines,
debian/arch/mips/defines, debian/arch/mipsel/defines,
debian/arch/powerpc/defines, debian/arch/s390/defines,
debian/arch/sparc/defines: Move image specific specs into image section.
* debian/bin/gencontrol.py: Use image section if neccesary.
* debian/lib/python/debian_linux/gencontrol.py: Support image section.
r6008: waldi | 2006-03-02 11:41:37 +0100
debian/lib/python/debian_linux/config.py: Remove old workaround.
r6009: waldi | 2006-03-02 12:15:21 +0100
* 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.
r6010: waldi | 2006-03-02 12:42:47 +0100
* debian/arch/defines: Add initramfs-generator relations.
* debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/arm/defines, debian/arch/armeb/defines, debian/arch/hppa/defines,
debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines,
debian/arch/mips/defines, debian/arch/mipsel/defines,
debian/arch/powerpc/defines, debian/arch/powerpc/vserver/defines,
debian/arch/s390/defines, debian/arch/sparc/defines:
Specify initramfs settings.
* debian/bin/gencontrol.py: Generate dependencies for initramfs generators.
* debian/lib/python/debian_linux/config.py: Add more fields.
* debian/lib/python/debian_linux/gencontrol.py: Fix.
* debian/rules.real: Use INITRAMFS.
r6011: waldi | 2006-03-02 13:05:45 +0100
debian/bin/gencontrol.py,
debian/lib/python/debian_linux/gencontrol.py
- Don't export the usage of the image section into the generic code.
- Fix localversion spec.
r6012: waldi | 2006-03-02 13:20:58 +0100
debian/lib/python/debian_linux/config.py: Fix section parsing.
r6013: waldi | 2006-03-02 13:27:44 +0100
* debian/lib/python/debian_linux/config.py: Use a list of directories.
* debian/lib/python/debian_linux/gencontrol.py: Update.
r6014: waldi | 2006-03-02 13:30:30 +0100
* debian/bin/gencontrol.py: Add base image config entry.
* debian/lib/python/debian_linux/gencontrol.py:
Remove another usage of the image config sections.
r6030: waldi | 2006-03-02 17:44:17 +0100
debian/bin/gencontrol.py: Provide correct localversion for the headers build.
svn path=/dists/trunk/linux-2.6/; revision=6031
2006-03-02 16:47:30 +00:00
|
|
|
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)
|
|
|
|
|
2006-01-06 22:32:16 +00:00
|
|
|
class package_relation(object):
|
|
|
|
__slots__ = "name", "version", "arches"
|
|
|
|
|
|
|
|
_re = re.compile(r'^(\S+)(?: \(([^)]+)\))?(?: \[([^]]+)\])?$')
|
|
|
|
|
|
|
|
def __init__(self, value = None):
|
|
|
|
if value is not None:
|
|
|
|
match = self._re.match(value)
|
|
|
|
if match is None:
|
|
|
|
raise RuntimeError, "Can't parse dependency %s" % value
|
|
|
|
match = match.groups()
|
|
|
|
self.name = match[0]
|
|
|
|
self.version = match[1]
|
|
|
|
if match[2] is not None:
|
|
|
|
self.arches = re.split('\s+', match[2])
|
|
|
|
else:
|
|
|
|
self.arches = []
|
|
|
|
else:
|
|
|
|
self.name = None
|
|
|
|
self.version = None
|
|
|
|
self.arches = []
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
ret = [self.name]
|
|
|
|
if self.version is not None:
|
|
|
|
ret.extend([' (', self.version, ')'])
|
|
|
|
if self.arches:
|
|
|
|
ret.extend([' [', ' '.join(self.arches), ']'])
|
|
|
|
return ''.join(ret)
|
|
|
|
|
|
|
|
class package_relation_list(list):
|
|
|
|
def __init__(self, value = None):
|
|
|
|
if isinstance(value, (list, tuple)):
|
|
|
|
self.extend(value)
|
|
|
|
elif value is not None:
|
|
|
|
self.extend(value)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return ', '.join([str(i) for i in self])
|
|
|
|
|
|
|
|
def _match(self, value):
|
|
|
|
for i in self:
|
|
|
|
if i._match(value):
|
|
|
|
return i
|
|
|
|
return None
|
|
|
|
|
|
|
|
def extend(self, value):
|
|
|
|
if isinstance(value, basestring):
|
|
|
|
value = [package_relation_group(j.strip()) for j in re.split(',', value.strip())]
|
|
|
|
for i in value:
|
|
|
|
if isinstance(i, basestring):
|
|
|
|
i = package_relation_group(i)
|
|
|
|
j = self._match(i)
|
|
|
|
if j:
|
|
|
|
j._update_arches(i)
|
|
|
|
else:
|
|
|
|
self.append(i)
|
|
|
|
|
|
|
|
class package_relation_group(list):
|
|
|
|
def __init__(self, value = None):
|
|
|
|
if isinstance(value, package_relation_list):
|
|
|
|
self.extend(value)
|
|
|
|
elif value is not None:
|
|
|
|
self._extend(value)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return ' | '.join([str(i) for i in self])
|
|
|
|
|
|
|
|
def _extend(self, value):
|
|
|
|
self.extend([package_relation(j.strip()) for j in re.split('\|', value.strip())])
|
|
|
|
|
|
|
|
def _match(self, value):
|
|
|
|
for i, j in itertools.izip(self, value):
|
|
|
|
if i.name != j.name or i.version != j.version:
|
|
|
|
return None
|
|
|
|
return self
|
|
|
|
|
|
|
|
def _update_arches(self, value):
|
|
|
|
for i, j in itertools.izip(self, value):
|
|
|
|
if i.arches:
|
|
|
|
for arch in j.arches:
|
|
|
|
if arch not in i.arches:
|
|
|
|
i.arches.append(arch)
|
|
|
|
|
|
|
|
class package(dict):
|
|
|
|
_fields = utils.sorted_dict((
|
|
|
|
('Package', str),
|
|
|
|
('Source', str),
|
|
|
|
('Architecture', utils.field_list),
|
|
|
|
('Section', str),
|
|
|
|
('Priority', str),
|
|
|
|
('Maintainer', str),
|
|
|
|
('Uploaders', str),
|
|
|
|
('Standards-Version', str),
|
|
|
|
('Build-Depends', package_relation_list),
|
|
|
|
('Build-Depends-Indep', package_relation_list),
|
|
|
|
('Provides', package_relation_list),
|
|
|
|
('Depends', package_relation_list),
|
|
|
|
('Recommends', package_relation_list),
|
|
|
|
('Suggests', package_relation_list),
|
|
|
|
('Replaces', package_relation_list),
|
|
|
|
('Conflicts', package_relation_list),
|
r6005: waldi | 2006-03-02 11:06:40 +0100
* debian/lib/python/debian_linux/gencontrol.py:
Populate UPSTREAMVERSION, ABINAME and LOCALVERSION in an stable fashion.
* debian/rules.real: Use UPSTREAMVERSION, ABINAME and LOCALVERSION.
* debian/templates/control.headers.arch.in,
debian/templates/control.headers.in,
debian/templates/control.headers.latest.in,
debian/templates/control.headers.subarch.in,
debian/templates/control.image.in,
debian/templates/control.image.latest.in:
Use upstreamversion and localversion substitutions.
r6006: waldi | 2006-03-02 11:16:14 +0100
* debian/lib/python/debian_linux/gencontrol.py: Add SOURCEVERSION.
* debian/rules.real
- Use SOURCEVERSION.
- Fix another brocken ABINAME usage.
r6007: waldi | 2006-03-02 11:41:01 +0100
* debian/arch/defines, debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/arm/defines, debian/arch/armeb/defines, debian/arch/hppa/defines,
debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines,
debian/arch/mips/defines, debian/arch/mipsel/defines,
debian/arch/powerpc/defines, debian/arch/s390/defines,
debian/arch/sparc/defines: Move image specific specs into image section.
* debian/bin/gencontrol.py: Use image section if neccesary.
* debian/lib/python/debian_linux/gencontrol.py: Support image section.
r6008: waldi | 2006-03-02 11:41:37 +0100
debian/lib/python/debian_linux/config.py: Remove old workaround.
r6009: waldi | 2006-03-02 12:15:21 +0100
* 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.
r6010: waldi | 2006-03-02 12:42:47 +0100
* debian/arch/defines: Add initramfs-generator relations.
* debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/arm/defines, debian/arch/armeb/defines, debian/arch/hppa/defines,
debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines,
debian/arch/mips/defines, debian/arch/mipsel/defines,
debian/arch/powerpc/defines, debian/arch/powerpc/vserver/defines,
debian/arch/s390/defines, debian/arch/sparc/defines:
Specify initramfs settings.
* debian/bin/gencontrol.py: Generate dependencies for initramfs generators.
* debian/lib/python/debian_linux/config.py: Add more fields.
* debian/lib/python/debian_linux/gencontrol.py: Fix.
* debian/rules.real: Use INITRAMFS.
r6011: waldi | 2006-03-02 13:05:45 +0100
debian/bin/gencontrol.py,
debian/lib/python/debian_linux/gencontrol.py
- Don't export the usage of the image section into the generic code.
- Fix localversion spec.
r6012: waldi | 2006-03-02 13:20:58 +0100
debian/lib/python/debian_linux/config.py: Fix section parsing.
r6013: waldi | 2006-03-02 13:27:44 +0100
* debian/lib/python/debian_linux/config.py: Use a list of directories.
* debian/lib/python/debian_linux/gencontrol.py: Update.
r6014: waldi | 2006-03-02 13:30:30 +0100
* debian/bin/gencontrol.py: Add base image config entry.
* debian/lib/python/debian_linux/gencontrol.py:
Remove another usage of the image config sections.
r6030: waldi | 2006-03-02 17:44:17 +0100
debian/bin/gencontrol.py: Provide correct localversion for the headers build.
svn path=/dists/trunk/linux-2.6/; revision=6031
2006-03-02 16:47:30 +00:00
|
|
|
('Description', package_description),
|
2006-01-06 22:32:16 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
def __setitem__(self, key, value):
|
|
|
|
try:
|
r6005: waldi | 2006-03-02 11:06:40 +0100
* debian/lib/python/debian_linux/gencontrol.py:
Populate UPSTREAMVERSION, ABINAME and LOCALVERSION in an stable fashion.
* debian/rules.real: Use UPSTREAMVERSION, ABINAME and LOCALVERSION.
* debian/templates/control.headers.arch.in,
debian/templates/control.headers.in,
debian/templates/control.headers.latest.in,
debian/templates/control.headers.subarch.in,
debian/templates/control.image.in,
debian/templates/control.image.latest.in:
Use upstreamversion and localversion substitutions.
r6006: waldi | 2006-03-02 11:16:14 +0100
* debian/lib/python/debian_linux/gencontrol.py: Add SOURCEVERSION.
* debian/rules.real
- Use SOURCEVERSION.
- Fix another brocken ABINAME usage.
r6007: waldi | 2006-03-02 11:41:01 +0100
* debian/arch/defines, debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/arm/defines, debian/arch/armeb/defines, debian/arch/hppa/defines,
debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines,
debian/arch/mips/defines, debian/arch/mipsel/defines,
debian/arch/powerpc/defines, debian/arch/s390/defines,
debian/arch/sparc/defines: Move image specific specs into image section.
* debian/bin/gencontrol.py: Use image section if neccesary.
* debian/lib/python/debian_linux/gencontrol.py: Support image section.
r6008: waldi | 2006-03-02 11:41:37 +0100
debian/lib/python/debian_linux/config.py: Remove old workaround.
r6009: waldi | 2006-03-02 12:15:21 +0100
* 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.
r6010: waldi | 2006-03-02 12:42:47 +0100
* debian/arch/defines: Add initramfs-generator relations.
* debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/arm/defines, debian/arch/armeb/defines, debian/arch/hppa/defines,
debian/arch/i386/defines, debian/arch/ia64/defines, debian/arch/m68k/defines,
debian/arch/mips/defines, debian/arch/mipsel/defines,
debian/arch/powerpc/defines, debian/arch/powerpc/vserver/defines,
debian/arch/s390/defines, debian/arch/sparc/defines:
Specify initramfs settings.
* debian/bin/gencontrol.py: Generate dependencies for initramfs generators.
* debian/lib/python/debian_linux/config.py: Add more fields.
* debian/lib/python/debian_linux/gencontrol.py: Fix.
* debian/rules.real: Use INITRAMFS.
r6011: waldi | 2006-03-02 13:05:45 +0100
debian/bin/gencontrol.py,
debian/lib/python/debian_linux/gencontrol.py
- Don't export the usage of the image section into the generic code.
- Fix localversion spec.
r6012: waldi | 2006-03-02 13:20:58 +0100
debian/lib/python/debian_linux/config.py: Fix section parsing.
r6013: waldi | 2006-03-02 13:27:44 +0100
* debian/lib/python/debian_linux/config.py: Use a list of directories.
* debian/lib/python/debian_linux/gencontrol.py: Update.
r6014: waldi | 2006-03-02 13:30:30 +0100
* debian/bin/gencontrol.py: Add base image config entry.
* debian/lib/python/debian_linux/gencontrol.py:
Remove another usage of the image config sections.
r6030: waldi | 2006-03-02 17:44:17 +0100
debian/bin/gencontrol.py: Provide correct localversion for the headers build.
svn path=/dists/trunk/linux-2.6/; revision=6031
2006-03-02 16:47:30 +00:00
|
|
|
cls = self._fields[key]
|
|
|
|
if not isinstance(value, cls):
|
|
|
|
value = cls(value)
|
2006-01-06 22:32:16 +00:00
|
|
|
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]
|
|
|
|
|