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

[lintian] 08/11: harness: Populate the state data if/when empty



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 12d2e6181d5b79894e0656bf75923dbaaeb5096e
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Dec 21 14:32:21 2013 +0100

    harness: Populate the state data if/when empty
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 reporting/harness | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/reporting/harness b/reporting/harness
index 5e34ad4..303d015 100755
--- a/reporting/harness
+++ b/reporting/harness
@@ -297,6 +297,7 @@ unless ($opt{'reports-only'}) {
     # (particularly without the source package).
 
     Log('Computing grouping...');
+    $state = load_state_cache($STATE_DIR);
 
     if ($opt{'full-mode'}) {
         # for full run, just replace %dirty_groups with "<all groups in lab>".
@@ -305,11 +306,20 @@ unless ($opt{'reports-only'}) {
                 my ($entry) = @_;
                 $dirty_groups{$entry->pkg_src}->{$entry->pkg_src_version} = 1;
             });
+    } elsif (not %{$state}) {
+        # New/empty state file
+        Log('Populating state file... ');
+        $LAB->visit_packages(
+            sub {
+                my ($entry) = @_;
+                my $group_id
+                  = join('/', $entry->pkg_src, $entry->pkg_src_version);
+                $state->{$group_id} = {};
+            });
     }
 
     # Sort so that the worklist is also sorted (makes it easier to review).
     my $comparator = sub { versions_lt($a, $b) ? -1 : 1; };
-    my $state = load_state_cache($STATE_DIR);
     foreach my $gname (sort keys %dirty_groups) {
         my $dver = $dirty_groups{$gname};
         foreach my $gversion (sort $comparator keys %$dver) {
@@ -317,11 +327,11 @@ unless ($opt{'reports-only'}) {
             my $query = "GROUP:${group_id}";
             my @res = $LAB->lab_query($query);
 
-            # Clear the "processed by" flag, so it will be reprocessed if
-            # lintian is interrupted for some reason.
-            delete($state->{$group_id}{'last-processed-by'});
-
             if (@res) {
+                # Clear the "processed by" flag, so it will be reprocessed if
+                # lintian is interrupted for some reason.
+                delete($state->{$group_id}{'last-processed-by'});
+
                 # Group is still in the Lab - reprocess it together
                 push(@worklist, $group_id);
                 foreach my $entry (@res) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: