This is an automated email from the git hooks/post-receive script. nthykier pushed a commit to branch master in repository lintian.
commit f9e89ceda1967d876855b4bae9224b811724deb5 Author: Bastien ROUCARIÈS <[email protected]> Date: Wed Aug 28 23:05:26 2013 +0200 c/rules: Push known d/rules targets to a data file Signed-off-by: Niels Thykier <[email protected]> --- checks/rules.pm | 44 ++++++++++++++++++++------------------------ data/rules/policy-rules | 17 +++++++++++++++++ 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/checks/rules.pm b/checks/rules.pm index 0cd6005..a712dcb 100644 --- a/checks/rules.pm +++ b/checks/rules.pm @@ -34,6 +34,7 @@ our $ANYPYTHON_DEPEND my $KNOWN_MAKEFILES = Lintian::Data->new('rules/known-makefiles', '\|\|'); my $DEPRECATED_MAKEFILES = Lintian::Data->new('rules/deprecated-makefiles'); +my $POLICYRULES = Lintian::Data->new('rules/policy-rules', qr/\s++/); # 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 @@ -94,17 +95,6 @@ my @RULE_CLEAN_DEPENDS =( [quilt => qr'^\t\s*(\S+=\S+\s+)*quilt\s'], ); -# The following targets are required per Policy. -my %required = map { $_ => 'required' } qw(build binary binary-arch binary-indep clean); - -# The following targets are recommended per Policy. -my %recommendedbuild = map { $_ => 'recommended_allindep' } qw(build-arch build-indep); - -my %goodpracticedfsg = map { $_ => 'goodpractice_dfsg' } qw(get-orig-source); - -# The following rules are required or recommended per policy -my %policyrules = ( %required, %recommendedbuild, %goodpracticedfsg); - # Rules about required debhelper command ordering. Each command is put into a # class and the tag is issued if they're called in the wrong order for the # classes. Unknown commands won't trigger this flag. @@ -176,7 +166,7 @@ sub run { my $targets = $KNOWN_MAKEFILES->value($makefile); if (defined $targets){ foreach my $target (split m/\s*+,\s*+/o, $targets){ - $seen{$target}++ if $policyrules{$target}; + $seen{$target}++ if $POLICYRULES->known($target); } } else { $includes = 1; @@ -265,13 +255,13 @@ sub run { # we ought to "delay" it was a "=" variable rather # than ":=" or "+=". for (split m/\s++/o, rstrip($val)) { - $seen{$_}++ if $policyrules{$_}; + $seen{$_}++ if $POLICYRULES->known($_); } last; } # We don't know, so just mark the target as seen. } - $seen{$_}++ if $policyrules{$_}; + $seen{$_}++ if $POLICYRULES->known($_); } next; #.PHONY implies the rest will not match } @@ -288,8 +278,8 @@ sub run { if ($target =~ m/%/o) { my $pattern = quotemeta $target; $pattern =~ s/\\%/.*/g; - for my $policyrules (keys %policyrules) { - $seen{$policyrules}++ if $policyrules =~ m/$pattern/; + for my $rulebypolicy ($POLICYRULES->all) { + $seen{$rulebypolicy}++ if $rulebypolicy =~ m/$pattern/; } } else { # Is it $(VAR) ? @@ -302,13 +292,13 @@ sub run { # than ":=" or "+=". local $_; for (split m/\s++/o, rstrip($val)) { - $seen{$_}++ if $policyrules{$_}; + $seen{$_}++ if $POLICYRULES->known($_); } last; } # We don't know, so just mark the target as seen. } - $seen{$target}++ if $policyrules{$target}; + $seen{$target}++ if $POLICYRULES->known($target); } if (any { $target =~ /$_/ } @arch_rules) { push(@arch_rules, @depends); @@ -366,19 +356,25 @@ sub run { unless ($includes) { my $rec_allindep = 0; # Make sure all the required rules were seen. - for my $target (sort keys %policyrules) { + for my $target ($POLICYRULES->all) { unless ($seen{$target}) { - if($policyrules{$target} eq 'required') { + my $typerule = $POLICYRULES->value($target); + if($typerule eq 'required') { tag 'debian-rules-missing-required-target', $target; - } elsif ($policyrules{$target} eq 'recommended_allindep') { + } elsif ($typerule eq 'recommended_allindep') { tag 'debian-rules-missing-recommended-target', $target; $rec_allindep++; - } elsif ($policyrules{$target} eq 'goodpractice_dfsg') { + } elsif ($typerule eq 'goodpractice_dfsg') { if ($version =~ /(dfsg|debian|ds)/) { - tag 'debian-rules-missing-good-practice-target-dfsg', $target; + tag 'debian-rules-missing-good-practice-target-dfsg', + $target; } } else { - croak 'unknown type of policy rules'; + $typerule ||= '<N/A>'; + croak( + join(' ', + 'unknown type of policy rules:', + "$typerule (target: $target)")); } } } diff --git a/data/rules/policy-rules b/data/rules/policy-rules new file mode 100644 index 0000000..a86de92 --- /dev/null +++ b/data/rules/policy-rules @@ -0,0 +1,17 @@ +# add required/recommended rules +# format is +# <name-of-rules> <type> +# where <type> is one of: +# - "required" => For required rules (prior to 3.9.4) +# - recommended_allindep => For the new required targets in 3.9.4 +# (these used to just be recommended) +# - goodpractice_dfsg => Target recommended for repacked packages +# (e.g. packages with non-free files removed) +build required +binary required +binary-arch required +binary-indep required +clean required +build-arch recommended_allindep +build-indep recommended_allindep +get-orig-source goodpractice_dfsg -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

