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

[lintian] 01/01: checks/control-file.*: Add classification tags for R³



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

abe pushed a commit to branch rules-requires-root-classification
in repository lintian.

commit 0942dcb426039066a443074ce2b7555dc78d0fed
Author: Axel Beckert <abe@deuxchevaux.org>
Date:   Tue Nov 7 00:13:50 2017 +0100

    checks/control-file.*: Add classification tags for R³
    
    Also emit a new tag rules-requires-root-misses-namespace if neither a
    known value is present nor does the value adhere the
    <namespace>/<keyword> syntax.
---
 checks/control-file.desc                           | 28 ++++++++++++++++++++++
 checks/control-file.pm                             | 13 ++++++++++
 debian/changelog                                   |  5 ++++
 t/source/fields-src-bad-version/control.in         |  1 +
 t/source/fields-src-bad-version/desc               |  2 +-
 t/source/fields-src-bad-version/tags               |  1 +
 t/tests/debhelper-compat-old/desc                  |  1 +
 t/tests/debhelper-compat-old/tags                  |  1 +
 .../debian/debian}/control.in                      | 11 +++++----
 t/tests/rules-requires-root-binary-targets/desc    |  6 +++++
 t/tests/rules-requires-root-binary-targets/tags    |  4 ++++
 .../debian/debian}/control.in                      | 11 +++++----
 t/tests/rules-requires-root-no/desc                |  6 +++++
 t/tests/rules-requires-root-no/tags                |  4 ++++
 14 files changed, 85 insertions(+), 9 deletions(-)

diff --git a/checks/control-file.desc b/checks/control-file.desc
index 6c7b1b1..f0fe0d7 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -313,3 +313,31 @@ Certainty: certain
 Info: The field on this line of <tt>debian/control</tt> is empty. Whilst
  this is permitted in the syntax of Debian control files it is
  unnecessary.
+
+Tag: rules-does-not-require-root
+Severity: classification
+Certainty: certain
+Info: Package supports building without fakeroot or similar
+Ref: /usr/share/doc/dpkg-dev/rootless-builds.txt.gz
+
+Tag: rules-requires-root-implicitly
+Severity: classification
+Certainty: possible
+Info: Package requires fakeroot or similar to build binary targets
+Ref: /usr/share/doc/dpkg-dev/rootless-builds.txt.gz
+
+Tag: rules-requires-root-explicitly
+Severity: classification
+Certainty: certain
+Info: Package requires fakeroot or similar to build binary targets and explicitly declares it.
+Ref: /usr/share/doc/dpkg-dev/rootless-builds.txt.gz
+
+Tag: rules-requires-root-misses-namespace
+Severity: normal
+Certainty: possible
+Info: The package has a Rules-Requires-Root header, but its value misses a namespace
+ The Rules-Requires-Root header may either contain "no",
+ "binary-targets" or a value consisting of a namespace and a keyword
+ separated by a slash. This package's Rules-Requires-Root header
+ matches neither of these options.
+Ref: /usr/share/doc/dpkg-dev/rootless-builds.txt.gz
diff --git a/checks/control-file.pm b/checks/control-file.pm
index 9c8fe4e..17e8913 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -370,6 +370,19 @@ sub run {
         }
     }
 
+    # Check Rules-Requires-Root
+    if (defined(my $r3 = $info->source_field('rules-requires-root'))) {
+        if ($r3 eq 'no') {
+            tag 'rules-does-not-require-root';
+        } elsif ($r3 eq 'binary-targets') {
+            tag 'rules-requires-root-explicitly';
+        } elsif ($r3 !~ m(/)) {
+            tag 'rules-requires-root-misses-namespace', $r3;
+        }
+    } else {
+        tag 'rules-requires-root-implicitly';
+    }
+
     # find binary packages that Pre-Depend on multiarch-support without going
     # via ${misc:Pre-Depends}
     if ($info->source_field('build-depends')) {
diff --git a/debian/changelog b/debian/changelog
index 06123dd..60770fb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,11 @@ lintian (2.5.59) UNRELEASED; urgency=medium
 
   XXX: generate tag summary
 
+  * checks/control-file.{desc,pm}:
+    + [AB] Add classification tags for R³ and emit new tag
+      rules-requires-root-misses-namespace if neither a known value is
+      present nor does the value adhere the <namespace>/<keyword> syntax.
+
   * lib/Lintian/Check.pm:
     + [CL] Don't warn about duplicate words when separated by punctuation.
       (Closes: #822504)
diff --git a/t/source/fields-src-bad-version/control.in b/t/source/fields-src-bad-version/control.in
index a9377c0..f2f6679 100644
--- a/t/source/fields-src-bad-version/control.in
+++ b/t/source/fields-src-bad-version/control.in
@@ -4,6 +4,7 @@ Priority: optional
 Maintainer: {$author}
 Build-Depends: debhelper (>= 7), g++ (>= s4.0)
 Standards-Version: {$standards_version}
+Rules-Requires-Root: keyword-without-namespace
 
 Package: {$source}
 Architecture: all
diff --git a/t/source/fields-src-bad-version/desc b/t/source/fields-src-bad-version/desc
index b34600c..764140f 100644
--- a/t/source/fields-src-bad-version/desc
+++ b/t/source/fields-src-bad-version/desc
@@ -3,4 +3,4 @@ Version: 1.0
 Description: Test for d/control with syntax errors
 Test-For: bad-relation
  bad-version-in-relation
-
+ rules-requires-root-misses-namespace
diff --git a/t/source/fields-src-bad-version/tags b/t/source/fields-src-bad-version/tags
index 6c4633a..4c4f41f 100644
--- a/t/source/fields-src-bad-version/tags
+++ b/t/source/fields-src-bad-version/tags
@@ -1,2 +1,3 @@
 E: control-file-syntax-error source: bad-relation build-depends: gcc ((>= 4)
 E: control-file-syntax-error source: bad-version-in-relation build-depends: g++ (>= s4.0)
+W: control-file-syntax-error source: rules-requires-root-misses-namespace keyword-without-namespace
diff --git a/t/tests/debhelper-compat-old/desc b/t/tests/debhelper-compat-old/desc
index d40efaa..0e1d823 100644
--- a/t/tests/debhelper-compat-old/desc
+++ b/t/tests/debhelper-compat-old/desc
@@ -7,3 +7,4 @@ Profile: lintian-test
 Test-For:
  package-uses-old-debhelper-compat-version
  debian-build-system
+ rules-does-not-require-root
diff --git a/t/tests/debhelper-compat-old/tags b/t/tests/debhelper-compat-old/tags
index 964a560..99c6b7f 100644
--- a/t/tests/debhelper-compat-old/tags
+++ b/t/tests/debhelper-compat-old/tags
@@ -1,4 +1,5 @@
 C: debhelper-compat-old source: debian-build-system dh
+C: debhelper-compat-old source: rules-does-not-require-root
 C: debhelper-compat-old source: source-format 1.0 [non-native]
 C: debhelper-compat-old: no-ctrl-scripts
 P: debhelper-compat-old source: package-uses-old-debhelper-compat-version 8
diff --git a/t/source/fields-src-bad-version/control.in b/t/tests/rules-requires-root-binary-targets/debian/debian/control.in
similarity index 57%
copy from t/source/fields-src-bad-version/control.in
copy to t/tests/rules-requires-root-binary-targets/debian/debian/control.in
index a9377c0..574ca87 100644
--- a/t/source/fields-src-bad-version/control.in
+++ b/t/tests/rules-requires-root-binary-targets/debian/debian/control.in
@@ -1,14 +1,17 @@
 Source: {$source}
-Section: devel
 Priority: optional
+Section: {$section}
 Maintainer: {$author}
-Build-Depends: debhelper (>= 7), g++ (>= s4.0)
 Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: binary-targets
+Homepage: https://lintian.debian.org/
 
 Package: {$source}
-Architecture: all
+Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
 Description: {$description}
  This is a 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.
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
diff --git a/t/tests/rules-requires-root-binary-targets/desc b/t/tests/rules-requires-root-binary-targets/desc
new file mode 100644
index 0000000..e23d229
--- /dev/null
+++ b/t/tests/rules-requires-root-binary-targets/desc
@@ -0,0 +1,6 @@
+Testname: rules-requires-root-binary-targets
+Version: 1.0
+Description: Test for "Rules-Requires-Root: binary-targets"
+Options: -L +classification
+Test-For:
+  rules-requires-root-explicitly
diff --git a/t/tests/rules-requires-root-binary-targets/tags b/t/tests/rules-requires-root-binary-targets/tags
new file mode 100644
index 0000000..2f101e6
--- /dev/null
+++ b/t/tests/rules-requires-root-binary-targets/tags
@@ -0,0 +1,4 @@
+C: rules-requires-root-binary-targets source: debian-build-system dh
+C: rules-requires-root-binary-targets source: rules-requires-root-explicitly
+C: rules-requires-root-binary-targets source: source-format 1.0 [non-native]
+C: rules-requires-root-binary-targets: no-ctrl-scripts
diff --git a/t/source/fields-src-bad-version/control.in b/t/tests/rules-requires-root-no/debian/debian/control.in
similarity index 58%
copy from t/source/fields-src-bad-version/control.in
copy to t/tests/rules-requires-root-no/debian/debian/control.in
index a9377c0..e4ad6e2 100644
--- a/t/source/fields-src-bad-version/control.in
+++ b/t/tests/rules-requires-root-no/debian/debian/control.in
@@ -1,14 +1,17 @@
 Source: {$source}
-Section: devel
 Priority: optional
+Section: {$section}
 Maintainer: {$author}
-Build-Depends: debhelper (>= 7), g++ (>= s4.0)
 Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+Homepage: https://lintian.debian.org/
 
 Package: {$source}
-Architecture: all
+Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
 Description: {$description}
  This is a 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.
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
diff --git a/t/tests/rules-requires-root-no/desc b/t/tests/rules-requires-root-no/desc
new file mode 100644
index 0000000..2eddd7e
--- /dev/null
+++ b/t/tests/rules-requires-root-no/desc
@@ -0,0 +1,6 @@
+Testname: rules-requires-root-no
+Version: 1.0
+Description: Test for "Rules-Requires-Root: no"
+Options: -L +classification
+Test-For:
+  rules-does-not-require-root
diff --git a/t/tests/rules-requires-root-no/tags b/t/tests/rules-requires-root-no/tags
new file mode 100644
index 0000000..9f6d3c6
--- /dev/null
+++ b/t/tests/rules-requires-root-no/tags
@@ -0,0 +1,4 @@
+C: rules-requires-root-no source: debian-build-system dh
+C: rules-requires-root-no source: rules-does-not-require-root
+C: rules-requires-root-no source: source-format 1.0 [non-native]
+C: rules-requires-root-no: no-ctrl-scripts

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


Reply to: