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

lintian: r1396 - trunk/lib/Lintian/Collect



Author: djpig
Date: 2008-06-19 01:40:36 +0200 (Thu, 19 Jun 2008)
New Revision: 1396

Modified:
   trunk/lib/Lintian/Collect/Binary.pm
Log:
* lib/Lintian/Collect/Binary.pm:
  + Add support for file-info file.


Modified: trunk/lib/Lintian/Collect/Binary.pm
===================================================================
--- trunk/lib/Lintian/Collect/Binary.pm	2008-06-18 23:35:57 UTC (rev 1395)
+++ trunk/lib/Lintian/Collect/Binary.pm	2008-06-18 23:40:36 UTC (rev 1396)
@@ -100,6 +100,32 @@
     return $self->{index};
 }
 
+# Returns the information from collect/file-info
+sub file_info {
+    my ($self) = @_;
+    return $self->{file_info} if exists $self->{file_info};
+
+    my %file_info;
+    open(my $idx, '<', "file-info")
+        or fail("cannot open file-info: $!");
+    while (<$idx>) {
+        chomp;
+
+        m/^(.+?):\s+(.*)$/o
+            or fail("an error in the file pkg is preventing lintian from checking this package: $_");
+        my ($file, $info) = ($1,$2);
+
+        $file =~ s,^./,,o;
+        $file =~ s,/+$,,o;
+
+        $file_info{$file} = $info;
+    }
+    close $idx;
+    $self->{file_info} = \%file_info;
+
+    return $self->{file_info};
+}
+
 =head1 NAME
 
 Lintian::Collect::Binary - Lintian interface to binary package data collection


Reply to: