Author: djpig
Date: 2006-01-02 10:10:47 +0100 (Mon, 02 Jan 2006)
New Revision: 532

Added:
   trunk/testset/cdbs-test/
   trunk/testset/cdbs-test/debian/
   trunk/testset/cdbs-test/debian/changelog
   trunk/testset/cdbs-test/debian/compat
   trunk/testset/cdbs-test/debian/control
   trunk/testset/cdbs-test/debian/copyright
   trunk/testset/cdbs-test/debian/packages
   trunk/testset/cdbs-test/debian/rules
   trunk/testset/tags.cdbs-test
Modified:
   trunk/checks/fields
   trunk/debian/changelog
Log:
Better check for false postives of build-depends-without-arch-dep.
Should fix false positives for cdbs, dbs, dpatch and yada. Based on
a patch by Russ Allbery (Closes: #344609, #321135, #339750)


Modified: trunk/checks/fields
===================================================================
--- trunk/checks/fields 2006-01-02 09:03:23 UTC (rev 531)
+++ trunk/checks/fields 2006-01-02 09:10:47 UTC (rev 532)
@@ -29,6 +29,28 @@
 use Tags;
 use Util;
 
+# 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 pairs of packages and
+# regular expressions that, if they match anywhere in the debian/rules file,
+# say that this package is allowed in Build-Depends.
+my @global_depends = (
+       [ cdbs => '^include\s+/usr/share/cdbs/' ],
+       [ dbs => '^include\s+/usr/share/dbs/' ],
+       [ debhelper => '^include\s+/usr/share/cdbs/1/rules/debhelper.mk' ],
+       [ dpatch => '^include\s+/usr/share/dpatch/' ]
+);
+
+# Similarly, these pairs of packages and regexes say that if the regex matches
+# in one of clean, build-arch, or binary-arch, this package is allowed in
+# Build-Depends.
+my @rule_depends = (
+       [ debhelper => '^\s+dh_.+' ]
+);
+
+# Note that yada is handled as a special case, based on the existence of
+# debian/packages.
+
 sub run {
 
 my $pkg = shift;
@@ -403,24 +425,37 @@
                        my $build_depends = <BD>;
                        close BD;
 
-                       my $uses_dh = 0;
+                       my %allowed;
                        if (not open (RULES, "debfiles/rules")) {
                                fail("cannot read debfiles/rules: $!");
                        } else {
                                my $target = "none";
-                               local $/ = "\n"; #Read this linewise            
                
+                               local $/ = "\n"; #Read this linewise
                                while (<RULES>) {
-                                       $target = $1 if (/^(\S+):/);
-                                       if (/^\s+dh_.+/ && grep ($_ eq $target, 
qw(clean binary-arch build-arch)) or
-                                                       
m#^include\s+/usr/share/cdbs/1/rules/debhelper.mk#) {
-                                               $uses_dh = "yes";
-                                               last
+                                   for my $rule (@global_depends) {
+                                       if ($_ =~ /$rule->[1]/) {
+                                           $allowed{$rule->[0]}++;
                                        }
+                                   }
+                                   $target = $1 if (/^(\S+):/);
+                                   if (grep ($_ eq $target, qw(clean 
binary-arch build-arch))) {
+                                       for my $rule (@rule_depends) {
+                                           if ($_ =~ /$rule->[1]/) {
+                                               $allowed{$rule->[0]}++;
+                                           }
+                                       }
+                                   }
                                }
                                close RULES;
                        }
-                       unless ($build_depends =~ 
/^\s*debhelper(?:\s+\((.+?)\))?(?:\s+(\[.+?\]))?\s*$/ && $uses_dh){
-                               tag "build-depends-without-arch-dep", ""
+                       $allowed{yada}++ if -e "debfiles/packages";
+                       my @packages = split /\s*,\s*/, $build_depends;
+                       foreach my $pkg (@packages) {
+                           my ($name) = ($pkg =~ /^(\S+)/);
+                           unless ($allowed{$name}) {
+                               tag "build-depends-without-arch-dep", "";
+                               last;
+                           }
                        }
                }
        }

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-01-02 09:03:23 UTC (rev 531)
+++ trunk/debian/changelog      2006-01-02 09:10:47 UTC (rev 532)
@@ -12,6 +12,9 @@
     + [FL] Allow version numbers of 0 by correctly checking the output
       of _valid_version for definedness and not the boolean value
       (Closes: #345005)
+    + [FL] Better check for false postives of build-depends-without-arch-dep.
+      Should fix false positives for cdbs, dbs, dpatch and yada. Based on
+      a patch by Russ Allbery (Closes: #344609, #321135, #339750)
   * checks/fields.desc:
     + [JvW] Fix typo in description
 

Added: trunk/testset/cdbs-test/debian/changelog
===================================================================
--- trunk/testset/cdbs-test/debian/changelog    2006-01-02 09:03:23 UTC (rev 
531)
+++ trunk/testset/cdbs-test/debian/changelog    2006-01-02 09:10:47 UTC (rev 
532)
@@ -0,0 +1,6 @@
+cdbs-test (1-1) unstable; urgency=low
+
+  * Initial release
+
+ -- Frank Lichtenheld <[EMAIL PROTECTED]>  Thu,  4 Aug 2005 23:09:00 +0200
+

Added: trunk/testset/cdbs-test/debian/compat
===================================================================
--- trunk/testset/cdbs-test/debian/compat       2006-01-02 09:03:23 UTC (rev 
531)
+++ trunk/testset/cdbs-test/debian/compat       2006-01-02 09:10:47 UTC (rev 
532)
@@ -0,0 +1 @@
+5

Added: trunk/testset/cdbs-test/debian/control
===================================================================
--- trunk/testset/cdbs-test/debian/control      2006-01-02 09:03:23 UTC (rev 
531)
+++ trunk/testset/cdbs-test/debian/control      2006-01-02 09:10:47 UTC (rev 
532)
@@ -0,0 +1,12 @@
+Source: cdbs-test
+Section: devel
+Priority: optional
+Maintainer: Frank Lichtenheld <[EMAIL PROTECTED]>
+Build-Depends: debhelper, cdbs, yada
+Standards-Version: 3.6.2
+
+Package: cdbs-test
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Checks related to the cdbs build-system
+ bla bla bla

Added: trunk/testset/cdbs-test/debian/copyright
===================================================================
--- trunk/testset/cdbs-test/debian/copyright    2006-01-02 09:03:23 UTC (rev 
531)
+++ trunk/testset/cdbs-test/debian/copyright    2006-01-02 09:10:47 UTC (rev 
532)
@@ -0,0 +1,2 @@
+This package was debianized by Frank Lichtenheld <[EMAIL PROTECTED]> on
+Thu,  4 Aug 2005 23:09:00 +0200.

Added: trunk/testset/cdbs-test/debian/packages
===================================================================

Added: trunk/testset/cdbs-test/debian/rules
===================================================================
--- trunk/testset/cdbs-test/debian/rules        2006-01-02 09:03:23 UTC (rev 
531)
+++ trunk/testset/cdbs-test/debian/rules        2006-01-02 09:10:47 UTC (rev 
532)
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+include /usr/share/cdbs/1/rules/debhelper.mk


Property changes on: trunk/testset/cdbs-test/debian/rules
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/testset/tags.cdbs-test
===================================================================
--- trunk/testset/tags.cdbs-test        2006-01-02 09:03:23 UTC (rev 531)
+++ trunk/testset/tags.cdbs-test        2006-01-02 09:10:47 UTC (rev 532)
@@ -0,0 +1,2 @@
+E: cdbs-test source: package-lacks-versioned-build-depends-on-debhelper 5
+W: cdbs-test source: native-package-with-dash-version


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to