Package: lintian Version: 1.23.14 Severity: normal Tags: patch While sponsoring a package (cdrbq), I noticed that lintian complaints about build-depends-without-arch-dep for Build-Depends: dpatch. However, if one uses the makefile include method for integrating dpatch, dpatch does have to be installed to run make clean and therefore should be in Build-Depends. Similar problems exist for cdbs and dbs.
While I was fixing this, I noticed that the regex in the existing check is insufficiently conservative and: Build-Depends: debhelper (>= 4.0.0), python-dev (>> 2.3) will be judged as fine because \(.+?\) will pick up everything to the end of the line. +? just stops matching at the earliest point it *can* and not change the success of the overall match; if it has to match farther in order to make the whole expression match, it will. This patch pulls the database of things to look for out into a global variable, makes the check easier to extend down the road, and also adds a special case for yada packages (allowing yada in Build-Depends if the debian/packages file exists). Applying this patch will therefore also close #321135. I considered also ensuring that the packages discovered were listed in Build-Depends, but I think that's too likely to turn up false positives (if, for instance, someone did something sneaky and made the inclusion of the dpatch makefile fragment conditional). But it wouldn't be too hard to add if it turns out to be a good idea. -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.12-1-686 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Versions of packages lintian depends on: ii binutils 2.16.1cvs20051214-1 The GNU assembler, linker and bina ii diffstat 1.41-1 produces graph of changes introduc ii dpkg-dev 1.13.11 package building tools for Debian ii file 4.15-2 Determines file type using "magic" ii gettext 0.14.5-2 GNU Internationalization utilities ii intltool-debian 0.34.1+20050828 Help i18n of RFC822 compliant conf ii libparse-debianchang 1.0-1 parse Debian changelogs and output ii man-db 2.4.3-3 The on-line manual pager ii perl [libdigest-md5- 5.8.7-10 Larry Wall's Practical Extraction lintian recommends no packages. -- no debconf information
diff -ru lintian-1.23.14/checks/fields lintian-new/checks/fields --- lintian-1.23.14/checks/fields 2005-08-12 16:44:18.000000000 -0700 +++ lintian-new/checks/fields 2005-12-23 17:23:11.000000000 -0800 @@ -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,23 +425,34 @@ 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 while (<RULES>) { + for my $rule (@global_depends) { + if ($_ =~ /$rule->[1]/) { + push (@allowed, $rule->[0]); + } + } $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 + if (grep ($_ eq $target, qw(clean binary-arch build-arch))) { + for my $rule (@rule_depends) { + if ($_ =~ /$rule->[1]/) { + push (@allowed, $rule->[0]); + } + } } } close RULES; } - unless ($build_depends =~ /^\s*debhelper(?:\s+\((.+?)\))?(?:\s+(\[.+?\]))?\s*$/ && $uses_dh){ + my $packages = join ('|', @allowed); + if (-e "debfiles/packages") { + $packages .= '|yada'; + } + unless ($build_depends =~ /^(?:\s*(?:$packages)(?:\s+\(([^\)]+?)\))?(?:\s+(\[[^\]]+?\]))?\s*,?)*$/) { tag "build-depends-without-arch-dep", "" } }