* debian/lib/python/debian_linux/debian.py:
Replace PackageFieldList with PackageArchitecture. * debian/bin/gencontrol.py, debian/lib/python/debian_linux/gencontrol.py: Adopt changes. svn path=/dists/trunk/linux-2.6/; revision=18492
This commit is contained in:
parent
e962c1ae2b
commit
dad674e6e7
|
@ -327,7 +327,7 @@ class Gencontrol(Base):
|
|||
name = new_package['Package']
|
||||
if name in packages:
|
||||
package = packages.get(name)
|
||||
package['Architecture'].append(arch)
|
||||
package['Architecture'].add(arch)
|
||||
|
||||
for field in 'Depends', 'Provides', 'Suggests', 'Recommends', 'Conflicts':
|
||||
if field in new_package:
|
||||
|
@ -338,7 +338,7 @@ class Gencontrol(Base):
|
|||
package[field] = new_package[field]
|
||||
|
||||
else:
|
||||
new_package['Architecture'] = [arch]
|
||||
new_package['Architecture'] = arch
|
||||
packages.append(new_package)
|
||||
|
||||
def process_changelog(self):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from collections import OrderedDict
|
||||
import collections
|
||||
import itertools
|
||||
import os.path
|
||||
import re
|
||||
|
@ -157,22 +157,38 @@ $
|
|||
self.linux_revision_other = match.group('revision_other') and True
|
||||
|
||||
|
||||
class PackageFieldList(list):
|
||||
class PackageArchitecture(collections.MutableSet):
|
||||
__slots__ = '_data'
|
||||
|
||||
def __init__(self, value=None):
|
||||
self.extend(value)
|
||||
self._data = set()
|
||||
if value:
|
||||
self.extend(value)
|
||||
|
||||
def __contains__(self, value):
|
||||
return self._data.__contains__(value)
|
||||
|
||||
def __iter__(self):
|
||||
return self._data.__iter__()
|
||||
|
||||
def __len__(self):
|
||||
return self._data.__len__()
|
||||
|
||||
def __str__(self):
|
||||
return ' '.join(self)
|
||||
return ' '.join(sorted(self))
|
||||
|
||||
def _extend(self, value):
|
||||
if value is not None:
|
||||
self.extend([j.strip() for j in re.split('\s', value.strip())])
|
||||
def add(self, value):
|
||||
self._data.add(value)
|
||||
|
||||
def discard(self, value):
|
||||
self._data.discard(value)
|
||||
|
||||
def extend(self, value):
|
||||
if isinstance(value, str):
|
||||
self._extend(value)
|
||||
if isinstance(value, basestring):
|
||||
for i in re.split('\s', value.strip()):
|
||||
self.add(i)
|
||||
else:
|
||||
super(PackageFieldList, self).extend(value)
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
class PackageDescription(object):
|
||||
|
@ -363,10 +379,10 @@ class PackageRelationEntry(object):
|
|||
|
||||
|
||||
class Package(dict):
|
||||
_fields = OrderedDict((
|
||||
_fields = collections.OrderedDict((
|
||||
('Package', str),
|
||||
('Source', str),
|
||||
('Architecture', PackageFieldList),
|
||||
('Architecture', PackageArchitecture),
|
||||
('Section', str),
|
||||
('Priority', str),
|
||||
('Maintainer', str),
|
||||
|
|
|
@ -278,7 +278,7 @@ class Gencontrol(object):
|
|||
def subst(match):
|
||||
return vars[match.group(1)]
|
||||
|
||||
return re.sub(r'@([-_a-z]+)@', subst, s)
|
||||
return re.sub(r'@([-_a-z]+)@', subst, str(s))
|
||||
|
||||
def write(self, packages, makefile):
|
||||
self.write_control(packages.itervalues())
|
||||
|
|
Loading…
Reference in New Issue