2006-02-25 22:41:56 +00:00
|
|
|
import itertools, os.path, re, utils
|
2006-01-04 19:33:32 +00:00
|
|
|
|
2007-01-27 20:56:56 +00:00
|
|
|
def read_changelog(dir = '', version = None):
|
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)
|
2007-01-27 20:56:56 +00:00
|
|
|
if version is None:
|
|
|
|
version = Version
|
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 = []
|
|
|
|
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')
|
2007-01-27 20:56:56 +00:00
|
|
|
try:
|
|
|
|
e['Version'] = version(match.group('header_version'))
|
|
|
|
except Exception:
|
|
|
|
if not len(entries):
|
|
|
|
raise
|
|
|
|
e['Version'] = Version(match.group('header_version'))
|
2006-01-04 19:33:32 +00:00
|
|
|
entries.append(e)
|
|
|
|
return entries
|
|
|
|
|
2007-01-27 20:56:56 +00:00
|
|
|
class Version(object):
|
|
|
|
_version_rules = ur"""
|
2006-01-04 19:33:32 +00:00
|
|
|
^
|
2007-01-27 21:01:14 +00:00
|
|
|
(?:
|
2007-01-27 20:56:56 +00:00
|
|
|
(?P<epoch>
|
2006-11-19 12:13:58 +00:00
|
|
|
\d+
|
2006-01-04 19:33:32 +00:00
|
|
|
)
|
2007-01-27 20:56:56 +00:00
|
|
|
:
|
|
|
|
)?
|
|
|
|
(?P<upstream>
|
|
|
|
.+?
|
|
|
|
)
|
2007-01-27 21:01:14 +00:00
|
|
|
(?:
|
2006-01-04 19:33:32 +00:00
|
|
|
-
|
|
|
|
(?P<debian>[^-]+)
|
2007-01-27 20:56:56 +00:00
|
|
|
)?
|
|
|
|
$
|
|
|
|
"""
|
|
|
|
_version_re = re.compile(_version_rules, re.X)
|
|
|
|
|
|
|
|
def __init__(self, version):
|
|
|
|
match = self._version_re.match(version)
|
|
|
|
if match is None:
|
|
|
|
raise RuntimeError, "Invalid debian version"
|
|
|
|
self.complete = version
|
|
|
|
self.epoch = None
|
|
|
|
if match.group("epoch") is not None:
|
|
|
|
self.epoch = int(match.group("epoch"))
|
|
|
|
self.upstream = match.group("upstream")
|
|
|
|
self.debian = match.group("debian")
|
|
|
|
|
|
|
|
if self.debian is not None:
|
|
|
|
self.complete_noepoch = "%s-%s" % (self.upstream, self.debian)
|
|
|
|
else:
|
|
|
|
self.complete_noepoch = self.upstream
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.complete
|
|
|
|
|
|
|
|
class VersionLinux(Version):
|
|
|
|
_version_linux_rules = ur"""
|
|
|
|
^
|
|
|
|
(?P<version>
|
|
|
|
(?P<major>\d+\.\d+)
|
|
|
|
\.
|
|
|
|
\d+
|
2006-01-04 19:33:32 +00:00
|
|
|
)
|
2007-01-27 20:56:56 +00:00
|
|
|
(?:
|
|
|
|
~
|
|
|
|
(?P<modifier>
|
|
|
|
.+?
|
|
|
|
)
|
|
|
|
)?
|
|
|
|
(?:
|
|
|
|
\.dfsg\.\d+
|
|
|
|
)?
|
|
|
|
-
|
|
|
|
(?:[^-]+)
|
2006-01-04 19:33:32 +00:00
|
|
|
$
|
|
|
|
"""
|
2007-01-27 20:56:56 +00:00
|
|
|
_version_linux_re = re.compile(_version_linux_rules, re.X)
|
2006-01-04 19:33:32 +00:00
|
|
|
|
2007-01-27 20:56:56 +00:00
|
|
|
def __init__(self, version):
|
|
|
|
super(VersionLinux, self).__init__(version)
|
|
|
|
match = self._version_linux_re.match(version)
|
|
|
|
if match is None:
|
|
|
|
raise RuntimeError, "Invalid debian linux version"
|
|
|
|
d = match.groupdict()
|
|
|
|
self.linux_major = d['major']
|
|
|
|
self.linux_modifier = d['modifier']
|
|
|
|
self.linux_version = d['version']
|
|
|
|
if d['modifier'] is not None:
|
|
|
|
self.linux_upstream = '-'.join((d['version'], d['modifier']))
|
|
|
|
else:
|
|
|
|
self.linux_upstream = d['version']
|
|
|
|
|
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):
|
2006-07-20 00:47:41 +00:00
|
|
|
self.long = []
|
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
|
|
|
if value is not None:
|
2006-07-20 00:47:41 +00:00
|
|
|
self.short, long = value.split("\n", 1)
|
|
|
|
self.append(long)
|
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
|
|
|
else:
|
|
|
|
self.short = None
|
|
|
|
|
|
|
|
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-07-20 00:47:41 +00:00
|
|
|
def append(self, str):
|
|
|
|
str = str.strip()
|
|
|
|
if str:
|
|
|
|
self.long.extend(str.split("\n.\n"))
|
|
|
|
|
2006-01-06 22:32:16 +00:00
|
|
|
class package_relation(object):
|
2007-01-27 19:52:51 +00:00
|
|
|
__slots__ = "name", "operator", "version", "arches"
|
|
|
|
|
|
|
|
_re = re.compile(r'^(\S+)(?: \((<<|<=|=|!=|>=|>>)\s*([^)]+)\))?(?: \[([^]]+)\])?$')
|
|
|
|
|
|
|
|
class _operator(object):
|
|
|
|
OP_LT = 1
|
|
|
|
OP_LE = 2
|
|
|
|
OP_EQ = 3
|
|
|
|
OP_NE = 4
|
|
|
|
OP_GE = 5
|
|
|
|
OP_GT = 6
|
2006-01-06 22:32:16 +00:00
|
|
|
|
2007-01-27 19:52:51 +00:00
|
|
|
operators = {
|
|
|
|
'<<': OP_LT,
|
|
|
|
'<=': OP_LE,
|
|
|
|
'=': OP_EQ,
|
|
|
|
'!=': OP_NE,
|
|
|
|
'>=': OP_GE,
|
|
|
|
'>>': OP_GT,
|
|
|
|
}
|
|
|
|
operators_neg = {
|
|
|
|
OP_LT: OP_GE,
|
|
|
|
OP_LE: OP_GT,
|
|
|
|
OP_EQ: OP_NE,
|
|
|
|
OP_NE: OP_EQ,
|
|
|
|
OP_GE: OP_LT,
|
|
|
|
OP_GT: OP_LE,
|
|
|
|
}
|
|
|
|
operators_text = dict([(b, a) for a, b in operators.iteritems()])
|
|
|
|
|
|
|
|
__slots__ = '_op',
|
|
|
|
|
|
|
|
def __init__(self, value):
|
|
|
|
self._op = self.operators[value]
|
|
|
|
|
|
|
|
def __neg__(self):
|
|
|
|
return self.__class__(self.operators_text[self.operators_neg[self._op]])
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.operators_text[self._op]
|
2006-01-06 22:32:16 +00:00
|
|
|
|
|
|
|
def __init__(self, value = None):
|
|
|
|
if value is not None:
|
2006-04-16 23:53:58 +00:00
|
|
|
self.parse(value)
|
2006-01-06 22:32:16 +00:00
|
|
|
else:
|
|
|
|
self.name = None
|
2007-01-27 19:52:51 +00:00
|
|
|
self.operator = None
|
2006-01-06 22:32:16 +00:00
|
|
|
self.version = None
|
|
|
|
self.arches = []
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
ret = [self.name]
|
2007-01-27 19:52:51 +00:00
|
|
|
if self.operator is not None and self.version is not None:
|
|
|
|
ret.extend([' (', str(self.operator), ' ', self.version, ')'])
|
2006-01-06 22:32:16 +00:00
|
|
|
if self.arches:
|
|
|
|
ret.extend([' [', ' '.join(self.arches), ']'])
|
|
|
|
return ''.join(ret)
|
|
|
|
|
2006-04-16 23:53:58 +00:00
|
|
|
def config(self, entry):
|
|
|
|
if self.version is not None or self.arches:
|
|
|
|
return
|
|
|
|
value = entry.get(self.name, None)
|
|
|
|
if value is None:
|
|
|
|
return
|
|
|
|
self.parse(value)
|
|
|
|
|
|
|
|
def parse(self, value):
|
|
|
|
match = self._re.match(value)
|
|
|
|
if match is None:
|
|
|
|
raise RuntimeError, "Can't parse dependency %s" % value
|
|
|
|
match = match.groups()
|
|
|
|
self.name = match[0]
|
2007-01-27 19:52:51 +00:00
|
|
|
if match[1] is not None:
|
|
|
|
self.operator = self._operator(match[1])
|
|
|
|
else:
|
|
|
|
self.operator = None
|
|
|
|
self.version = match[2]
|
|
|
|
if match[3] is not None:
|
|
|
|
self.arches = re.split('\s+', match[3])
|
2006-04-16 23:53:58 +00:00
|
|
|
else:
|
|
|
|
self.arches = []
|
|
|
|
|
2006-01-06 22:32:16 +00:00
|
|
|
class package_relation_list(list):
|
|
|
|
def __init__(self, value = None):
|
2006-04-16 23:53:58 +00:00
|
|
|
if value is not None:
|
2006-01-06 22:32:16 +00:00
|
|
|
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
|
|
|
|
|
2006-04-16 23:53:58 +00:00
|
|
|
def append(self, value):
|
|
|
|
if isinstance(value, basestring):
|
|
|
|
value = package_relation_group(value)
|
|
|
|
elif not isinstance(value, package_relation_group):
|
|
|
|
raise ValueError, "got %s" % type(value)
|
|
|
|
j = self._match(value)
|
|
|
|
if j:
|
|
|
|
j._update_arches(value)
|
|
|
|
else:
|
|
|
|
super(package_relation_list, self).append(value)
|
|
|
|
|
|
|
|
def config(self, entry):
|
|
|
|
for i in self:
|
|
|
|
i.config(entry)
|
|
|
|
|
2006-01-06 22:32:16 +00:00
|
|
|
def extend(self, value):
|
|
|
|
if isinstance(value, basestring):
|
2006-04-16 23:53:58 +00:00
|
|
|
value = [j.strip() for j in re.split(',', value.strip())]
|
|
|
|
elif not isinstance(value, (list, tuple)):
|
|
|
|
raise ValueError, "got %s" % type(value)
|
2006-01-06 22:32:16 +00:00
|
|
|
for i in value:
|
2006-04-16 23:53:58 +00:00
|
|
|
self.append(i)
|
2006-01-06 22:32:16 +00:00
|
|
|
|
|
|
|
class package_relation_group(list):
|
|
|
|
def __init__(self, value = None):
|
2006-04-16 23:53:58 +00:00
|
|
|
if value is not None:
|
2006-01-06 22:32:16 +00:00
|
|
|
self.extend(value)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return ' | '.join([str(i) for i in self])
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
2006-04-16 23:53:58 +00:00
|
|
|
def append(self, value):
|
|
|
|
if isinstance(value, basestring):
|
|
|
|
value = package_relation(value)
|
|
|
|
elif not isinstance(value, package_relation):
|
|
|
|
raise ValueError
|
|
|
|
super(package_relation_group, self).append(value)
|
|
|
|
|
|
|
|
def config(self, entry):
|
|
|
|
for i in self:
|
|
|
|
i.config(entry)
|
|
|
|
|
|
|
|
def extend(self, value):
|
|
|
|
if isinstance(value, basestring):
|
|
|
|
value = [j.strip() for j in re.split('\|', value.strip())]
|
|
|
|
elif not isinstance(value, (list, tuple)):
|
|
|
|
raise ValueError
|
|
|
|
for i in value:
|
|
|
|
self.append(i)
|
|
|
|
|
2006-01-06 22:32:16 +00:00
|
|
|
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),
|
2007-01-27 19:52:51 +00:00
|
|
|
('Pre-Depends', package_relation_list),
|
2006-01-06 22:32:16 +00:00
|
|
|
('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):
|
2006-05-27 07:34:51 +00:00
|
|
|
keys = set(self.keys())
|
2006-01-06 22:32:16 +00:00
|
|
|
for i in self._fields.iterkeys():
|
2006-05-27 07:34:51 +00:00
|
|
|
if self.has_key(i):
|
|
|
|
keys.remove(i)
|
2006-01-06 22:32:16 +00:00
|
|
|
yield i
|
2006-05-27 07:34:51 +00:00
|
|
|
for i in keys:
|
|
|
|
yield i
|
2006-01-06 22:32:16 +00:00
|
|
|
|
|
|
|
def iteritems(self):
|
2006-05-27 07:34:51 +00:00
|
|
|
keys = set(self.keys())
|
2006-01-06 22:32:16 +00:00
|
|
|
for i in self._fields.iterkeys():
|
2006-05-27 07:34:51 +00:00
|
|
|
if self.has_key(i):
|
|
|
|
keys.remove(i)
|
2006-01-06 22:32:16 +00:00
|
|
|
yield (i, self[i])
|
2006-05-27 07:34:51 +00:00
|
|
|
for i in keys:
|
|
|
|
yield (i, self[i])
|
2006-01-06 22:32:16 +00:00
|
|
|
|
|
|
|
def itervalues(self):
|
2006-05-27 07:34:51 +00:00
|
|
|
keys = set(self.keys())
|
2006-01-06 22:32:16 +00:00
|
|
|
for i in self._fields.iterkeys():
|
2006-05-27 07:34:51 +00:00
|
|
|
if self.has_key(i):
|
|
|
|
keys.remove(i)
|
2006-01-06 22:32:16 +00:00
|
|
|
yield self[i]
|
2006-05-27 07:34:51 +00:00
|
|
|
for i in keys:
|
|
|
|
yield self[i]
|
2006-01-06 22:32:16 +00:00
|
|
|
|