[SCM] Debian package checker branch, master, updated. 2.5.2-101-gcc55182
The following commit has been merged in the master branch:
commit cc55182e21c8a07a01e42528a3b7825ab2518bab
Author: Niels Thykier <niels@thykier.net>
Date: Sun Sep 4 11:08:18 2011 +0200
Added simple variable tracker in checks/rules
It relies mostly on "educated guesses" (and some assumptions
about how people use variables to create Policy mandated targets).
diff --git a/checks/rules b/checks/rules
index dddbd23..0c88104 100644
--- a/checks/rules
+++ b/checks/rules
@@ -154,6 +154,7 @@ my %rules_per_target;
my %debhelper_group;
my $maybe_skipping;
my $uses_makefile_pl = 0;
+my %variables;
while (<RULES>) {
next if /^\s*\#/;
if (m/^\s*[s-]?include\s+(\S++)/o){
@@ -201,6 +202,14 @@ while (<RULES>) {
tag 'debian-rules-makemaker-prefix-is-deprecated', "line $.";
}
+ # General assignment - save the variable
+ if (/^\s*(?:\S+\s+)*?(\S+)\s*([:\?\+])?=\s*(.*+)?$/o) {
+ # This is far too simple from a theoretical PoV, but should do
+ # rather well.
+ my ($var, $atype, $value) = ($1, $2, $3);
+ $variables{$var} = $value;
+ }
+
# Keep track of whether this portion of debian/rules may be optional
if (/^ifn?(?:eq|def)\s/) {
$maybe_skipping++;
@@ -227,10 +236,29 @@ while (<RULES>) {
# requirement.
if (/^(?:[^:]+\s)?\.PHONY(?:\s[^:]+)?:(.+)/) {
my @targets = split (' ', $1);
+ local $_;
for (@targets) {
+ # Is it $(VAR) ?
+ if (m/^\$[\(\{]([^\)\}]++)[\)\}]$/) {
+ my $name = $1;
+ my $val = $variables{$name};
+ if ($val) {
+ # we think we know what it will expand to - note
+ # we ought to "delay" it was a "=" variable rather
+ # than ":=" or "+=".
+ $val =~ s/\s++$//o;
+ for (split m/\s++/o, $val) {
+ $seen{$_}++ if $required{$_};
+ $seen{$_}++ if $recommended{$_};
+ }
+ last;
+ }
+ # We don't know, so just mark the target as seen.
+ }
$seen{$_}++ if $required{$_};
$seen{$_}++ if $recommended{$_};
}
+ next; #.PHONY implies the rest will not match
}
if (!/^ifn?(?:eq|def)\s/ && m/^([^\s:][^:]*):+(.*)/) {
@@ -251,6 +279,24 @@ while (<RULES>) {
$seen{$recommended}++ if $recommended =~ m/$pattern/;
}
} else {
+ # Is it $(VAR) ?
+ if ($target =~ m/^\$[\(\{]([^\)\}]++)[\)\}]$/) {
+ my $name = $1;
+ my $val = $variables{$name};
+ if ($val) {
+ # we think we know what it will expand to - note
+ # we ought to "delay" it was a "=" variable rather
+ # than ":=" or "+=".
+ $val =~ s/\s++$//o;
+ local $_;
+ for (split m/\s++/o, $val) {
+ $seen{$_}++ if $required{$_};
+ $seen{$_}++ if $recommended{$_};
+ }
+ last;
+ }
+ # We don't know, so just mark the target as seen.
+ }
$seen{$target}++ if $required{$target};
$seen{$target}++ if $recommended{$target};
}
diff --git a/debian/changelog b/debian/changelog
index c427130..cbb855b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -96,6 +96,10 @@ lintian (2.5.3) UNRELEASED; urgency=low
* checks/patch-systems:
+ [NT] Use lsdiff to determine if a patch modifies the debian dir as
it is more accurate than diffstat for this. (Closes: #640131)
+ * checks/rules:
+ + [NT] Do a simple and minimal variable tracking. In very simple
+ cases, it can determine which targets a variable contains (when
+ the variable is used as a target). (Closes: #638411)
* checks/shared-libs{,.desc}:
+ [JW] Fixed a typo in a tag description. (Closes: #639177)
+ [NT] Do not emit shlib-calls-exit for libraries that have an
diff --git a/t/tests/rules-variable-targets/debian/debian/rules b/t/tests/rules-variable-targets/debian/debian/rules
new file mode 100644
index 0000000..bdb1c68
--- /dev/null
+++ b/t/tests/rules-variable-targets/debian/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+ TARGETS := build clean binary binary-arch binary-indep build-arch build-indep
+
+$(TARGETS):
+ dh $@
+
+.PHONY: $(TARGETS)
+
diff --git a/t/tests/rules-variable-targets/desc b/t/tests/rules-variable-targets/desc
new file mode 100644
index 0000000..a7bc41d
--- /dev/null
+++ b/t/tests/rules-variable-targets/desc
@@ -0,0 +1,5 @@
+Testname: rules-variable-targets
+Sequence: 6000
+Version: 1.0
+Description: Test against missing targets in debian/rules
+Test-Against: debian-rules-missing-recommended-target
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/rules-variable-targets/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/rules-variable-targets/tags
--
Debian package checker
Reply to: