[linux] 01/02: debian.py: Implement stable order of fields in debian/tests/control

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Fri Jan 8 12:09:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch sid
in repository linux.

commit dc3b21cc1a029966064353484a06564943e1dacd
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Fri Jan 8 12:08:28 2016 +0000

    debian.py: Implement stable order of fields in debian/tests/control
    
    Move the field ordering control from the Package class to a new
    superclass of Package and TestsControl.
---
 debian/changelog                         |  6 +++
 debian/lib/python/debian_linux/debian.py | 79 +++++++++++++++-----------------
 2 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0142459..1ec6c9f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+linux (4.3.3-6) UNRELEASED; urgency=medium
+
+  * debian.py: Implement stable order of fields in debian/tests/control
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Fri, 08 Jan 2016 12:08:13 +0000
+
 linux (4.3.3-5) unstable; urgency=medium
 
   * [armhf] udeb: Fix duplication and circular dependency between core-modules
diff --git a/debian/lib/python/debian_linux/debian.py b/debian/lib/python/debian_linux/debian.py
index b916463..a9bc1d8 100644
--- a/debian/lib/python/debian_linux/debian.py
+++ b/debian/lib/python/debian_linux/debian.py
@@ -396,29 +396,7 @@ class PackageRelationEntry(object):
             self.restrictions = []
 
 
-class Package(dict):
-    _fields = collections.OrderedDict((
-        ('Package', str),
-        ('Source', str),
-        ('Architecture', PackageArchitecture),
-        ('Section', str),
-        ('Priority', str),
-        ('Maintainer', str),
-        ('Uploaders', str),
-        ('Standards-Version', str),
-        ('Build-Depends', PackageRelation),
-        ('Build-Depends-Indep', PackageRelation),
-        ('Provides', PackageRelation),
-        ('Pre-Depends', PackageRelation),
-        ('Depends', PackageRelation),
-        ('Recommends', PackageRelation),
-        ('Suggests', PackageRelation),
-        ('Replaces', PackageRelation),
-        ('Breaks', PackageRelation),
-        ('Conflicts', PackageRelation),
-        ('Description', PackageDescription),
-    ))
-
+class _ControlFileDict(dict):
     def __setitem__(self, key, value):
         try:
             cls = self._fields[key]
@@ -426,10 +404,10 @@ class Package(dict):
                 value = cls(value)
         except KeyError:
             pass
-        super(Package, self).__setitem__(key, value)
+        super(_ControlFileDict, self).__setitem__(key, value)
 
     def keys(self):
-        keys = set(super(Package, self).keys())
+        keys = set(super(_ControlFileDict, self).keys())
         for i in self._fields.keys():
             if i in self:
                 keys.remove(i)
@@ -446,22 +424,37 @@ class Package(dict):
             yield self[i]
 
 
-class TestsControl(dict):
-    _fields = {
-        'Tests': str,
-        'Test-Command': str,
-        'Restrictions': str,
-        'Features': str,
-        'Depends': PackageRelation,
-        'Tests-Directory': str,
-        'Classes': str,
-    }
+class Package(_ControlFileDict):
+    _fields = collections.OrderedDict((
+        ('Package', str),
+        ('Source', str),
+        ('Architecture', PackageArchitecture),
+        ('Section', str),
+        ('Priority', str),
+        ('Maintainer', str),
+        ('Uploaders', str),
+        ('Standards-Version', str),
+        ('Build-Depends', PackageRelation),
+        ('Build-Depends-Indep', PackageRelation),
+        ('Provides', PackageRelation),
+        ('Pre-Depends', PackageRelation),
+        ('Depends', PackageRelation),
+        ('Recommends', PackageRelation),
+        ('Suggests', PackageRelation),
+        ('Replaces', PackageRelation),
+        ('Breaks', PackageRelation),
+        ('Conflicts', PackageRelation),
+        ('Description', PackageDescription),
+    ))
+
 
-    def __setitem__(self, key, value):
-        try:
-            cls = self._fields[key]
-            if not isinstance(value, cls):
-                value = cls(value)
-        except KeyError:
-            pass
-        super(TestsControl, self).__setitem__(key, value)
+class TestsControl(_ControlFileDict):
+    _fields = collections.OrderedDict((
+        ('Tests', str),
+        ('Test-Command', str),
+        ('Restrictions', str),
+        ('Features', str),
+        ('Depends', PackageRelation),
+        ('Tests-Directory', str),
+        ('Classes', str),
+    ))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list