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

[lintian] 01/01: c/systemd: Flag systemd units without "Documentation" field



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

nthykier pushed a commit to branch master
in repository lintian.

commit 5fb291ed1f6bb2970559e0ed57416353506f7238
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Feb 27 19:47:10 2016 +0000

    c/systemd: Flag systemd units without "Documentation" field
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/systemd.desc                                              | 9 +++++++++
 checks/systemd.pm                                                | 6 ++++++
 debian/changelog                                                 | 3 +++
 t/tests/systemd-complex-service-file/debian/debian/test.service  | 1 +
 t/tests/systemd-complex-service-file/debian/debian/test2.service | 1 +
 t/tests/systemd-complex-service-file/desc                        | 1 +
 t/tests/systemd-complex-service-file/tags                        | 1 +
 t/tests/systemd-general/desc                                     | 1 +
 t/tests/systemd-general/tags                                     | 2 ++
 9 files changed, 25 insertions(+)

diff --git a/checks/systemd.desc b/checks/systemd.desc
index e895606..7c8eddb 100644
--- a/checks/systemd.desc
+++ b/checks/systemd.desc
@@ -117,3 +117,12 @@ Info: The service file lists an alias without an file extension.
  .
  The spec mandates that the extension of the listed alias matches
  the extension of the unit itself.
+
+Tag: systemd-service-file-missing-documentation-key
+Severity: wishlist
+Certainty: certain
+Info: The systemd service file does not contain a <tt>Documentation</tt> key.
+ .
+ Documentation for systemd service files can be automatically viewed using
+ <tt>systemctl help servicename</tt> if this field is present.
+Ref: systemd.unit(5)
diff --git a/checks/systemd.pm b/checks/systemd.pm
index 48ce856..69092be 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -189,6 +189,12 @@ sub check_systemd_service_file {
     my @obsolete = grep { /^(?:syslog|dbus)\.target$/ } @values;
     tag 'systemd-service-file-refers-to-obsolete-target', $file, $_
       for @obsolete;
+
+    if (not $file->is_symlink or $file->link ne '/dev/null') {
+        tag 'systemd-service-file-missing-documentation-key', $file,
+          unless extract_service_file_values($file, 'Unit', 'Documentation',1);
+    }
+
     return 1;
 }
 
diff --git a/debian/changelog b/debian/changelog
index eb3cc98..507a738 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ lintian (2.5.42) UNRELEASED; urgency=medium
     + [NT] Apply patch from Rafael Kitover to avoid some
       false-positives with the DEP-5 copyright format.
       (Closes: #795641)
+  * checks/systemd.{desc,pm}:
+    + [NT] Apply patch from Chris Lamb to flag systemd units
+      without the "Documentation" key.  (Closes: #799083)
 
   * debian/control:
     + [NT] Add (Build-)Dependency on libdata-alias-perl due
diff --git a/t/tests/systemd-complex-service-file/debian/debian/test.service b/t/tests/systemd-complex-service-file/debian/debian/test.service
index 820b731..e62b6a1 100644
--- a/t/tests/systemd-complex-service-file/debian/debian/test.service
+++ b/t/tests/systemd-complex-service-file/debian/debian/test.service
@@ -1,5 +1,6 @@
 [Unit]
 After=dbus.target
+Documentation=https://www.freedesktop.org/wiki/Software/dbus/
 
 [Service]
 ExecStart=/usr/bin/test
diff --git a/t/tests/systemd-complex-service-file/debian/debian/test2.service b/t/tests/systemd-complex-service-file/debian/debian/test2.service
index 71c1297..65e85d5 100644
--- a/t/tests/systemd-complex-service-file/debian/debian/test2.service
+++ b/t/tests/systemd-complex-service-file/debian/debian/test2.service
@@ -3,3 +3,4 @@
 [Unit]
 After=
 After=syslog.target
+Documentation=https://www.freedesktop.org/wiki/Software/dbus/
diff --git a/t/tests/systemd-complex-service-file/desc b/t/tests/systemd-complex-service-file/desc
index d06284f..98ec594 100644
--- a/t/tests/systemd-complex-service-file/desc
+++ b/t/tests/systemd-complex-service-file/desc
@@ -6,3 +6,4 @@ Description: Verifies the .service file parser properly handles .include within
 Test-For:
  service-key-has-whitespace
  systemd-service-file-refers-to-obsolete-target
+ systemd-service-file-missing-documentation-key
diff --git a/t/tests/systemd-complex-service-file/tags b/t/tests/systemd-complex-service-file/tags
index 61a9669..34cb40a 100644
--- a/t/tests/systemd-complex-service-file/tags
+++ b/t/tests/systemd-complex-service-file/tags
@@ -1,3 +1,4 @@
 E: systemd-complex-service-file: service-key-has-whitespace lib/systemd/system/test3.service at line 3
+I: systemd-complex-service-file: systemd-service-file-missing-documentation-key lib/systemd/system/test3.service
 W: systemd-complex-service-file: systemd-service-file-refers-to-obsolete-target lib/systemd/system/test.service dbus.target
 W: systemd-complex-service-file: systemd-service-file-refers-to-obsolete-target lib/systemd/system/test2.service syslog.target
diff --git a/t/tests/systemd-general/desc b/t/tests/systemd-general/desc
index 4d12ddb..48994f1 100644
--- a/t/tests/systemd-general/desc
+++ b/t/tests/systemd-general/desc
@@ -10,6 +10,7 @@ Test-For:
  service-key-has-whitespace
  systemd-service-file-outside-lib
  systemd-tmpfiles.d-outside-usr-lib
+ systemd-service-file-missing-documentation-key
  systemd-service-file-refers-to-obsolete-target
  systemd-no-service-for-init-script
  systemd-no-service-for-init-rcS-script
diff --git a/t/tests/systemd-general/tags b/t/tests/systemd-general/tags
index c1651ef..3d9bb5d 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -10,6 +10,8 @@ E: systemd-general: systemd-service-file-outside-lib etc/systemd/system/fifo-pip
 E: systemd-general: systemd-service-file-outside-lib etc/systemd/system/test.service
 E: systemd-general: systemd-service-file-outside-lib usr/lib/systemd/system/test.service
 E: systemd-general: systemd-tmpfiles.d-outside-usr-lib etc/tmpfiles.d/test.conf
+I: systemd-general: systemd-service-file-missing-documentation-key etc/systemd/system/test.service
+I: systemd-general: systemd-service-file-missing-documentation-key usr/lib/systemd/system/test.service
 W: systemd-general: init.d-script-does-not-source-init-functions etc/init.d/systemd-general
 W: systemd-general: maintainer-script-calls-systemctl postrm:6
 W: systemd-general: script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/bootmisc.sh

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


Reply to: