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

[SCM] Debian package checker branch, master, updated. 2.5.14-61-g3e95c81



The following commit has been merged in the master branch:
commit 3e95c81b8e7037fa411329d177f593e060a27254
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Jul 10 19:24:57 2013 +0200

    doc/examples: Add example checks and profile
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index ce93d2e..105fad7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,9 +60,14 @@ lintian (2.5.15) UNRELEASED; urgency=low
     + [NT] Remove /var/lib/lintian, we no longer use it.
   * debian/docs:
     + [NT] Add auto-generated API documentation.
+  * debian/lintian.examples:
+    + [NT] New file to install examples.
   * debian/rules:
     + [NT] Generate API documentation during build.
+    + [NT] Call dh_installexamples.
 
+  * doc/examples/*
+    + [NT] New example files.
   * doc/lintian.xml:
     + [NT] Add small example vendor profile to the user
       manual.
diff --git a/debian/rules b/debian/rules
index b6d9b60..ddfbfea 100755
--- a/debian/rules
+++ b/debian/rules
@@ -107,6 +107,7 @@ binary-indep: $(neededfiles) build
 	install -m 644 doc/lintianrc.example $(tmp)/etc/lintianrc
 	dh_installdocs
 	dh_installchangelogs
+	dh_installexamples
 	dh_installman
 	dh_compress
 	dh_fixperms
diff --git a/doc/examples/checks/my-vendor/another-check.desc b/doc/examples/checks/my-vendor/another-check.desc
new file mode 100644
index 0000000..37a853b
--- /dev/null
+++ b/doc/examples/checks/my-vendor/another-check.desc
@@ -0,0 +1,11 @@
+Check-Script: my-vendor/another-check
+Author: Niels Thykier <niels@thykier.net>
+Type: binary
+Info: An example binary check
+Needs-Info: index
+
+Tag: missing-some-important-file
+Severity: serious
+Certainty: certain
+Info: The package is missing a very important file, which
+ is required for all packages of my-vendor.
diff --git a/t/scripts/check-load.t b/doc/examples/checks/my-vendor/another-check.pm
old mode 100755
new mode 100644
similarity index 66%
copy from t/scripts/check-load.t
copy to doc/examples/checks/my-vendor/another-check.pm
index 9d14a4e..788f351
--- a/t/scripts/check-load.t
+++ b/doc/examples/checks/my-vendor/another-check.pm
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2012 Niels Thykier
+# my-vendor/another-check -- lintian example check script -*- perl -*-
+#
+# Copyright © 2013 Niels Thykier <niels@thykier.net>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,26 +18,20 @@
 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
+package Lintian::my_vendor::another_check;
+
 use strict;
 use warnings;
 
-use Test::More import => ['done_testing'];
-
-use Test::Lintian;
+use Lintian::Tags qw(tag);
 
-# Test that all checks can be loaded (except lintian.desc, which is
-# a special case).
-sub accept_filter {
-    return !m,/lintian\.desc$,;
+sub run {
+    my ($pkg, undef, $info) = @_;
+    if (not $info->index("usr/share/doc/$pkg/important-file")) {
+        tag 'missing-some-important-file',
+            "usr/share/doc/$pkg/important-file";
+    }
+    return;
 }
 
-my $opts = {
-    'filter' => \&accept_filter,
-};
-
-$ENV{'LINTIAN_ROOT'} //= '.';
-
-test_load_checks ($opts, "$ENV{'LINTIAN_ROOT'}/checks");
-
-done_testing;
-
+1;
diff --git a/doc/examples/checks/my-vendor/some-check.desc b/doc/examples/checks/my-vendor/some-check.desc
new file mode 100644
index 0000000..bc39c93
--- /dev/null
+++ b/doc/examples/checks/my-vendor/some-check.desc
@@ -0,0 +1,10 @@
+Check-Script: my-vendor/some-check
+Author: Niels Thykier <niels@thykier.net>
+Type: source
+Info: An example source check
+
+Tag: missing-build-depends-on-my-vendor-tools
+Severity: serious
+Certainty: certain
+Info: The package name starts with "my-vendor-" and is missing a
+ Build-Depends on my-vendor-tools.
diff --git a/t/scripts/check-load.t b/doc/examples/checks/my-vendor/some-check.pm
old mode 100755
new mode 100644
similarity index 57%
copy from t/scripts/check-load.t
copy to doc/examples/checks/my-vendor/some-check.pm
index 9d14a4e..4a1d02a
--- a/t/scripts/check-load.t
+++ b/doc/examples/checks/my-vendor/some-check.pm
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2012 Niels Thykier
+# my-vendor/some-check -- lintian example check script -*- perl -*-
+#
+# Copyright © 2013 Niels Thykier <niels@thykier.net>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,26 +18,26 @@
 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
+package Lintian::my_vendor::some_check;
+
 use strict;
 use warnings;
 
-use Test::More import => ['done_testing'];
-
-use Test::Lintian;
+use Lintian::Tags qw(tag);
 
-# Test that all checks can be loaded (except lintian.desc, which is
-# a special case).
-sub accept_filter {
-    return !m,/lintian\.desc$,;
-}
-
-my $opts = {
-    'filter' => \&accept_filter,
-};
+sub run {
+    my ($pkg, undef, $info) = @_;
 
-$ENV{'LINTIAN_ROOT'} //= '.';
+    # This check only applies to source packages that are named
+    # my-vendor-<something>
+    return unless $pkg =~ m{\A my-vendor-}xsm;
+    # Does not apply to the source "my-vendor-tools"
+    return if $pkg eq 'my-vendor-tools';
 
-test_load_checks ($opts, "$ENV{'LINTIAN_ROOT'}/checks");
-
-done_testing;
+    if (not $info->relation('build-depends')->implies('my-vendor-tools')) {
+        tag 'missing-build-depends-on-my-vendor-tools';
+    }
+    return;
+}
 
+1;
diff --git a/doc/examples/profiles/my-vendor/main.profile b/doc/examples/profiles/my-vendor/main.profile
new file mode 100644
index 0000000..fe61cd6
--- /dev/null
+++ b/doc/examples/profiles/my-vendor/main.profile
@@ -0,0 +1,18 @@
+# The default profile for "my-vendor"
+Profile: my-vendor/main
+# It has all the checks and settings from the "debian" profile
+Extends: debian/main
+# Add checks specific to "my-vendor"
+Enable-Tags-From-Check:
+  my-vendor/some-check,
+  my-vendor/another-check,
+# Disable a tag
+Disable-Tags: dir-or-file-in-opt
+
+# Bump severity of no-md5sums-control-file
+# and file-missing-in-md5sums and make them
+# non-overrable
+Tags: no-md5sums-control-file,
+      file-missing-in-md5sums,
+Severity: serious
+Overridable: no
diff --git a/t/scripts/check-descs.t b/t/scripts/check-descs.t
index dff5288..ed83086 100755
--- a/t/scripts/check-descs.t
+++ b/t/scripts/check-descs.t
@@ -33,6 +33,7 @@ my $opts = {
     'coll-dir' => "$ENV{'LINTIAN_ROOT'}/collection",
 };
 
-test_check_desc ($opts, "$ENV{'LINTIAN_ROOT'}/checks");
+test_check_desc($opts, "$ENV{'LINTIAN_ROOT'}/checks");
+test_check_desc($opts, "$ENV{'LINTIAN_ROOT'}/doc/examples/checks");
 
 done_testing;
diff --git a/t/scripts/check-load.t b/t/scripts/check-load.t
index 9d14a4e..0170b73 100755
--- a/t/scripts/check-load.t
+++ b/t/scripts/check-load.t
@@ -37,7 +37,8 @@ my $opts = {
 
 $ENV{'LINTIAN_ROOT'} //= '.';
 
-test_load_checks ($opts, "$ENV{'LINTIAN_ROOT'}/checks");
+test_load_checks($opts, "$ENV{'LINTIAN_ROOT'}/checks");
+test_load_checks("$ENV{'LINTIAN_ROOT'}/doc/examples/checks");
 
 done_testing;
 
diff --git a/t/scripts/critic.t b/t/scripts/critic.t
index 732c01f..ef757fb 100755
--- a/t/scripts/critic.t
+++ b/t/scripts/critic.t
@@ -23,7 +23,9 @@ diag('libppix-regexp-perl is needed to enable some checks') if $@;
 
 Test::Perl::Critic->import( -profile => '.perlcriticrc' );
 
-my @DIRS = (qw(checks collection frontend helpers lib private reporting t/scripts t/helpers));
+my @DIRS = (qw(checks collection frontend helpers lib private
+   reporting t/scripts t/helpers doc/examples/checks
+));
 
 plan tests => scalar(@DIRS) + 1;
 
diff --git a/t/scripts/implemented-tags.t b/t/scripts/implemented-tags.t
index bbc22f0..559d270 100755
--- a/t/scripts/implemented-tags.t
+++ b/t/scripts/implemented-tags.t
@@ -59,6 +59,7 @@ my $opts = {
 
 $ENV{'LINTIAN_ROOT'} //= '.';
 
-test_tags_implemented ($opts, "$ENV{LINTIAN_ROOT}/checks");
+test_tags_implemented($opts, "$ENV{LINTIAN_ROOT}/checks");
+test_tags_implemented("$ENV{LINTIAN_ROOT}/doc/examples/checks");
 
 done_testing;
diff --git a/t/scripts/needs-info-missing.t b/t/scripts/needs-info-missing.t
index 989a60f..43589c3 100755
--- a/t/scripts/needs-info-missing.t
+++ b/t/scripts/needs-info-missing.t
@@ -28,6 +28,7 @@ $ENV{'LINTIAN_ROOT'} //= '.';
 
 # Find all of the desc files in checks.  We'll do one check per description.
 our @DESCS = (glob("$ENV{LINTIAN_ROOT}/checks/*.desc"),
+              glob("$ENV{LINTIAN_ROOT}/doc/examples/checks/my-vendor/*.desc"),
               glob("$ENV{LINTIAN_ROOT}/collection/*.desc"));
 our @MODULES = (glob("$ENV{LINTIAN_ROOT}/lib/Lintian/Collect.pm"),
 		glob("$ENV{LINTIAN_ROOT}/lib/Lintian/Collect/*.pm"));
diff --git a/t/scripts/profiles-coverage.t b/t/scripts/profiles-coverage.t
index 2ffc508..4a23e3b 100755
--- a/t/scripts/profiles-coverage.t
+++ b/t/scripts/profiles-coverage.t
@@ -17,10 +17,12 @@ my %CHECKS;
 my %TAGS;
 
 File::Find::find(\&check_wanted, "$root/checks");
+File::Find::find(\&check_wanted, "$root/doc/examples/checks");
 
 plan tests => scalar (keys %TAGS);
 
 File::Find::find(\&prof_wanted, "$root/profiles");
+File::Find::find(\&prof_wanted, "$root/doc/examples/profiles");
 
 foreach my $tag (sort keys %TAGS){
     cmp_ok($TAGS{$tag}, '>', 0, $tag);
diff --git a/t/scripts/strict.t b/t/scripts/strict.t
index bce75f3..1854ecd 100755
--- a/t/scripts/strict.t
+++ b/t/scripts/strict.t
@@ -15,7 +15,7 @@ plan skip_all => 'Test::Strict required to run this test' if $@;
 
 $ENV{'LINTIAN_ROOT'} //= '.';
 
-my @DIRS = map { "$ENV{'LINTIAN_ROOT'}/$_" } qw(lib private frontend helpers collection checks);
+my @DIRS = map { "$ENV{'LINTIAN_ROOT'}/$_" } qw(lib private frontend helpers collection checks doc/examples/checks);
 all_perl_files_ok(@DIRS);
 
 # html_reports loads ./config, so we have do chdir before checking it.

-- 
Debian package checker


Reply to: