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

Bug#626476: lintian: reduce dpkg-dev to Suggests



Package: lintian
Version: 2.5.0~rc3
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

We're shipping lintian on Ubuntu CD images as a Recommends of aptdaemon,
in order to do some basic sanity checks on third-party binary packages.
Unfortunately this pulls in dpkg-dev and its dependencies, which are
rather heavyweight.  Some analysis shows that the only thing that we
need dpkg-dev for is to unpack source packages, so it's possible to
check binary packages without dpkg-dev.

The attached patch checks whether dpkg-source is available and produces
a better error message; it then drops dpkg-dev to a Suggests so that we
don't have to ship it.  I don't think this should particularly
negatively affect anyone - if you're building packages, you have
dpkg-dev installed anyway, and probably not solely by means of
installing lintian - but I thought I'd file a bug about it rather than
just committing it so that we could discuss it in case anyone had any
objections.

diff --git a/collection/unpacked b/collection/unpacked
index 1cceb5a..7688711 100755
--- a/collection/unpacked
+++ b/collection/unpacked
@@ -24,7 +24,7 @@ use strict;
 use warnings;
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Command qw(spawn);
+use Lintian::Command qw(spawn on_path);
 use Util;
 
 ($#ARGV == 1) or fail('syntax: unpacked <package> <type>');
@@ -46,6 +46,10 @@ if ($type =~ m/^remove-/) {
 }
 
 if ($type eq 'source') {
+    unless (on_path('dpkg-source')) {
+	fail('dpkg-source missing - is the dpkg-dev package installed?');
+    }
+
     # Ignore STDOUT of the child process because older versions of
     # dpkg-source print things out even with -q.
     my $opts = { out => '/dev/null', err => 'unpacked-errors' };
diff --git a/debian/control b/debian/control
index 93e75bf..70cd345 100644
--- a/debian/control
+++ b/debian/control
@@ -55,7 +55,6 @@ Package: lintian
 Architecture: all
 Depends: binutils,
          diffstat,
-         dpkg-dev,
          file,
          gettext,
          intltool-debian,
@@ -73,6 +72,7 @@ Depends: binutils,
          unzip,
          ${misc:Depends}
 Suggests: binutils-multiarch,
+          dpkg-dev,
           libhtml-parser-perl,
           libtext-template-perl,
           man-db (>= 2.5.1-1)
diff --git a/lib/Lintian/Command.pm b/lib/Lintian/Command.pm
index 5317a9b..2994cc0 100644
--- a/lib/Lintian/Command.pm
+++ b/lib/Lintian/Command.pm
@@ -27,7 +27,7 @@ BEGIN {
 
 use base qw(Exporter);
 our @EXPORT = ();
-our @EXPORT_OK = qw(spawn reap kill);
+our @EXPORT_OK = qw(spawn reap kill on_path);
 
 use IPC::Run qw(run harness kill_kill);
 
@@ -333,13 +333,30 @@ sub done {
     }
 }
 
+=head2 C<on_path($command)>
+
+Return true if and only if $command is on the executable search path.
+
+=cut
+
+sub on_path {
+    my $command = shift;
+
+    return 0 unless exists $ENV{PATH};
+    for my $element (split ':', $ENV{PATH}) {
+	next unless length $element;
+	return 1 if -f "$element/$command" and -x _;
+    }
+    return 0;
+}
+
 1;
 __END__
 
 =head1 EXPORTS
 
 Lintian::Command exports nothing by default, but you can export the
-spawn() and reap() functions.
+spawn(), reap(), kill(), and on_path() functions.
 
 =head1 AUTHOR
 

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



Reply to: