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

[SCM] Debian package checker branch, master, updated. 2.5.9-27-g9e61a25



The following commit has been merged in the master branch:
commit 479ab702bd4c690d8b81bd5496b8960486fb8593
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Jun 27 14:53:14 2012 +0200

    lintian: Refactor job part of the unpack loop into a sub
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/frontend/lintian b/frontend/lintian
index ea22844..136ca17 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1431,31 +1431,22 @@ sub unpack_group {
                     next PROC;
                 }
                 $running_jobs{$cmd->pid} = $cmd;
-                $job_data{$cmd->pid} = [$coll, $start_timer->()];
+                $job_data{$cmd->pid} = [$ci, $collmap, $lpkg, $start_timer->()];
             }
             # wait until a job finishes to run its branches, if any, or skip
             # this package if any of the jobs failed.
             debug_msg(1, "Reaping done jobs ... unpack $pkg_name $pkg_ver [$pkg_arch] ($pkg_type)");
 
             while (my ($key, $cmd) = Lintian::Command::Simple::wait(\%running_jobs)) {
-                my ($coll, $timer) = @{ $job_data{$key} };
+                my $jdata = $job_data{$key};
+                my $res = finished_coll ($key, $cmd, $jdata);
                 delete $running_jobs{$key};
                 delete $job_data{$key};
-                if ($cmd->status() == 0) {
-                    my $ci = $collection_info{$coll};
-                    my $tres = $finish_timer->($timer);
-                    $lpkg->_mark_coll_finished($coll, $ci->version)
-                        or fail("cannot mark $coll for complete: $!");
-                    debug_msg(1, "Collection script $coll done$tres");
-                } else {
-                    warning("collect info $coll about package $pkg_name failed");
-                    warning("skipping $action of $pkg_type package $pkg_name");
-                    $exit_code = 2;
-                    $group->remove_processable($proc);
+                if ($res < 0) {
+                    my (undef, undef, $clpkg) = @$jdata;
+                    $group->remove_processable ($clpkg);
                     next PROC;
                 }
-
-                $collmap->satisfy ($coll);
             }
             debug_msg(1, "Reap done jobs ... unpack $pkg_name $pkg_ver [$pkg_arch] ($pkg_type)");
         }
@@ -1867,6 +1858,28 @@ sub _run_check {
     return $ret;
 }
 
+sub finished_coll {
+    my ($jobid, $job, $job_data) = @_;
+    my ($ci, $cmap, $lpkg, $timer) = @$job_data;
+    my $coll = $ci->name;
+    if ($job->status() == 0) {
+        my $tres = $finish_timer->($timer);
+        $lpkg->_mark_coll_finished($coll, $ci->version)
+            or fail ("cannot mark $coll for complete: $!");
+        debug_msg (1, "Collection script $coll done$tres");
+    } else {
+        my $pkg_name  = $lpkg->pkg_name;
+        my $pkg_type = $lpkg->pkg_type;
+        warning ("collect info $coll about package $pkg_name failed");
+        warning ("skipping $action of $pkg_type package $pkg_name");
+        $exit_code = 2;
+        return -1;
+    }
+
+    $cmap->satisfy ($coll);
+    return $cmap->selectable;
+}
+
 # }}}
 
 # {{{ Exit handler.

-- 
Debian package checker


Reply to: