[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: New check for multiline architecture fields in debian/control



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

abe pushed a commit to branch master
in repository lintian.

commit 857056325b9770a028511bdff6b317a4800b9315
Author: Axel Beckert <abe@deuxchevaux.org>
Date:   Sun Mar 15 13:12:40 2015 +0100

    New check for multiline architecture fields in debian/control
    
    New tags emitted: multiline-architecture-field (important, certain)
    
    Closes: #780474
---
 checks/control-file.desc                           |  8 +++++
 checks/control-file.pm                             | 11 ++++++
 debian/changelog                                   |  2 ++
 .../debian/debian/control.in                       | 42 ++++++++++++++++++++++
 t/tests/control-file-important-space/desc          |  5 +++
 t/tests/control-file-important-space/tags          |  1 +
 6 files changed, 69 insertions(+)

diff --git a/checks/control-file.desc b/checks/control-file.desc
index 696d3f4..3ad9a51 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -241,3 +241,11 @@ Certainty: possible
 Info: The restriction formula in Build-Profiles field includes an unknown build
  profile. The only allowed build profiles are "stage1", "stage2", "nocheck",
  "nodoc", "nobiarch" and "cross".
+
+Tag: multiline-architecture-field
+Severity: important
+Certainty: certain
+Ref: policy 5.6.8
+Info: The values of the Architecture field in debian/control must not
+ be separated by anything else than spaces, i.e. must be single line
+ and is not allowed to spawn multiple lines.
diff --git a/checks/control-file.pm b/checks/control-file.pm
index 6cb1b52..0c5cc34 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -390,6 +390,17 @@ sub run {
         }
     }
 
+    # Make sure that the Architecture field in source packages is not multiline
+    for my $bin (@package_names) {
+        # The Architecture field is mandatory and dpkg-buildpackage
+        # will already bail out if it's missing, so we don't need to
+        # check that.
+        my $raw = $info->binary_field($bin, 'architecture');
+        if ($raw =~ /\n./) {
+            tag 'multiline-architecture-field',$bin;
+        }
+    }
+
     return;
 }
 
diff --git a/debian/changelog b/debian/changelog
index b4cb43a..42f37dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ lintian (2.5.31) UNRELEASED; urgency=medium
     + [BR] Apply patch from Johannes Schauer in order
       to detect obsolete XS-Testsuite header.
       (Closes: #770068).
+    + [AB] New check for multiline architecture fields in debian/control.
+      (Closes: #780474)
   * checks/cruft.{desc,pm}:
     + [NT] Import "d/pycompat is deprecated" check from
       lintian4python.
diff --git a/t/tests/control-file-important-space/debian/debian/control.in b/t/tests/control-file-important-space/debian/debian/control.in
new file mode 100644
index 0000000..4ba8248
--- /dev/null
+++ b/t/tests/control-file-important-space/debian/debian/control.in
@@ -0,0 +1,42 @@
+Source: {$source}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 9)
+Homepage: http://lintian.debian.org/
+
+Package: {$source}-broken
+Architecture: any-amd64 any-arm64 any-mips64 any-mips64el any-ia64
+              any-ppc64 any-ppc64el any-sparc64
+Depends: $\{misc:Depends\}
+Description: {$description} (multiline architecture, broken)
+ This is a (broken) test package designed to exercise some feature or
+ tag of Lintian.  It is part of the Lintian test suite and may do very
+ odd things.  It should not be installed like a regular package.  It
+ may be an empty package.
+ .
+ The Architecture (multi-)line example above is taken from
+ https://bugs.debian.org/780473
+
+Package: {$source}-fine-any-something
+Architecture: any-amd64 any-arm64 any-mips64 any-mips64el any-ia64 any-ppc64 any-ppc64el any-sparc64
+Depends: $\{misc:Depends\}
+Description: {$description} (any-something, fine)
+ This is a (non-broken) test package designed to exercise some feature
+ or tag of Lintian.  It is part of the Lintian test suite and may do
+ very odd things.  It should not be installed like a regular package.
+ It may be an empty package.
+ .
+ This "any-something" package should not show up.
+
+Package: {$source}-fine-all
+Architecture: all
+Depends: $\{misc:Depends\}
+Description: {$description} (all, fine)
+ This is a (non-broken) test package designed to exercise some feature
+ or tag of Lintian.  It is part of the Lintian test suite and may do
+ very odd things.  It should not be installed like a regular package.
+ It may be an empty package.
+ .
+ This "all" package should not show up.
diff --git a/t/tests/control-file-important-space/desc b/t/tests/control-file-important-space/desc
new file mode 100644
index 0000000..d2d15ef
--- /dev/null
+++ b/t/tests/control-file-important-space/desc
@@ -0,0 +1,5 @@
+Testname: control-file-important-space
+Sequence: 6000
+Version: 1.0
+Description: Important tests for control file spacing
+Test-For: multiline-architecture-field
diff --git a/t/tests/control-file-important-space/tags b/t/tests/control-file-important-space/tags
new file mode 100644
index 0000000..394d76e
--- /dev/null
+++ b/t/tests/control-file-important-space/tags
@@ -0,0 +1 @@
+E: control-file-important-space source: multiline-architecture-field control-file-important-space-broken

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


Reply to: