This will close #460174.
---
 checks/rules.desc                  |   10 ++++++++++
 checks/rules.pm                    |   23 ++++++++++++++++-------
 t/tests/rules-missing-targets/desc |    4 +++-
 t/tests/rules-missing-targets/tags |    1 +
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/checks/rules.desc b/checks/rules.desc
index 5a9dfe7..b8f29d5 100644
--- a/checks/rules.desc
+++ b/checks/rules.desc
@@ -59,6 +59,16 @@ Info: The <tt>debian/rules</tt> file for this package does 
not provide
  .
  These targets will be required by policy in the future, so should be
  added to prevent future breakage.
+ 
+Tag: debian-rules-missing-good-practice-target-dfsg
+Severity: normal
+Certainty: certain
+Ref: policy 4.9, devref 6.7.8.2
+Info: The <tt>debian/rules</tt> file for this package does not provide
+ one of the good practice targets.
+ .
+ If your packaged is repacked from non dfsg source, you should add a
+ get-orig-source target.
 
 Tag: debian-rules-uses-deprecated-makefile
 Severity: normal
diff --git a/checks/rules.pm b/checks/rules.pm
index ae272c5..e27bc34 100644
--- a/checks/rules.pm
+++ b/checks/rules.pm
@@ -98,10 +98,12 @@ my @RULE_CLEAN_DEPENDS =(
 my %required = map { $_ => 'required' } qw(build binary binary-arch 
binary-indep clean);
 
 # The following targets are recommended per Policy.
-my %recommended = map { $_ => 'recommended' } qw(build-arch build-indep);
+my %recommendedbuild = map { $_ => 'recommended_allindep' } qw(build-arch 
build-indep);
 
-# The following rules are required or recommanded per policy
-my %policyrules = ( %required, %recommended);
+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
@@ -129,6 +131,9 @@ sub run {
     }
 
     my $architecture = $info->field('architecture', '');
+    my $version = $info->field('version');
+    # If the version field is missing, we assume a neutral non-native one.
+    $version = '0-1' unless defined $version;
 
     open(my $rules_fd, '<', $rules);
 
@@ -359,22 +364,26 @@ sub run {
     close($rules_fd);
 
     unless ($includes) {
-        my $rec = 0;
+        my $rec_allindep = 0;
         # Make sure all the required rules were seen.
         for my $target (sort keys %policyrules) {
             unless ($seen{$target}) {
                 if($policyrules{$target} eq 'required') {
                     tag 'debian-rules-missing-required-target', $target;
-                } elsif ($policyrules{$target} eq 'recommended') {
+                } elsif ($policyrules{$target} eq 'recommended_allindep') {
                     tag 'debian-rules-missing-recommended-target', $target;
-                    $rec++;
+                    $rec_allindep++; 
+                } elsif ($policyrules{$target} eq 'goodpractice_dfsg') {
+                    if ($version =~ /(dfsg|debian|ds)/) {
+                        tag 'debian-rules-missing-good-practice-target-dfsg', 
$target;
+                    }
                 } else {
                     croak 'unknown type of policy rules';
                 }
             }
         }
 
-        if ($rec) {
+        if ($rec_allindep) {
             my $all = 0;
             my $notall = 0;
             foreach my $p ($group->get_processables) {
diff --git a/t/tests/rules-missing-targets/desc 
b/t/tests/rules-missing-targets/desc
index f92d7bb..6069129 100644
--- a/t/tests/rules-missing-targets/desc
+++ b/t/tests/rules-missing-targets/desc
@@ -1,7 +1,9 @@
 Testname: rules-missing-targets
 Sequence: 6000
-Version: 1.0
+Version: 1.0+dfsg-1
+Type: non-native
 Description: Test for missing targets in debian/rules
 Test-For:
+ debian-rules-missing-good-practice-target-dfsg
  debian-rules-missing-recommended-target
  package-would-benefit-from-build-arch-targets
diff --git a/t/tests/rules-missing-targets/tags 
b/t/tests/rules-missing-targets/tags
index ef2f56a..f5724c6 100644
--- a/t/tests/rules-missing-targets/tags
+++ b/t/tests/rules-missing-targets/tags
@@ -1,3 +1,4 @@
+W: rules-missing-targets source: 
debian-rules-missing-good-practice-target-dfsg get-orig-source
 W: rules-missing-targets source: debian-rules-missing-recommended-target 
build-arch
 W: rules-missing-targets source: debian-rules-missing-recommended-target 
build-indep
 W: rules-missing-targets source: package-would-benefit-from-build-arch-targets
-- 
1.7.10.4


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to