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

[SCM] Debian package checker branch, lab-refactor, updated. 2.5.3-58-g500a593



The following commit has been merged in the lab-refactor branch:
commit 500a593470a46cb85e65d6bc7b9802861567f40e
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Sep 24 22:57:11 2011 +0200

    Copy generate_diff from Lab to Lintian::Lab
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/frontend/lintian-harness b/frontend/lintian-harness
index d2cce1e..fe27b7f 100755
--- a/frontend/lintian-harness
+++ b/frontend/lintian-harness
@@ -88,7 +88,7 @@ unless ($opt{'LINTIAN_ROOT'}) {
 }
 
 unshift @INC, "$opt{'LINTIAN_ROOT'}/lib";
-require Lab;
+require Lintian::Lab;
 require Lintian::Config;
 require Lintian::Internal::PackageList;
 require Util;
@@ -96,7 +96,7 @@ import Util qw(fail);
 
 $conf = Lintian::Config->new(\%cfghash);
 
-my $lab = Lab->new($opt{'LINTIAN_LAB'});
+my $lab = Lintian::Lab->new($opt{'LINTIAN_LAB'});
 
 my ($nblist,$nulist, $nslist) = read_archive($opt{'LINTIAN_ARCHIVEDIR'}, trim($opt{'LINTIAN_DIST'}),
                                               trim($opt{'LINTIAN_AREA'}), trim($opt{'LINTIAN_ARCH'}));
@@ -212,7 +212,7 @@ sub _pkg_parser {
         if ($@) {
             # error!
             print STDERR "$@\n";
-            print "E: general: bad-source-package $dsc_file\n";
+            print "E: general: bad-source-package $file\n";
             next;
         }
     }
diff --git a/lib/Lintian/Lab.pm b/lib/Lintian/Lab.pm
index 1c4b77b..6c7a92a 100644
--- a/lib/Lintian/Lab.pm
+++ b/lib/Lintian/Lab.pm
@@ -277,6 +277,34 @@ sub _pool_path {
     return $path;
 }
 
+# lab->generate_diffs(@lists)
+#
+# Each member of @lists must be a Lintian::Internal::PackageList.
+#
+# The lab will generate a diff between the given member and its
+# state for the given package type.  The diffs are returned in the
+# same order as they appear in @lists.
+#
+# The diffs are valid until the original list is modified or a
+# package is added or removed to the lab.
+sub generate_diffs {
+    my ($self, @lists) = @_;
+    my $labdir = $self->dir;
+    my @diffs;
+    croak "$labdir is not a valid lab (run lintian --setup-lab first?).\n"
+        unless $self->is_open;
+    foreach my $list (@lists) {
+        my $type = $list->type;
+        my $lab_list;
+        # Ensure the state list is loaded
+        $self->_get_lab_index ($type);
+        $lab_list = $self->{'state'}->{$type};
+        push @diffs, $lab_list->diff ($list);
+    }
+    return @diffs;
+}
+
+
 =item $lab->create_lab ([$opts])
 
 Creates a new lab.  It will create $self->dir if it does not

-- 
Debian package checker


Reply to: