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

[SCM] Debian package checker branch, master, updated. 2.5.4-6-gb236623



The following commit has been merged in the master branch:
commit b2366232114efec2187443482d33d9560feb75c6
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Nov 30 12:49:30 2011 +0100

    Removed a lot of assumptions about the presence of fields
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/binaries b/checks/binaries
index b731878..8eeb543 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -183,6 +183,12 @@ foreach my $file (sort keys %{$info->objdump_info}) {
 # but which don't matter for the purposes of this check.  Also filter out
 # nsswitch modules
 $madir = $MULTIARCH_DIRS->value($arch);
+
+# In the (unlikely) case that the architecture is unknown (or we do
+# not know the multi-arch path for a known architecture) , we assume
+# it the multi-arch path to be this (hopefully!) non-existent path to
+# avoid warnings about uninitialized variables.
+$madir = './!non-existant-path!/./' unless defined $madir;
 sub lib_soname_path {
     my ($dir, @paths) = @_;
     foreach my $path (@paths) {
diff --git a/checks/cruft b/checks/cruft
index ec1377a..9704f67 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -103,6 +103,9 @@ if (-e "$droot/files" and not -z "$droot/files") {
 # This doens't really belong here, but there isn't a better place at the
 # moment to put this check.
 my $version = $info->field('version');
+# If the version field is missing, assume it to be a native,
+# maintainer upload as it is probably the most likely case.
+$version = '0-1';
 if ($info->native) {
     if ($version =~ /-/ and $version !~ /-0\.[^-]+$/) {
         tag 'native-package-with-dash-version';
@@ -122,6 +125,11 @@ my $ltinbd  = $info->relation ('build-depends-all')->implies ($LIBTOOL);
 # that data across packages in a large Lintian run.
 my %warned;
 my $format = $info->field('format');
+# Assume the package to be non-native if the field is not present.
+# - while 1.0 is more likely in this case, Lintian will probably get
+#   better results by checking debfiles/ rather than looking for a diffstat
+#   that may not be present.
+$format = '3.0 (quilt)' unless defined $format;
 if ($format =~ /^\s*2\.0\s*\z/ or $format =~ /^\s*3\.0\s*\(quilt\)/) {
     my $wanted = sub { check_debfiles($pkg, $info, qr/\Q$droot\E/, \%warned) };
     find($wanted, $droot);
diff --git a/checks/debconf b/checks/debconf
index 26dcbb4..4f2a6fc 100644
--- a/checks/debconf
+++ b/checks/debconf
@@ -69,7 +69,9 @@ my $usespreinst='';
 my $usesmultiselect='';
 
 if ($type eq 'source') {
-    my $binaries = $info->field('binary');
+    my $binaries = $info->field('binary')/;
+    # no binary field?  There is not much we can do about it here.
+    return 0 unless defined $binaries;
     chomp $binaries;
     my @files = map { "$_.templates" } split /,\s+/, $binaries;
     push @files, 'templates';
@@ -125,10 +127,12 @@ return unless $seenconfig or $seentemplates or $usespreinst;
 # parse depends info for later checks
 
 # Consider every package to depend on itself.
-my $version;
+my $selfrel;
 if (defined $info->field('version')) {
     $_ = $info->field('version');
-    $version = "$pkg (= $_)";
+    $selfrel = "$pkg (= $_)";
+} else {
+    $selfrel = "$pkg";
 }
 
 my (%dependencies, @alldeps);
@@ -136,12 +140,12 @@ my (%dependencies, @alldeps);
 for my $field (qw(depends pre-depends)) {
     if (defined $info->field($field)) {
         $_ = $info->field($field);
-        $_ .= ", $version" if defined $version;
+        $_ .= ", $selfrel";
         push @alldeps, $_;
         $dependencies{$field} = Lintian::Relation->new($_);
     } else {
-        push @alldeps, $version;
-        $dependencies{$field} = Lintian::Relation->new($version);
+        push @alldeps, $selfrel;
+        $dependencies{$field} = Lintian::Relation->new($selfrel);
     }
 }
 
diff --git a/checks/filename-length b/checks/filename-length
index 3e41796..eef9c1e 100644
--- a/checks/filename-length
+++ b/checks/filename-length
@@ -71,7 +71,7 @@ return if $type ne 'source';
 # Reset to work with elements of the dsc file.
 $len = 0;
 
-foreach my $entry (split m/\n/o, $info->field('files')){
+foreach my $entry (split m/\n/o, $info->field('files')//''){
     my $filename;
     my $flen;
     $entry =~ s/^\s++//o;
diff --git a/checks/files b/checks/files
index 5206d43..e171d70 100644
--- a/checks/files
+++ b/checks/files
@@ -748,7 +748,7 @@ foreach my $file (@{$info->sorted_index}) {
             unless defined($TRIPLETS);
         if ($TRIPLETS->known($subdir)) {
             tag 'triplet-dir-and-architecture-mismatch', "$file is for", $TRIPLETS->value($subdir)
-                if ($info->field('architecture') ne $TRIPLETS->value($subdir));
+                if (($info->field('architecture')//'') ne $TRIPLETS->value($subdir));
         }
     }
 
@@ -759,7 +759,7 @@ foreach my $file (@{$info->sorted_index}) {
         next unless ($info->file_info->{$file}//'') =~ m/\bELF\b/o;
         $TRIPLETS = Lintian::Data->new('files/triplets', qr/\s++/o)
             unless defined($TRIPLETS);
-        if ($TRIPLETS->known($subdir) && $info->field('architecture') eq $TRIPLETS->value($subdir)) {
+        if ($TRIPLETS->known($subdir) && ($info->field('architecture')//'') eq $TRIPLETS->value($subdir)) {
             my $dep = $info->relation('pre-depends');
             tag 'missing-pre-dependency-on-multiarch-support' unless ($dep->implies('multiarch-support'));
         }
diff --git a/checks/nmu b/checks/nmu
index c3f233b..105c722 100644
--- a/checks/nmu
+++ b/checks/nmu
@@ -80,6 +80,11 @@ my $uploaders = $info->field('uploaders');
 
 my $version_nmuness = 0;
 my $version_local = 0;
+
+# If the version field is missing, assume it to be a native,
+# maintainer upload as it is probably the most likely case.
+$version = '0-1' unless defined $version;
+
 if ($version =~ /-[^.-]+(\.[^.-]+)?(\.[^.-]+)?$/) {
     $version_nmuness = 1 if defined $1;
     $version_nmuness = 2 if defined $2;
diff --git a/checks/shared-libs b/checks/shared-libs
index 72cd2ba..da529c4 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -257,6 +257,9 @@ for my $shlib_file (keys %SONAME) {
 my $version = $info->field('version'); # may be undef in very broken packages
 my $provides = $pkg;
 $provides .= "( = $version)" if defined $version;
+# Assume the version to be a non-native version to avoid
+# uninitialization warnings later.
+$version = '0-1';
 if (defined $info->field('provides')) {
     $provides .= ', ' . $info->field('provides');
 }
diff --git a/checks/watch-file b/checks/watch-file
index db86cb4..1983ca4 100644
--- a/checks/watch-file
+++ b/checks/watch-file
@@ -48,6 +48,8 @@ tag 'debian-watch-file-in-native-package' if ($info->native);
 # source package sign, for fine grained version mangling check
 my $version = $info->field('version');
 my $repack;
+# If the version field is missing, we assume a neutral non-native one.
+$version = '0-1' unless defined $version;
 if ($version =~ /(dfsg|debian|ds)/) {
     $repack = $1;
 }
diff --git a/debian/changelog b/debian/changelog
index 4e5081e..b2b3b56 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,14 +1,13 @@
 lintian (2.5.5) UNRELEASED; urgency=low
 
-  * checks/changelog-file:
-    + [NT] Allow the version to be missing and assume it to be
-      "0-1".
+  * checks/*:
+    + [NT] Fixed assumptions about certain fields being present.
+      Where needed, Lintian will make guesses to the most likely
+      value (or the least "broken" value).
   * checks/cruft:
     + [NT] Added dh-autoreconf as a build-depends alternative to
       libtool for suppressing ancient-libtool warning.  Thanks to
       Felix Geyer for the report.  (Closes: #650325)
-  * checks/shared-libs:
-    + [NT] Do not assume the version field to be present.
 
   * collection/index:
     + [NT] Use Lintian::Processable::Package to determine source
@@ -23,6 +22,9 @@ lintian (2.5.5) UNRELEASED; urgency=low
   * lib/Lintian/Collect/{Binary,Source}.pm:
     + [NT] Assume packages to be non-native when it cannot be
       accurately determined due to missing version field.
+  * lib/Lintian/Collect/Source.pm:
+    + [NT] Removed assumption that source packages always have a
+      format field.
   * lib/Lintian/Processable/Package.pm:
     + [NT] Use part of the file name as package name if the mandatory
       "Package" or "Source" fields are missing rather than choking.
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index 193648e..7b27c2e 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -78,6 +78,7 @@ sub native {
     my ($self) = @_;
     return $self->{native} if exists $self->{native};
     my $format = $self->field('format');
+    $format = '1.0' unless defined $format;
     if ($format =~ m/^\s*2\.0\s*$/o or $format =~ m/^\s*3\.0\s+\(quilt\)\s*$/o) {
         $self->{native} = 0;
     } elsif ($format =~ m/^\s*3\.0\s+\(native\)\s*$/o) {
@@ -401,6 +402,9 @@ If the source format is 1.0 and the version number is absent, this
 will return false (as native packages are a lot rarer than non-native
 ones).
 
+Note if the source format is missing, it is assumed to be an 1.0
+package.
+
 =item relation(FIELD)
 
 Returns a Lintian::Relation object for the given build relationship field

-- 
Debian package checker


Reply to: