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

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7



The following commit has been merged in the master branch:
commit 218e2645bd4d4f8f5ee3480a905a794eda85cb9f
Author: Russ Allbery <rra@debian.org>
Date:   Tue Dec 30 13:11:42 2008 -0800

    Move static data out of the run functions
    
    Static data doesn't need to be initialized each time a check is run.
    Move those variables outside the run function and remove some variables
    in checks/shared-libs that just hold names of files in the Lintian lab
    that aren't going to change.

diff --git a/checks/control-files b/checks/control-files
index d12ce36..85d433d 100644
--- a/checks/control-files
+++ b/checks/control-files
@@ -23,40 +23,36 @@ use strict;
 use Tags;
 use Util;
 
+my %ctrl_deb =
+    (clilibs   => 0644,
+     config    => 0755,
+     control   => 0644,
+     conffiles => 0644,
+     md5sums   => 0644,
+     postinst  => 0755,
+     preinst   => 0755,
+     postrm    => 0755,
+     prerm     => 0755,
+     shlibs    => 0644,
+     symbols   => 0644,
+     templates => 0644,
+     triggers  => 0644);
+
+my %ctrl_udeb =
+    (config        => 0755,
+     control       => 0644,
+     isinstallable => 0755,
+     menutest      => 0755,
+     postinst      => 0755,
+     shlibs        => 0644,
+     symbols       => 0644,
+     templates     => 0644);
+
 sub run {
 
 my $pkg = shift;
 my $type = shift;
 
-my %ctrl_deb =
-    (
-     'clilibs', 0644,
-     'config', 0755,
-     'control', 0644,
-     'conffiles', 0644,
-     'md5sums', 0644,
-     'postinst', 0755,
-     'preinst', 0755,
-     'postrm', 0755,
-     'prerm', 0755,
-     'shlibs', 0644,
-     'symbols', 0644,
-     'templates', 0644,
-     'triggers', 0644,
-    );
-
-my %ctrl_udeb =
-    (
-     'config', 0755,
-     'control', 0644,
-     'isinstallable', 0755,
-     'menutest', 0755,
-     'postinst', 0755,
-     'shlibs', 0644,
-     'symbols', 0644,
-     'templates', 0644,
-    );
-
 my %ctrl = $type eq 'udeb' ? %ctrl_udeb : %ctrl_deb;
 my %ctrl_alt = $type eq 'udeb' ? %ctrl_deb : %ctrl_udeb;
 
diff --git a/checks/debconf b/checks/debconf
index cfab7b7..6a12574 100644
--- a/checks/debconf
+++ b/checks/debconf
@@ -25,37 +25,28 @@ use Tags;
 use Dep;
 use Util;
 
-sub run {
-
-my $pkg = shift;
-my $type = shift;
-my $info = shift;
-
 # From debconf-devel(7), section 'THE TEMPLATES FILE', up to date with debconf
-# version 1.3.22.  Added indices for cdebconf (indicates sort order for
+# version 1.5.24.  Added indices for cdebconf (indicates sort order for
 # choices); debconf doesn't support it, but it ignores it, which is safe
 # behavior.
-my %template_fields;
-map { $template_fields{$_}=1 }
+my %template_fields = map { $_ => 1 }
     qw(template type choices indices default description);
 
 # From debconf-devel(7), section 'THE TEMPLATES FILE', up to date with debconf
-# version 1.3.22
-my %valid_types;
-map { $valid_types{$_}=1 } qw(
-	string
-	password
-	boolean
-	select
-	multiselect
-	note
-	text
-	title
-	error
-	);
+# version 1.5.24.
+my %valid_types = map { $_ => 1 }
+    qw(string
+       password
+       boolean
+       select
+       multiselect
+       note
+       error
+       title
+       text);
 
 # From debconf-devel(7), section 'THE DEBCONF PROTOCOL' under 'INPUT', up to
-# date with debconf version 1.5.3.
+# date with debconf version 1.5.24.
 my %valid_priorities = map { $_ => 1 }
     qw(low medium high critical);
 
@@ -64,6 +55,12 @@ my %valid_priorities = map { $_ => 1 }
 my @debconfs = qw(debconf debconf-2.0 cdebconf cdebconf-udeb libdebconfclient0
                   libdebconfclient0-udeb);
 
+sub run {
+
+my $pkg = shift;
+my $type = shift;
+my $info = shift;
+
 my $seenconfig='';
 my $seentemplates='';
 my $usespreinst='';
@@ -103,7 +100,7 @@ if ($type eq 'source') {
 
 if (open(PREINST, '<', "control/preinst")) {
     while (<PREINST>) {
-	s/#.*//;    # Not perfect for Perl, but should be OK
+	s/\#.*//;    # Not perfect for Perl, but should be OK
 	if (m,/usr/share/debconf/confmodule, or
 	        m/(?:Debconf|Debian::DebConf)::Client::ConfModule/) {
 	    $usespreinst=1;
diff --git a/checks/huge-usr-share b/checks/huge-usr-share
index 9f48baf..b318a7e 100644
--- a/checks/huge-usr-share
+++ b/checks/huge-usr-share
@@ -22,18 +22,18 @@ package Lintian::huge_usr_share;
 use strict;
 use Tags;
 
+# Threshold in kB of /usr/share to trigger this warning.  Consider that the
+# changelog alone can be quite big, and cannot be moved away.
+my $THRESHOLD_SIZE_SOFT = 1024;
+my $THRESHOLD_SIZE_HARD = 2048;
+my $THRESHOLD_PERC = 50;
+
 sub run {
 
 my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
-# Threshold in kB of /usr/share to trigger this warning
-# Consider that the changelog alone can be quite big, and cannot be moved away
-my $THRESHOLD_SIZE_SOFT = 1024;
-my $THRESHOLD_SIZE_HARD = 2048;
-my $THRESHOLD_PERC = 50;
-
 my $arch;
 
 # read architecture
diff --git a/checks/shared-libs b/checks/shared-libs
index 4e2b3ae..b710a62 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -28,36 +28,32 @@ use Dep;
 use Tags;
 use Util;
 
-sub run {
-
 # Libraries that should only be used in the presence of certain capabilities
 # may be located in subdirectories of the standard ldconfig search path with
 # one of the following names.
 my %hwcap_dir = map { $_ => 1 }
-    qw( i486 i586 i686 cmov tls );
+    qw(i486 i586 i686 cmov tls);
 
 # The following architectures should always have a STACK setting in shared
 # libraries to disable executable stack.  Other architectures don't always add
 # this section and therefore can't be checked.
-my %stack_arches = map { $_ => 1 }
-    qw( alpha
-	amd64
-	i386
-	m68k
-	powerpc
-	s390
-	sparc
+our %stack_arches = map { $_ => 1 }
+    qw(
+       alpha
+       amd64
+       i386
+       m68k
+       powerpc
+       s390
+       sparc
       );
 
-my $ldconfig_dirs = Lintian::Data->new('shared-libs/ldconfig-dirs');
+our $ldconfig_dirs = Lintian::Data->new('shared-libs/ldconfig-dirs');
+
+sub run {
+
 my $file;
 my $must_call_ldconfig;
-my $postrm = "control/postrm";
-my $postinst = "control/postinst";
-my $preinst = "control/preinst";
-my $prerm = "control/prerm";
-my $shlibs_control_file = "control/shlibs";
-my $symbols_control_file = "control/symbols";
 my %SONAME;
 my %sharedobject;
 my @shlibs;
@@ -262,12 +258,12 @@ for (keys %SONAME) {
 if ($#shlibs == -1) {
     # no shared libraries included in package, thus shlibs control file should
     # not be present
-    if (-f $shlibs_control_file) {
+    if (-f 'control/shlibs') {
 	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 $shlibs_control_file) {
+    if (not -f 'control/shlibs') {
 	if ($type ne 'udeb') {
 	    for my $shlib (@shlibs) {
 		# skip it if it's not a public shared library
@@ -278,8 +274,8 @@ if ($#shlibs == -1) {
     } else {
 	my %shlibs_control_used;
 	my @shlibs_depends;
-	open(SHLIBS, '<', $shlibs_control_file)
-	    or fail("cannot open shlibs control file $shlibs_control_file for reading: $!");
+	open(SHLIBS, '<', 'control/shlibs')
+	    or fail("cannot open control/shlibs for reading: $!");
 	while (<SHLIBS>) {
 	    chop;
 	    next if m/^\s*$/ or /^#/;
@@ -340,10 +336,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 $symbols_control_file) {
+    if (-f 'control/symbols') {
         tag "pkg-has-symbols-control-file-but-no-shared-libs", "";
     }
-} elsif (not -f $symbols_control_file) {
+} elsif (not -f 'control/symbols') {
     if ($type ne 'udeb') {
 	for my $shlib (@shlibs, keys %unversioned_shlibs) {
 	    # skip it if it's not a public shared library
@@ -351,7 +347,7 @@ if ($#shlibs == -1 and not %unversioned_shlibs) {
 	    tag "no-symbols-control-file", "$shlib";
 	}
     }
-} elsif (open(IN, '<', $symbols_control_file)) {
+} elsif (open(IN, '<', 'control/symbols')) {
     my $version_wo_rev = $version;
     $version_wo_rev =~ s/^(.+)-([^-]+)$/$1/;
     my ($full_version_count, $full_version_sym) = (0, undef);
@@ -495,16 +491,16 @@ if (keys %shlibs_control and keys %symbols_control) {
 }
 
 # 6th step: check pre- and post- control files
-if (-f $preinst) {
-    local $_ = slurp_entire_file($preinst);
+if (-f 'control/preinst') {
+    local $_ = slurp_entire_file('control/preinst');
     if (/^[^\#]*\bldconfig\b/m) {
 	tag "preinst-calls-ldconfig", ""
     }
 }
 
 my $we_call_postinst=0;
-if (-f $postinst) {
-    local $_ = slurp_entire_file($postinst);
+if (-f 'control/postinst') {
+    local $_ = slurp_entire_file('control/postinst');
 
     # Decide if we call ldconfig
     if (/^[^\#]*\bldconfig\b/m) {
@@ -522,15 +518,15 @@ if ($type eq 'udeb') {
 	if not $we_call_postinst and $must_call_ldconfig;
 }
 
-if (-f $prerm) {
-    local $_ = slurp_entire_file($prerm);
+if (-f 'control/prerm') {
+    local $_ = slurp_entire_file('control/prerm');
     if (/^[^\#]*\bldconfig\b/m) {
 	tag "prerm-calls-ldconfig", "";
     }
 }
 
-if (-f $postrm) {
-    local $_ = slurp_entire_file($postrm);
+if (-f 'control/postrm') {
+    local $_ = slurp_entire_file('control/postrm');
 
     # Decide if we call ldconfig
     if (/^[^\#]*\bldconfig\b/m) {

-- 
Debian package checker


Reply to: