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

[lintian] 03/05: Add parameter to prevent tagging when parsing values



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

nthykier pushed a commit to branch master
in repository lintian.

commit 9e851c8645aa5f801f44334b5b902b4155524633
Author: Felipe Sateler <fsateler@debian.org>
Date:   Sat Jun 27 22:01:19 2015 -0300

    Add parameter to prevent tagging when parsing values
    
    Enables us to prevent multiple service-key-has-whitespace
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/systemd.pm                         | 7 ++++---
 t/tests/systemd-complex-service-file/tags | 1 -
 t/tests/systemd-general/tags              | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/checks/systemd.pm b/checks/systemd.pm
index 79b413e..eea80be 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -146,7 +146,7 @@ sub get_systemd_service_names {
         $safe_add_service->($name, $file);
 
         my @aliases
-          = extract_service_file_values($info, $file, 'Install', 'Alias');
+          = extract_service_file_values($info, $file, 'Install', 'Alias', 1);
 
         for my $alias (@aliases) {
             $safe_add_service->($alias, $file);
@@ -210,14 +210,15 @@ sub service_file_lines {
 
 # Extracts the values of a specific Key from a .service file
 sub extract_service_file_values {
-    my ($info, $file, $extract_section, $extract_key) = @_;
+    my ($info, $file, $extract_section, $extract_key, $skip_tag) = @_;
 
     my (@values, $section);
 
     my @lines = service_file_lines($file);
     my $key_ws = first_index { /^[[:alnum:]]+(\s*=\s|\s+=)/ } @lines;
     if ($key_ws > -1) {
-        tag 'service-key-has-whitespace', $file, 'at line', $key_ws;
+        tag 'service-key-has-whitespace', $file, 'at line', $key_ws
+          unless $skip_tag;
     }
     if (any { /^\.include / } @lines) {
         my $parent_dir = $file->parent_dir;
diff --git a/t/tests/systemd-complex-service-file/tags b/t/tests/systemd-complex-service-file/tags
index 1ffee42..61a9669 100644
--- a/t/tests/systemd-complex-service-file/tags
+++ b/t/tests/systemd-complex-service-file/tags
@@ -1,4 +1,3 @@
 E: systemd-complex-service-file: service-key-has-whitespace lib/systemd/system/test3.service at line 3
-E: systemd-complex-service-file: service-key-has-whitespace lib/systemd/system/test3.service at line 3
 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/tags b/t/tests/systemd-general/tags
index 3223f6a..6f693e3 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -1,8 +1,6 @@
 E: systemd-general: init-script-is-not-a-file etc/init.d/fifo-pipe-as-init
 E: systemd-general: service-file-is-not-a-file etc/systemd/system/fifo-pipe-as-init.service
 E: systemd-general: service-key-has-whitespace etc/systemd/system/test.service at line 3
-E: systemd-general: service-key-has-whitespace etc/systemd/system/test.service at line 3
-E: systemd-general: service-key-has-whitespace usr/lib/systemd/system/test.service at line 3
 E: systemd-general: service-key-has-whitespace usr/lib/systemd/system/test.service at line 3
 E: systemd-general: special-file etc/init.d/fifo-pipe-as-init 0644
 E: systemd-general: special-file etc/systemd/system/fifo-pipe-as-init.service 0644

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


Reply to: