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

[SCM] Debian package checker branch, master, updated. 2.5.1-20-g84eeda7



The following commit has been merged in the master branch:
commit 84eeda71efab89ea4017bcf0320d219b9cda0fdc
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Jun 26 22:05:52 2011 +0200

    Added a list of makefiles that do not implement (all) targets
    
    With this list Lintian no longer false-negatives on rules that
    includes common makefiles such as patch system makefiles that
    provide the patch/unpatch targets.

diff --git a/checks/rules b/checks/rules
index a8da26b..2ac1d3f 100644
--- a/checks/rules
+++ b/checks/rules
@@ -18,6 +18,7 @@ use strict;
 use warnings;
 
 use Util;
+use Lintian::Data;
 use Lintian::Tags qw(tag);
 
 our $PYTHON_DEPEND = 'python | python-dev | python-all | python-all-dev';
@@ -26,6 +27,8 @@ our $PYTHON2X_DEPEND = join (' | ', map { "python$_ | python$_-dev" } qw(2.6 2.7
 our $PYTHON3X_DEPEND = join (' | ', map { "python$_ | python$_-dev" } qw(3.2));
 our $ANYPYTHON_DEPEND = "$PYTHON_DEPEND | $PYTHON2X_DEPEND | $PYTHON3_DEPEND | $PYTHON3X_DEPEND";
 
+my $KNOWN_MAKEFILES = Lintian::Data->new('rules/known-makefiles', '\|\|');
+
 # Certain build tools must be listed in Build-Depends even if there are no
 # arch-specific packages because they're required in order to run the clean
 # rule.  (See Policy 7.6.)  The following is a list of package dependencies;
@@ -155,7 +158,18 @@ my $maybe_skipping;
 my $uses_makefile_pl = 0;
 while (<RULES>) {
     next if /^\s*\#/;
-    $includes = 1 if m/^\s*[s-]?include\s+/o;
+    if (m/^\s*[s-]?include\s+(\S++)/o){
+        my $makefile = $1;
+        my $targets = $KNOWN_MAKEFILES->value($makefile);
+        if (defined $targets){
+            foreach my $target (split m/\s*+,\s*+/o, $targets){
+                $seen{$target}++ if $required{$target};
+                $seen{$target}++ if $recommended{$target};
+            }
+        } else {
+            $includes = 1;
+        }
+    }
     $uses_makefile_pl = 1 if m/Makefile\.PL/o;
 
     # Check for DH_COMPAT settings outside of any rule, which are now
diff --git a/data/rules/known-makefiles b/data/rules/known-makefiles
new file mode 100644
index 0000000..183632e
--- /dev/null
+++ b/data/rules/known-makefiles
@@ -0,0 +1,34 @@
+# Manual maintained list of known makefiles and their
+# (lack of) targets.  This is used to avoid assuming
+# that (e.g.) the quilt makefile provides all needed
+# targets.
+#
+# Syntax:
+#
+# <makefile>||[<target>[, <target2> ...]]
+#
+#
+
+# Variables only or providing non-standard targets
+#  (targets not mentioned in the policy at all)
+/usr/share/cli-common/cli-nant.make||
+/usr/share/cli-common/cli.make||
+/usr/share/coq/coqvars.mk||
+/usr/share/gcj/debian_defaults||
+/usr/share/hardening-includes/hardening.make||
+/usr/share/javahelper/java-vars.mk||
+/usr/share/libdbi-perl/perl-dbdabi.make||
+/usr/share/mpi-default-dev/debian_defaults||
+/usr/share/ocaml/ocamlinit.mk||
+/usr/share/ocaml/ocamlvars.mk||
+/usr/share/octave/debian/defs.make||
+/usr/share/pkg-kde-tools/makefiles/1/variables.mk||
+/usr/share/postgresql-common/pgxs_debian_control.mk||
+/usr/share/pycentral-data/pycentral.mk||
+/usr/share/python/python.mk||
+/usr/share/python3/python.mk||
+
+# Makefiles with (possibly) relevant targets
+/usr/share/quilt/quilt.make||patch, unpatch, $(QUILT_STAMPFN)
+/usr/share/dpatch/dpatch.make||patch, unpatch
+/usr/share/topgit/tg2quilt.mk||patch, unpatch
diff --git a/debian/changelog b/debian/changelog
index d478b80..186e0d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,10 +28,20 @@ lintian (2.5.2) UNRELEASED; urgency=low
     + [NT] Removed a leading slash from the filename part of the
       extra for python-debug-in-wrong-location.  Thanks to
       Jakub Wilk for the report and the patch.  (Closes: #631530)
+  * checks/rules:
+    + [NT] Check included files in d/rules against a limited
+      number of common makefile snippets, which are known not
+      to implement all the required targets.  This prevents
+      false negatives of missing targets.  Thanks to
+      Jakub Wilk for the suggestion and the initial makefile
+      list.  (Closes: #631711)
   * checks/symlinks:
     + [NT] Symlink checking extended to relative paths as well.
       (Closes: #217023)
 
+  * data/rules/known-makefiles:
+    + [NT] Added file.
+
   * frontend/lintian:
     + [NT] Ensure that all dependency collections of a check are
       loaded.  Previously Lintian would only load direct
diff --git a/t/tests/rules-missing-targets-with-known-includes/debian/debian/rules b/t/tests/rules-missing-targets-with-known-includes/debian/debian/rules
new file mode 100755
index 0000000..e92755b
--- /dev/null
+++ b/t/tests/rules-missing-targets-with-known-includes/debian/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+
+# This should trigger a missing $type targets, since
+# we know the makefile does not implement them.
+include /usr/share/javahelper/java-vars.mk
+
+clean build binary:
+	dh $@
diff --git a/t/tests/rules-missing-targets-with-known-includes/desc b/t/tests/rules-missing-targets-with-known-includes/desc
new file mode 100644
index 0000000..113279e
--- /dev/null
+++ b/t/tests/rules-missing-targets-with-known-includes/desc
@@ -0,0 +1,7 @@
+Testname: rules-missing-targets-with-known-includes
+Sequence: 6000
+Version: 1.0
+Description: Test for debian/rules with known included file
+Test-For:
+ debian-rules-missing-required-target
+ debian-rules-missing-recommended-target
diff --git a/t/tests/rules-missing-targets-with-known-includes/tags b/t/tests/rules-missing-targets-with-known-includes/tags
new file mode 100644
index 0000000..6b5eba7
--- /dev/null
+++ b/t/tests/rules-missing-targets-with-known-includes/tags
@@ -0,0 +1,4 @@
+E: rules-missing-targets-with-known-includes source: debian-rules-missing-required-target binary-arch
+E: rules-missing-targets-with-known-includes source: debian-rules-missing-required-target binary-indep
+W: rules-missing-targets-with-known-includes source: debian-rules-missing-recommended-target build-arch
+W: rules-missing-targets-with-known-includes source: debian-rules-missing-recommended-target build-indep

-- 
Debian package checker


Reply to: