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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=f2b495f107bec91808f4f9e2df7698b339345a8a

commit f2b495f107bec91808f4f9e2df7698b339345a8a
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Tue Dec 21 23:48:11 2021 +0100

    Dpkg::Control::FieldsCore: Add field order for all control types
---
 scripts/Dpkg/Control/FieldsCore.pm | 67 ++++++++++++++++++++++++++++++++++++
 scripts/t/Dpkg_Control.t           |  8 ++---
 scripts/t/Dpkg_Control_Fields.t    | 69 ++++++++++++++++++++------------------
 3 files changed, 107 insertions(+), 37 deletions(-)

diff --git a/scripts/Dpkg/Control/FieldsCore.pm 
b/scripts/Dpkg/Control/FieldsCore.pm
index b04c0caec..1550ee364 100644
--- a/scripts/Dpkg/Control/FieldsCore.pm
+++ b/scripts/Dpkg/Control/FieldsCore.pm
@@ -669,6 +669,53 @@ my @bin_checksums_fields = qw(
 );
 
 our %FIELD_ORDER = (
+    CTRL_INFO_SRC() => [
+        qw(
+            source
+            section
+            priority
+            maintainer
+            uploaders
+            origin
+            bugs
+        ),
+        @src_vcs_fields,
+        qw(
+            homepage
+            standards-version
+            rules-requires-root
+        ),
+        @src_dep_fields,
+        @src_test_fields,
+        qw(
+            description
+        ),
+    ],
+    CTRL_INFO_PKG() => [
+        qw(
+            package
+            package-type
+            section
+            priority
+            architecture
+            subarchitecture
+            multi-arch
+            essential
+            protected
+            build-essential
+            build-profiles
+            built-for-profiles
+            kernel-version
+        ),
+        @bin_dep_fields,
+        qw(
+            homepage
+            installer-menu-item
+            task
+            tag
+            description
+        ),
+    ],
     CTRL_PKG_SRC() => [
         qw(
             format
@@ -895,6 +942,14 @@ our %FIELD_ORDER = (
             files
         ),
     ],
+    CTRL_FILE_VENDOR() => [
+        qw(
+            vendor
+            vendor-url
+            bugs
+            parent
+        ),
+    ],
     CTRL_FILE_STATUS() => [
         # Same as fieldinfos in lib/dpkg/parse.c
         qw(
@@ -942,6 +997,18 @@ our %FIELD_ORDER = (
             task
         ),
     ],
+    CTRL_TESTS() => [
+        qw(
+            test-command
+            tests
+            tests-directory
+            architecture
+            restrictions
+            features
+            classes
+            depends
+        ),
+    ],
 );
 
 =encoding utf8
diff --git a/scripts/t/Dpkg_Control.t b/scripts/t/Dpkg_Control.t
index a359d6924..d1ffa895e 100644
--- a/scripts/t/Dpkg_Control.t
+++ b/scripts/t/Dpkg_Control.t
@@ -55,9 +55,7 @@ open $io, '>', \$io_data or die "canno open io string\n";;
 
 $c->output($io);
 my $expected = 'Source: mysource
-Numeric-Field: 0
-My-Field-One: myvalue1
-My-Field-Two: myvalue2
+Empty-Field:
 Long-Field: line1
  line 2 line 2 line 2
  .
@@ -65,7 +63,9 @@ Long-Field: line1
  .
  ..
  line 4
-Empty-Field:
+My-Field-One: myvalue1
+My-Field-Two: myvalue2
+Numeric-Field: 0
 
 Package: mypackage1
 Architecture: any
diff --git a/scripts/t/Dpkg_Control_Fields.t b/scripts/t/Dpkg_Control_Fields.t
index e8da00b95..49036012b 100644
--- a/scripts/t/Dpkg_Control_Fields.t
+++ b/scripts/t/Dpkg_Control_Fields.t
@@ -20,7 +20,7 @@ use Test::More;
 use Test::Dpkg qw(:paths);
 
 BEGIN {
-    plan tests => 2555;
+    plan tests => 2581;
 
     use_ok('Dpkg::Control::Types');
     use_ok('Dpkg::Control::FieldsCore');
@@ -97,50 +97,55 @@ my @test_fields = qw(
 my %fields = (
     CTRL_INFO_SRC() => {
         name => 'debian/control source stanza',
-        unordered => 1,
         fields => [
             qw(
-                Bugs
-                Homepage
-                Description
-                Origin
+                Source
+                Section
+                Priority
                 Maintainer
                 Uploaders
-                Priority
-                Section
-                Source
-                Standards-Version
+                Origin
+                Bugs
             ),
-            @test_fields,
             @vcs_fields,
+            qw(
+                Homepage
+                Standards-Version
+                Rules-Requires-Root
+            ),
             @src_dep_fields,
+            @test_fields,
+            qw(
+                Description
+            ),
         ],
     },
     CTRL_INFO_PKG() => {
         name => 'debian/control binary stanza',
-        unordered => 1,
         fields => [
             qw(
+                Package
+                Package-Type
+                Section
+                Priority
                 Architecture
+                Subarchitecture
+                Multi-Arch
+                Essential
+                Protected
                 Build-Essential
                 Build-Profiles
                 Built-For-Profiles
-                Description
-                Essential
-                Protected
+                Kernel-Version
+            ),
+            @bin_dep_fields,
+            qw(
                 Homepage
                 Installer-Menu-Item
-                Kernel-Version
-                Multi-Arch
-                Package
-                Package-Type
-                Priority
-                Section
-                Subarchitecture
-                Tag
                 Task
+                Tag
+                Description
             ),
-            @bin_dep_fields,
         ],
     },
     CTRL_PKG_SRC() => {
@@ -344,17 +349,16 @@ my %fields = (
     },
     CTRL_TESTS() => {
         name => 'debian/tests/control',
-        unordered => 1,
         fields => [
             qw(
-                Architecture
-                Classes
-                Depends
-                Features
-                Restrictions
                 Test-Command
                 Tests
                 Tests-Directory
+                Architecture
+                Restrictions
+                Features
+                Classes
+                Depends
             ),
         ],
     },
@@ -407,13 +411,12 @@ my %fields = (
     },
     CTRL_FILE_VENDOR() => {
         name => 'dpkg origin',
-        unordered => 1,
         fields => [
             qw(
-                Bugs
-                Parent
                 Vendor
                 Vendor-Url
+                Bugs
+                Parent
             ),
         ],
     },

-- 
Dpkg.Org's dpkg

Reply via email to