debian/bin/gencontrol.py, debian/lib/python/debian_linux/debian.py:
Make changelog code object oriented. svn path=/dists/trunk/linux-2.6/; revision=8234
This commit is contained in:
parent
5be1182aea
commit
60506c6fef
|
@ -216,7 +216,7 @@ class gencontrol(debian_linux.gencontrol.gencontrol):
|
||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
'home': '/usr/src/kernel-patches/all/%s/debian' % self.version.linux_upstream,
|
'home': '/usr/src/kernel-patches/all/%s/debian' % self.version.linux_upstream,
|
||||||
'revisions': ' '.join([i['Version'].debian for i in self.changelog[::-1]]),
|
'revisions': ' '.join([i.version.debian for i in self.changelog[::-1]]),
|
||||||
'source': "%(linux_upstream)s-%(debian)s" % self.version.__dict__,
|
'source': "%(linux_upstream)s-%(debian)s" % self.version.__dict__,
|
||||||
'upstream': self.version.linux_upstream,
|
'upstream': self.version.linux_upstream,
|
||||||
}
|
}
|
||||||
|
@ -228,15 +228,15 @@ class gencontrol(debian_linux.gencontrol.gencontrol):
|
||||||
file('debian/bin/patch.unpatch', 'w').write(unpatch)
|
file('debian/bin/patch.unpatch', 'w').write(unpatch)
|
||||||
|
|
||||||
def process_changelog(self):
|
def process_changelog(self):
|
||||||
in_changelog = read_changelog(version = VersionLinux)
|
in_changelog = Changelog(version = VersionLinux)
|
||||||
act_upstream = in_changelog[0]['Version'].linux_upstream
|
act_upstream = in_changelog[0].version.linux_upstream
|
||||||
changelog = []
|
changelog = []
|
||||||
for i in in_changelog:
|
for i in in_changelog:
|
||||||
if i['Version'].linux_upstream != act_upstream:
|
if i.version.linux_upstream != act_upstream:
|
||||||
break
|
break
|
||||||
changelog.append(i)
|
changelog.append(i)
|
||||||
self.changelog = changelog
|
self.changelog = changelog
|
||||||
self.version = self.changelog[0]['Version']
|
self.version = self.changelog[0].version
|
||||||
if self.version.linux_modifier is not None:
|
if self.version.linux_modifier is not None:
|
||||||
self.abiname = ''
|
self.abiname = ''
|
||||||
else:
|
else:
|
||||||
|
@ -258,12 +258,12 @@ class gencontrol(debian_linux.gencontrol.gencontrol):
|
||||||
|
|
||||||
def process_real_tree(self, in_entry, vars):
|
def process_real_tree(self, in_entry, vars):
|
||||||
entry = self.process_package(in_entry, vars)
|
entry = self.process_package(in_entry, vars)
|
||||||
versions = [i['Version'] for i in self.changelog[::-1]]
|
versions = [i.version for i in self.changelog[::-1]]
|
||||||
for i in (('Depends', 'Provides')):
|
for i in (('Depends', 'Provides')):
|
||||||
value = package_relation_list()
|
value = package_relation_list()
|
||||||
value.extend(entry.get(i, []))
|
value.extend(entry.get(i, []))
|
||||||
if i == 'Depends':
|
if i == 'Depends':
|
||||||
value.append("linux-patch-debian-%(linux_version)s (= %(complete)s)" % self.changelog[0]['Version'].__dict__)
|
value.append("linux-patch-debian-%(linux_version)s (= %(complete)s)" % self.changelog[0].version.__dict__)
|
||||||
value.append(' | '.join(["linux-source-%(linux_version)s (= %(complete)s)" % v.__dict__ for v in versions]))
|
value.append(' | '.join(["linux-source-%(linux_version)s (= %(complete)s)" % v.__dict__ for v in versions]))
|
||||||
elif i == 'Provides':
|
elif i == 'Provides':
|
||||||
value.extend(["linux-tree-%s" % v.complete.replace('~', '-') for v in versions])
|
value.extend(["linux-tree-%s" % v.complete.replace('~', '-') for v in versions])
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
import itertools, os.path, re, utils
|
import itertools, os.path, re, utils
|
||||||
|
|
||||||
def read_changelog(dir = '', version = None):
|
class Changelog(list):
|
||||||
r = re.compile(r"""
|
_rules = r"""
|
||||||
^
|
^
|
||||||
(
|
(?P<source>
|
||||||
(?P<header>
|
\w[-+0-9a-z.]+
|
||||||
(?P<header_source>
|
|
||||||
\w[-+0-9a-z.]+
|
|
||||||
)
|
|
||||||
\
|
|
||||||
\(
|
|
||||||
(?P<header_version>
|
|
||||||
[^\(\)\ \t]+
|
|
||||||
)
|
|
||||||
\)
|
|
||||||
\s+
|
|
||||||
(?P<header_distribution>
|
|
||||||
[-0-9a-zA-Z]+
|
|
||||||
)
|
|
||||||
\;
|
|
||||||
)
|
)
|
||||||
|
\
|
||||||
|
\(
|
||||||
|
(?P<version>
|
||||||
|
[^\(\)\ \t]+
|
||||||
)
|
)
|
||||||
""", re.VERBOSE)
|
\)
|
||||||
if version is None:
|
\s+
|
||||||
version = Version
|
(?P<distribution>
|
||||||
f = file(os.path.join(dir, "debian/changelog"))
|
[-0-9a-zA-Z]+
|
||||||
entries = []
|
)
|
||||||
while True:
|
\;
|
||||||
line = f.readline()
|
"""
|
||||||
if not line:
|
_re = re.compile(_rules, re.X)
|
||||||
break
|
|
||||||
line = line.strip('\n')
|
class Entry(object):
|
||||||
match = r.match(line)
|
__slot__ = 'distribution', 'source', 'version'
|
||||||
if not match:
|
|
||||||
continue
|
def __init__(self, distribution, source, version):
|
||||||
if match.group('header'):
|
self.distribution, self.source, self.version = distribution, source, version
|
||||||
e = {}
|
|
||||||
e['Distribution'] = match.group('header_distribution')
|
def __init__(self, dir = '', version = None):
|
||||||
e['Source'] = match.group('header_source')
|
if version is None:
|
||||||
try:
|
version = Version
|
||||||
e['Version'] = version(match.group('header_version'))
|
f = file(os.path.join(dir, "debian/changelog"))
|
||||||
except Exception:
|
while True:
|
||||||
if not len(entries):
|
line = f.readline()
|
||||||
raise
|
if not line:
|
||||||
e['Version'] = Version(match.group('header_version'))
|
break
|
||||||
entries.append(e)
|
line = line.strip('\n')
|
||||||
return entries
|
match = self._re.match(line)
|
||||||
|
if not match:
|
||||||
|
continue
|
||||||
|
if match.group('version'):
|
||||||
|
try:
|
||||||
|
v = version(match.group('version'))
|
||||||
|
except Exception:
|
||||||
|
if not len(self):
|
||||||
|
raise
|
||||||
|
v = Version(match.group('version'))
|
||||||
|
self.append(self.Entry(match.group('distribution'), match.group('source'), v))
|
||||||
|
|
||||||
class Version(object):
|
class Version(object):
|
||||||
_version_rules = ur"""
|
_version_rules = ur"""
|
||||||
|
|
Loading…
Reference in New Issue