[SCM] Debian package checker branch, master, updated. 2.0.0-rc1-14-g2d55c59
The following commit has been merged in the master branch:
commit aa2d14844c0414d6d2c9c66f887cbf5a8c45f447
Author: Frank Lichtenheld <djpig@debian.org>
Date: Sun Sep 21 15:38:35 2008 +0200
Move detection of package types from debhelper check to Lintian::Collect::Source
This can be useful for excluding udebs in other scripts, too.
diff --git a/checks/debhelper b/checks/debhelper
index 6f12883..7490825 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -27,6 +27,7 @@ sub run {
my $pkg = shift;
my $type = shift;
+my $info = shift;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Dep;
@@ -146,23 +147,8 @@ close RULES;
return unless $seencommand;
-# We may need to make a difference between deb and udeb packages
-# so try to find out
-my (%pkgs, $single_pkg);
-opendir(BINPKGS, 'control')
- or fail("Can't open control directory.");
-while(my $binpkg = readdir(BINPKGS)) {
- next if $binpkg =~ /^\.\.?$/;
- if (-d "control/$binpkg") {
- if (open TYPE, "<", "control/$binpkg/xc-package-type") {
- $pkgs{$binpkg} = <TYPE> || 'deb';
- } else {
- $pkgs{$binpkg} = 'deb';
- }
- $single_pkg = $pkgs{$binpkg};
- }
-}
-$single_pkg = undef unless keys(%pkgs) == 1;
+my $pkgs = $info->binaries;
+my $single_pkg = keys(%$pkgs) == 1 ? $pkgs->{(keys(%$pkgs))[0]} : '';
# If we got this far, they need to have #DEBHELPER# in their scripts. Search
# for scripts that look like maintainer scripts. Also collect dependency
@@ -185,8 +171,9 @@ while (defined(my $file=readdir(DEBIAN))) {
close IN;
if ((! $seentag) and $needtomodifyscripts) {
- unless (($binpkg && $pkgs{$binpkg} && ($pkgs{$binpkg} =~ /udeb/i))
- or (!$binpkg && $single_pkg && ($single_pkg =~ /udeb/i))) {
+ unless (($binpkg && exists($pkgs->{$binpkg})
+ && ($pkgs->{$binpkg} eq 'udeb'))
+ or (!$binpkg && ($single_pkg eq 'udeb'))) {
tag "maintainer-script-lacks-debhelper-token", "debian/$file";
}
}
diff --git a/debian/changelog b/debian/changelog
index c8efc7d..23aca38 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ lintian (2.0.0) unstable; urgency=low
* checks/copyright-file:
+ [FL] Also detect v1.1 of CeCILL license, not only v2.0.
(Closes: #498994)
+ * checks/debhelper:
+ + [FL] Use new Lintian::Collect::Source->binaries method.
* checks/fields{,.desc}:
+ [FL] Warn about Perl module packages superseded by Perl
core. Patch by Niko Tyni. (Closes: #498897)
@@ -16,6 +18,10 @@ lintian (2.0.0) unstable; urgency=low
* frontend/lintian:
+ [FL] Add support for ranges to --display-level.
+
+ * lib/Lintian/Collect/Source.pm:
+ + [FL] New binaries method that returns a hash with binary package
+ names and types.
-- Frank Lichtenheld <djpig@debian.org> Tue, 16 Sep 2008 19:34:29 +0200
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index 016385f..2bfdb2e 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -66,6 +66,35 @@ sub native {
return $self->{native};
}
+# List of binary packages and their type if specified
+sub binaries {
+ my ($self) = @_;
+ return $self->{binaries} if exists $self->{binaries};
+
+ my %pkgs;
+ opendir(BINPKGS, 'control')
+ or fail("Can't open control directory.");
+ while (my $binpkg = readdir(BINPKGS)) {
+ next if $binpkg =~ /^\.\.?$/;
+ if (-d "control/$binpkg") {
+ if (open TYPE, "<", "control/$binpkg/xc-package-type") {
+ my $type = <TYPE> || '';
+ chomp $type;
+ $type = lc $type;
+ $pkgs{$binpkg} = $type || 'deb';
+ close TYPE;
+ } else {
+ $pkgs{$binpkg} = 'deb';
+ }
+ }
+ }
+ closedir BINPKGS;
+
+ $self->{binaries} = \%pkgs;
+
+ return $self->{binaries};
+}
+
=head1 NAME
Lintian::Collect::Source - Lintian interface to source package data collection
@@ -118,6 +147,11 @@ file, which this method expects to find in F<debfiles/changelog>.
Returns true if the source package is native and false otherwise.
+=item binaries()
+
+Returns a hash reference with the binary package names as keys and the
+Package-Type as value (which should be either 'deb' or 'udeb' currently).
+
=back
=head1 AUTHOR
--
Debian package checker
Reply to: