Subject: [PATCH] Add support to extract information from file-info via Lintian::Data::Source

From: Raphael Geissert <[email-masked]>
Date: Sat, 7 Feb 2009 14:24:17 -0600

---
 lib/Lintian/Collect/Source.pm |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index c7249d0..8c6b08c 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -101,6 +101,32 @@ sub binary_field {
     return $self->{binary_field}{$package}{$field};
 }
 
+# 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::Source - Lintian interface to source package data collection