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

[SCM] Debian package checker branch, master, updated. 2.5.1-67-g16de68c



The following commit has been merged in the master branch:
commit 16de68c0b7946b6be0cd2857c8cf2632eb0dbfdc
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Jul 10 23:51:17 2011 +0200

    Added and migrated to $info->control
    
    Also added missing bin-pkg-control to Needs-Info of conffiles.desc
    and debconf.desc.

diff --git a/checks/conffiles b/checks/conffiles
index b9385f6..9a1cd12 100644
--- a/checks/conffiles
+++ b/checks/conffiles
@@ -29,8 +29,9 @@ sub run {
 
 my $pkg = shift;
 my $type = shift;
+my $info = shift;
 
-my $cf = 'control/conffiles';
+my $cf = $info->control('conffiles');
 
 # conffiles?
 unless (-f $cf) {
diff --git a/checks/conffiles.desc b/checks/conffiles.desc
index b6ce48b..badc6b1 100644
--- a/checks/conffiles.desc
+++ b/checks/conffiles.desc
@@ -2,6 +2,7 @@ Check-Script: conffiles
 Author: Christian Schwarz <schwarz@debian.org>
 Abbrev: cnf
 Type: binary
+Needs-Info: bin-pkg-control
 Info: This script checks if the conffiles control file of a binary
  package is correct.
 
diff --git a/checks/debconf b/checks/debconf
index 0865f24..4b752a6 100644
--- a/checks/debconf
+++ b/checks/debconf
@@ -100,7 +100,9 @@ if ($type eq 'source') {
     return 0;
 }
 
-if (open(PREINST, '<', 'control/preinst')) {
+my $cdir = $info->control;
+
+if (open(PREINST, '<', "$cdir/preinst")) {
     while (<PREINST>) {
 	s/\#.*//;    # Not perfect for Perl, but should be OK
 	if (m,/usr/share/debconf/confmodule, or
@@ -112,12 +114,8 @@ if (open(PREINST, '<', 'control/preinst')) {
     close PREINST;
 }
 
-if (-f 'control/config') {
-    $seenconfig=1;
-}
-if (-f 'control/templates') {
-    $seentemplates=1;
-}
+$seenconfig=1 if -f "$cdir/config";
+$seentemplates=1 if -f "$cdir/templates";
 
 # This still misses packages that use debconf only in the postrm.  Packages
 # that ask debconf questions in the postrm should load the confmodule in the
@@ -161,13 +159,13 @@ if ($seenconfig and not $seentemplates and not $usesdbconfig) {
     tag 'no-debconf-config';
 }
 
-if ($seenconfig and not -x 'control/config') {
+if ($seenconfig and not -x "$cdir/config") {
     tag 'debconf-config-not-executable';
 }
 
 # First check that templates look valid
 if ($seentemplates) {
-    open(TMPL, '<', 'control/templates')
+    open(TMPL, '<', "$cdir/templates")
         or fail("Can't open control/templates: $!");
     local $/ = "\n\n";
     while (<TMPL>) {
@@ -197,7 +195,7 @@ if ($seentemplates) {
 
 # Lots of template checks.
 
-my @templates = $seentemplates ? read_dpkg_control('control/templates', 'templates file') : ();
+my @templates = $seentemplates ? read_dpkg_control("$cdir/templates", 'templates file') : ();
 my %potential_db_abuse;
 my @templates_seen;
 
@@ -363,7 +361,7 @@ my %templates_used;
 my %template_aliases;
 for my $file (qw(config prerm postrm preinst postinst)) {
     my $potential_makedev = {};
-    if (open(IN, '<', "control/$file")) {
+    if (open(IN, '<', "$cdir/$file")) {
 	my $usesconfmodule='';
 	my $obsoleteconfmodule='';
 	my $db_input='';
diff --git a/checks/debconf.desc b/checks/debconf.desc
index a9e095e..9eda42e 100644
--- a/checks/debconf.desc
+++ b/checks/debconf.desc
@@ -3,7 +3,7 @@ Author: Colin Watson <cjwatson@debian.org>
 Abbrev: dc
 Type: binary, udeb, source
 Info: This looks for common mistakes in packages using debconf.
-Needs-Info: debfiles, unpacked, scripts, fields
+Needs-Info: bin-pkg-control, debfiles, unpacked, scripts, fields
 
 Tag: missing-debconf-dependency
 Severity: normal
diff --git a/checks/etcfiles b/checks/etcfiles
index 6339d51..77058b7 100644
--- a/checks/etcfiles
+++ b/checks/etcfiles
@@ -33,7 +33,7 @@ my $info = shift;
 
 my %conffiles;
 
-my $conffiles = 'control/conffiles';
+my $conffiles = $info->control('conffiles');
 
 # load conffiles
 if (open(IN, '<', $conffiles)) {
diff --git a/checks/init.d b/checks/init.d
index 9c7fdd2..58236d2 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -60,12 +60,13 @@ sub run {
 
 my $pkg = shift;
 my $type = shift;
+my $info = shift;
 
-my $postinst = "control/postinst";
-my $preinst = "control/preinst";
-my $postrm = "control/postrm";
-my $prerm = "control/prerm";
-my $conffiles = "control/conffiles";
+my $postinst = $info->control('postinst');
+my $preinst = $info->control('preinst');
+my $postrm = $info->control('postrm');
+my $prerm = $info->control('prerm');
+my $conffiles = $info->control('conffiles');
 
 my %initd_postinst;
 my %initd_postrm;
diff --git a/checks/md5sums b/checks/md5sums
index e1550c1..fc87b7b 100644
--- a/checks/md5sums
+++ b/checks/md5sums
@@ -31,15 +31,15 @@ my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
-my $control = 'control/md5sums';
+my $control = $info->control('md5sums');
 
 my %control_entry;
 my %info_entry;
 my %conffile;
 
 # read in conffiles
-if (-f 'control/conffiles') {
-    open(C, '<', 'control/conffiles')
+if (-f $info->control('conffiles')) {
+    open(C, '<', $info->control('conffiles'))
 	or fail("cannot open control file conffiles: $!");
     while (<C>) {
 	chop;
diff --git a/checks/menus b/checks/menus
index 93779b5..117e721 100644
--- a/checks/menus
+++ b/checks/menus
@@ -75,17 +75,17 @@ my $menumethod_file;
 my $anymenu_file;
 my $documentation;
 
-if (-f 'control/preinst') {
-    check_script($pkg, 'preinst', \%preinst);
+if (-f $info->control('preinst')) {
+    check_script($pkg, $info->control('preinst'), 'preinst', \%preinst);
 }
-if (-f 'control/postinst') {
-    check_script($pkg, 'postinst', \%postinst);
+if (-f $info->control('postinst')) {
+    check_script($pkg, $info->control('postinst'), 'postinst', \%postinst);
 }
-if (-f 'control/prerm') {
-    check_script($pkg, 'prerm', \%prerm);
+if (-f $info->control('prerm')) {
+    check_script($pkg, $info->control('prerm'), 'prerm', \%prerm);
 }
-if (-f 'control/postrm') {
-    check_script($pkg, 'postrm', \%postrm);
+if (-f $info->control('postrm')) {
+    check_script($pkg, $info->control('postrm'), 'postrm', \%postrm);
 }
 
 # read package contents
@@ -585,11 +585,11 @@ sub delink {
 }
 
 sub check_script {
-    my ($pkg, $script, $pres) = @_;
+    my ($pkg, $spath, $script, $pres) = @_;
     my ($no_check_menu,$no_check_installdocs,$no_check_wmmenu,$calls_wmmenu);
     my $interp;
 
-    open(IN, '<', "control/$script") or
+    open(IN, '<', $spath) or
 	fail("cannot open maintainer script control/$script for reading: $!");
     $interp = <IN>;
     $interp = '' unless defined $interp;
diff --git a/checks/scripts b/checks/scripts
index 46e0954..c3d1bf4 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -566,25 +566,25 @@ while (<SCRIPTS>) {
     m/^(\S*) (.*)$/ or fail("bad line in control-scripts file: $_");
     my $interpreter = $1;
     my $file = $2;
-    my $filename = "control/$file";
+    my $filename = $info->control($file);
 
     $interpreter =~ m|([^/]*)$|;
     my $base = $1;
 
-    if ($interpreter eq "") {
-	tag("script-without-interpreter", $filename);
+    if ($interpreter eq '') {
+	tag("script-without-interpreter", "control/$file");
 	next;
     }
 
-    tag("interpreter-not-absolute", $filename, "#!$interpreter")
+    tag("interpreter-not-absolute", "control/$file", "#!$interpreter")
 	unless ($interpreter =~ m|^/|);
 
     if ($interpreter =~ m|/usr/local/|) {
-	tag("control-interpreter-in-usr-local", $filename, "#!$interpreter");
+	tag("control-interpreter-in-usr-local", "control/$file", "#!$interpreter");
     } elsif ($base eq 'sh' or $base eq 'bash' or $base eq 'perl') {
 	my $expected = $interpreters{$base}->[0] . '/' . $base;
 	tag("wrong-path-for-interpreter", "#!$interpreter != $expected",
-	    "($filename)")
+	    "(control/$file)")
 	    unless ($interpreter eq $expected);
     } elsif ($file eq 'config') {
 	tag('forbidden-config-interpreter', "#!$interpreter");
@@ -595,9 +595,9 @@ while (<SCRIPTS>) {
 	my $expected = $data->[0] . '/' . $base;
 	unless ($interpreter eq $expected) {
 	    tag("wrong-path-for-interpreter", "#!$interpreter != $expected",
-		"($filename)")
+		"(control/$file)")
 	}
-	tag('unusual-control-interpreter', $filename, "#!$interpreter");
+	tag('unusual-control-interpreter', "control/$file", "#!$interpreter");
 
 	# Interpreters used by preinst scripts must be in Pre-Depends.
 	# Interpreters used by postinst or prerm scripts must be in Depends.
@@ -610,19 +610,19 @@ while (<SCRIPTS>) {
 		}
 	    } else {
 		unless ($info->relation('strong')->implies($depends)) {
-		    tag('control-interpreter-without-depends', $filename,
+		    tag('control-interpreter-without-depends', "control/$file",
 			"#!$interpreter")
 		}
 	    }
 	}
     } else {
-	tag("unknown-control-interpreter", $filename, "#!$interpreter");
+	tag("unknown-control-interpreter", "control/$file", "#!$interpreter");
 	next; # no use doing further checks if it's not a known interpreter
     }
 
     # perhaps we should warn about *csh even if they're somehow screwed,
     # but that's not really important...
-    tag("csh-considered-harmful", $filename)
+    tag("csh-considered-harmful", "control/$file")
 	if ($base eq 'csh' or $base eq 'tcsh');
 
     my $shellscript = $base =~ /^$known_shells_regex$/ ? 1 : 0;
diff --git a/checks/shared-libs b/checks/shared-libs
index 63914e7..a786a25 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -260,6 +260,8 @@ if (defined $info->field('provides')) {
 }
 $provides = Lintian::Relation->new($provides);
 
+my $shlibsf = $info->control('shlibs');
+my $symbolsf = $info->control('symbols');
 my %shlibs_control;
 my %symbols_control;
 
@@ -281,12 +283,12 @@ for (keys %SONAME) {
 if ($#shlibs == -1) {
     # no shared libraries included in package, thus shlibs control file should
     # not be present
-    if (-f 'control/shlibs') {
+    if (-f $shlibsf) {
 	tag 'pkg-has-shlibs-control-file-but-no-actual-shared-libs';
     }
 } else {
     # shared libraries included, thus shlibs control file has to exist
-    if (not -f 'control/shlibs') {
+    if (not -f $shlibsf) {
 	if ($type ne 'udeb') {
 	    for my $shlib (@shlibs) {
 		# skip it if it's not a public shared library
@@ -297,7 +299,7 @@ if ($#shlibs == -1) {
     } else {
 	my %shlibs_control_used;
 	my @shlibs_depends;
-	open(SHLIBS, '<', 'control/shlibs')
+	open(SHLIBS, '<', $shlibsf)
 	    or fail("cannot open control/shlibs for reading: $!");
 	while (<SHLIBS>) {
 	    chop;
@@ -359,10 +361,10 @@ if ($#shlibs == -1) {
 if ($#shlibs == -1 and not %unversioned_shlibs) {
     # no shared libraries included in package, thus symbols control file should
     # not be present
-    if (-f 'control/symbols') {
+    if (-f $symbolsf) {
         tag 'pkg-has-symbols-control-file-but-no-shared-libs';
     }
-} elsif (not -f 'control/symbols') {
+} elsif (not -f $symbolsf) {
     if ($type ne 'udeb') {
 	for my $shlib (@shlibs, keys %unversioned_shlibs) {
 	    # skip it if it's not a public shared library
@@ -370,7 +372,7 @@ if ($#shlibs == -1 and not %unversioned_shlibs) {
 	    tag 'no-symbols-control-file', $shlib;
 	}
     }
-} elsif (open(IN, '<', 'control/symbols')) {
+} elsif (open(IN, '<', $symbolsf)) {
     my $version_wo_rev = $version;
     $version_wo_rev =~ s/^(.+)-([^-]+)$/$1/;
     my ($full_version_count, $full_version_sym) = (0, undef);
@@ -548,16 +550,16 @@ if (keys %shlibs_control and keys %symbols_control) {
 }
 
 # 6th step: check pre- and post- control files
-if (-f 'control/preinst') {
-    local $_ = slurp_entire_file('control/preinst');
+if (-f $info->control('preinst')) {
+    local $_ = slurp_entire_file($info->control('preinst'));
     if (/^[^\#]*\bldconfig\b/m) {
 	tag 'preinst-calls-ldconfig';
     }
 }
 
 my $we_call_postinst=0;
-if (-f 'control/postinst') {
-    local $_ = slurp_entire_file('control/postinst');
+if (-f $info->control('postinst')) {
+    local $_ = slurp_entire_file($info->control('postinst'));
 
     # Decide if we call ldconfig
     if (/^[^\#]*\bldconfig\b/m) {
@@ -575,15 +577,15 @@ if ($type eq 'udeb') {
 	if not $we_call_postinst and $must_call_ldconfig;
 }
 
-if (-f 'control/prerm') {
-    local $_ = slurp_entire_file('control/prerm');
+if (-f $info->control('prerm')) {
+    local $_ = slurp_entire_file($info->control('prerm'));
     if (/^[^\#]*\bldconfig\b/m) {
 	tag 'prerm-calls-ldconfig';
     }
 }
 
-if (-f 'control/postrm') {
-    local $_ = slurp_entire_file('control/postrm');
+if (-f $info->control('postrm')) {
+    local $_ = slurp_entire_file($info->control('postrm'));
 
     # Decide if we call ldconfig
     if (/^[^\#]*\bldconfig\b/m) {
diff --git a/debian/changelog b/debian/changelog
index 966dbc6..f02ca17 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ lintian (2.5.2) UNRELEASED; urgency=low
   * checks/*:
     + [NT] Migrated to use new methods in the Lintian::Collect
       interfaces rather than accessing the Lab directly.
+  * checks/{debconf,conffiles}.desc:
+    + [NT] Added missing bin-pkg-control Needs-Info.
   * checks/{cruft,fields}{,.desc}:
     + [NT] Relocated doc pkg not arch all tag; it was never
       triggered since cruft was a source check and the tag
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 019e9cd..1065abb 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -65,6 +65,15 @@ sub changelog {
     return $self->{changelog};
 }
 
+# Like unpacked except this returns the contents of the control.tar.gz
+# in an unpacked directory.
+#
+# sub control Needs-Info bin-pkg-control
+sub control {
+    my ($self, $file) = @_;
+    return $self->_fetch_extracted_dir('control', 'control', $file);
+}
+
 # Returns sorted file info (eqv to sort keys %{$info->file_info'}), except it is cached.
 #  sub sorted_file_info Needs-Info file-info
 sub sorted_file_info{
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index 93ea78d..3f11303 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -214,7 +214,7 @@ sub relation_noarch {
     return $self->{relation_noarch}->{$field};
 }
 
-# Like unpacked except this only contains the contents of debian/ from a source
+# Like unpacked except this only returns the contents of debian/ from a source
 # package.
 #
 # sub debfiles Needs-Info debfiles

-- 
Debian package checker


Reply to: