[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#613327: lintian: check for missing build deps based on 'dh --with' calls



block 613327 with 644021
tags 613327 + patch
thanks

* Raphael Geissert <geissert@debian.org>, 2011-02-13, 22:07:
Just to keep track of it, just like we build a list of dh_* commands and look for them in rules files, we should build a list of packages shipping usr/share/perl5/Debian/Debhelper/Sequence/*.pm files and packages using dh --with foo.

Patch attached.

--
Jakub Wilk
diff --git a/checks/debhelper b/checks/debhelper
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -41,6 +41,8 @@
 my $dh_commands_depends = Lintian::Data->new ('debhelper/dh_commands', '=');
 my $filename_configs = Lintian::Data->new ('debhelper/filename-config-files');
 my $dh_ver_deps = Lintian::Data->new ('debhelper/dh_commands-manual', qr/\|\|/o);
+my $dh_addons = Lintian::Data->new ('debhelper/dh_addons', '=');
+my $dh_addons_manual = Lintian::Data->new ('debhelper/dh_addons-manual', qr/\|\|/o);
 
 # The version at which debhelper commands were introduced.  Packages that use
 # one of these commands must have a dependency on that version of debhelper or
@@ -69,6 +71,7 @@
 my $seendhcleank = '';
 my $overridetargets = 0;
 my %missingbdeps;
+my %missingbdeps_addons;
 
 my $maybe_skipping;
 my $dhcompatvalue;
@@ -153,6 +156,17 @@
         $seencommand = 1;
         $needbuilddepends = 1;
         $needtomodifyscripts = 1;
+        while (m/\s--with(?:=|\s+)(\S+)/go) {
+            for my $addon (split(',', $1)) {
+                $addon =~ y,-,_,;
+                my $depends =
+                    $dh_addons_manual->value($addon) ||
+                    $dh_addons->value($addon);
+                if (defined $depends) {
+                    $missingbdeps_addons{$depends} = $addon;
+                }
+            }
+        }
     } elsif (m,^include\s+/usr/share/cdbs/1/rules/debhelper.mk,) {
         $seencommand = 1;
         $needbuilddepends = 1;
@@ -333,6 +347,10 @@
     tag 'missing-build-dependency-for-dh_-command', "$command=$dep"
         unless ($bdepends_noarch->implies($dep));
 }
+while (my ($dep, $addon) = each %missingbdeps_addons) {
+    tag 'missing-build-dependency-for-dh-addon', "$addon => $dep"
+        unless ($bdepends_noarch->implies($dep));
+}
 
 
 unless ($bdepends->implies("debhelper (>= $level~)")){
diff --git a/checks/debhelper.desc b/checks/debhelper.desc
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -190,6 +190,13 @@
  depend on the package that actually provides it.  If it uses it, it must
  build depend on it.
 
+Tag: missing-build-dependency-for-dh-addon
+Severity: important
+Certainty: possible
+Info: The source package appears to be using a dh addon but doesn't build
+ depend on the package that actually provides it.  If it uses it, it must
+ build depend on it.
+
 Tag: debhelper-script-needs-versioned-build-depends
 Severity: normal
 Certainty: certain
diff --git a/data/debhelper/dh_addons b/data/debhelper/dh_addons
new file mode 100644
--- /dev/null
+++ b/data/debhelper/dh_addons
@@ -0,0 +1,40 @@
+autoreconf=dh-autoreconf
+autotools_dev=autotools-dev
+bash_completion=bash-completion
+cli=cli-common-dev
+cli_nant=cli-common-dev
+components=pkg-components
+config_model=libconfig-model-perl
+d_i=dh-di
+dkms=dkms
+dpatch=dpatch
+eclipse_helper=javahelper
+germinate=germinate
+gnome=gnome-pkg-tools
+javahelper=javahelper
+jh_maven_repo_helper=maven-repo-helper
+kde=pkg-kde-tools
+lisp=dh-lisp
+lv2config=lv2core
+maven_repo_helper=maven-repo-helper
+ocaml=dh-ocaml
+perl_dbi=libdbi-perl
+phppear=pkg-php-tools
+pkgkde_symbolshelper=pkg-kde-tools
+pydeb=python-van.pydeb
+pyppd=pyppd
+python2=python
+python3=python3
+python_central=python-central
+python_support=debhelper
+quilt=quilt
+rdoc=ruby-pkg-tools
+ruby=gem2deb
+scour=python-scour
+sodeps=pkg-kde-tools
+sphinxdoc=python-sphinx
+tex=tex-common
+xine=libxine-dev
+xsf=xserver-xorg-dev
+xul_ext=mozilla-devscripts
+xulrunner=xulrunner-dev
diff --git a/data/debhelper/dh_addons-manual b/data/debhelper/dh_addons-manual
new file mode 100644
--- /dev/null
+++ b/data/debhelper/dh_addons-manual
@@ -0,0 +1,16 @@
+# Manually maintained list of dependencies needed for dh addons. This overrides
+# information from data/debhelper/dh_addons (the latter file is automatically
+# generated).
+#
+# Please keep this sorted.
+
+dpatch||dpatch (>= 2.0.32~)
+gnome||gnome-pkg-tools (>= 0.17)
+jh_maven_repo_helper||maven-repo-helper (>= 1.6~)
+lv2config||lv2core (>= 4.0-2~)
+maven_repo_helper||maven-repo-helper (>= 1.5~)
+python2||python | python-all | python-dev | python-add-dev
+python3||python3 | python3-all | python3-dev | python3-all-dev
+python_support||python-support
+sphinxdoc||python-sphinx (>= 1.0.7+dfsg)
+xsf||xserver-xorg-dev (>= 2:1.9.4)
diff --git a/private/refresh-debhelper-data b/private/refresh-debhelper-data
--- a/private/refresh-debhelper-data
+++ b/private/refresh-debhelper-data
@@ -45,8 +45,9 @@
 
 readonly lintian_data="$(readlink -f "$1")"
 readonly contents="$(readlink -f "$2")"
-readonly dh_regex='^usr/bin/dh_.'
-readonly dh_perl_regex='^usr/bin/(dh_[^\s]+)\s+[\w-]+/([^,]+).*'
+readonly dh_regex='^(usr/bin/dh_|usr/share/perl5/Debian/Debhelper/Sequence/).'
+readonly dh_command_perl_regex='^usr/bin/(dh_[^\s]+)\s+[\w-]+/([^,]+).*'
+readonly dh_addon_perl_regex='^usr/share/perl5/Debian/Debhelper/Sequence/([^\s]+)\.pm\s+[\w-]+/([^,]+).*'
 offline=0
 
 [ -d "$lintian_data" ] || {
@@ -86,7 +87,7 @@
     which "$command" 2>&1 1>/dev/null || exit 2
 
     $command -E "$dh_regex" "$contents" \
-        | perl -p -w -E 's#'"$dh_perl_regex"'#$1=$2#g;' \
+        | perl -p -w -E 's#'"$dh_command_perl_regex"'#$1=$2#g;' \
         | sort > "$new_commands"
     cmp -s "$known_commands" "$new_commands"
     exit
@@ -103,13 +104,16 @@
     wget dists/sid/Contents-i386.gz
     zgrep -E "$dh_regex" Contents-i386.gz > dh_entries
     cat dh_entries \
-        | perl -p -w -E 's#'"$dh_perl_regex"'#$1=$2#g;' \
+        | perl -n -w -E 's#'"$dh_command_perl_regex"'#$1=$2# and print' \
         | LC_ALL=C sort > dh_commands
     cat dh_entries \
-        | perl -p -w -E 's#'"$dh_perl_regex"'#$2#g;' \
+        | perl -n -w -E 's#'"$dh_addon_perl_regex"'#$1=$2# and print' \
+        | LC_ALL=C sort > dh_addons
+    cat dh_commands \
+        | cut -d '=' -f 2 \
         | LC_ALL=C sort -u > dh_packages
 
-    for f in commands packages; do
+    for f in commands addons packages; do
         rf="$lintian_data/debhelper/dh_$f"
         [ ! -f "$rf" ] ||
             mv "$rf" "${rf}.old"

Reply to: