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

[lintian] 01/02: L::Util: Shuffle the harness backlog



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

nthykier pushed a commit to branch master
in repository lintian.

commit 9b8873f3e75011158163f075afb9e890ca48ff95
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Aug 2 21:01:41 2016 +0000

    L::Util: Shuffle the harness backlog
    
    ... to reduce the risk of all large packages being in the same run
    (e.g. like gcc-5 + gcc-5-cross + gcc-6 + gcc-6-cross).
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog    |  3 +++
 lib/Lintian/Util.pm | 17 +++++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2573e11..2358d46 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -110,6 +110,9 @@ lintian (2.5.46) UNRELEASED; urgency=medium
   * lib/Lintian/Tags.pm:
     + [JW, NT] Fix mojibake in UTF-8 encoded comments for overrides.
       (Closes: #833052)
+  * lib/Lintian/Util.pm:
+    + [NT] Shuffle the harness backlog a bit to reduce the risk of a lot
+      of very large package groups being scheduled in the same run.
 
   * man/lintian.pod.in:
     + [JW] Fix typo.
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index fff29c9..d5528c1 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -97,6 +97,7 @@ use Digest::SHA;
 use Encode ();
 use File::Temp qw(tempfile);
 use FileHandle;
+use List::Util qw(shuffle);
 use Scalar::Util qw(openhandle);
 
 use Lintian::Command qw(spawn safe_qx);
@@ -1614,11 +1615,15 @@ harness state, return a list of group ids that are part of the
 backlog.  The list is sorted based on what version of Lintian
 processed the package.
 
+Note the result is by design not deterministic to reduce the
+risk of all large packages being in the same run (e.g. like
+gcc-5 + gcc-5-cross + gcc-6 + gcc-6-cross).
+
 =cut
 
 sub find_backlog {
     my ($lintian_version, $state) = @_;
-    my (@list, @sorted);
+    my (@backlog, %by_version);
     for my $group_id (keys(%{$state->{'groups'}})) {
         my $last_version = '0';
         my $group_data = $state->{'groups'}{$group_id};
@@ -1631,12 +1636,12 @@ sub find_backlog {
         }
         $is_out_of_date = 1
           if not versions_equal($last_version, $lintian_version);
-        push(@list, [$group_id, $last_version]) if $is_out_of_date;
+        push(@{$by_version{$last_version}}, $group_id) if $is_out_of_date;
+    }
+    for my $v (sort(versions_comparator keys(%by_version))) {
+        push(@backlog, shuffle(@{$by_version{$v}}));
     }
-    @sorted = map { $_->[0] }
-      sort { versions_comparator($a->[1], $b->[1]) || $a->[0] cmp $b->[0] }
-      @list;
-    return @sorted;
+    return @backlog;
 }
 
 =item untaint(VALUE)

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


Reply to: