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

[SCM] Debian package checker branch, master, updated. 2.5.10-137-gaafc722



The following commit has been merged in the master branch:
commit 70cf082f1207fb420e3e82e7afe729798f27bae0
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Sep 9 11:43:22 2012 +0200

    L::Unpacker: Accept a L::Profile as "requested" colls
    
    Accept a Lintian::Profile as the "requested collections".  In this
    case, L::Unpacker will determine which collections are needed based on
    the enabled checks.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/lib/Lintian/Unpacker.pm b/lib/Lintian/Unpacker.pm
index aba1d0e..4d319a4 100644
--- a/lib/Lintian/Unpacker.pm
+++ b/lib/Lintian/Unpacker.pm
@@ -22,6 +22,7 @@ use strict;
 use warnings;
 
 use Carp qw(croak);
+use Scalar::Util qw(blessed);
 
 use base 'Class::Accessor';
 
@@ -77,10 +78,20 @@ COLLMAP is a L<Lintian::DepMap::Properties> decribing the dependencies
 between the collections.  Each node in COLLMAP must have a
 L<Lintian::CollScript> as property.
 
-REQUESTED is a hash table containing requested collections.  The
-values are ignored, only the keys are considered.  For existing
-entries, as few collections as possible will be processed.  The
-collections mentioned in REQUESTED are considered required.
+REQUESTED is either, C<undef> a reference to a hash table or a
+L<Lintian::Profile>.  If it is a hash table reference, then the values
+are ignored.  The keys are considered names of the requested
+collections.
+
+If REQUESTED is a Lintian::Profile, then all collections needed for
+the I<enabled> checks will be considered the requested collections.
+
+If REQUESTED is C<undef> then every collection mentioned in COLLMAP is
+considered "required".
+
+For existing entries, as few collections as possible will be
+processed.  The collections mentioned in REQUESTED are considered
+the "minimum requirement".
 
 JOBLIMIT is the max number of jobs to be run in parallel.  Can be
 changed with the L</jobs> method later.
@@ -91,14 +102,24 @@ changed with the L</jobs> method later.
 sub new {
     my ($class, $collmap, $requested, $jobs) = @_;
     my $ccmap = $collmap->clone;
+    my $req_table = $requested;
     $jobs //= 0;
     my $self = {
         'collmap' => $ccmap,
         'jobs' => $jobs,
-        'requested' => $requested,
         'running-jobs' => {},
         'worktable' => {},
     };
+    if (defined $requested && blessed $requested &&
+          $requested->isa ('Lintian::Profile')) {
+        $req_table = {};
+        foreach my $cname ($requested->scripts) {
+            my $check = $requested->get_script ($cname);
+            $req_table->{$_} = 1 for $check->needs_info;
+        }
+    }
+    $self->{'requested'} = $req_table;
+
     # Initialise our copy
     $ccmap->initialise;
     bless $self, $class;

-- 
Debian package checker


Reply to: