From: Zhang Qiang Date: Mon, 10 Sep 2012 22:44:35 +0000 (+0800) Subject: sort workers use the first idle thread to build packages X-Git-Tag: 0.1~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b868b89e042bcddbe1dcde660991b0b4f4766c1a;p=tools%2Fdepanneur.git sort workers use the first idle thread to build packages sort workers using keys to use the build worker with smallest id. Without this patch build worker use order is 1,3,0,2,... but it should be 0,1,2,3,... This is necessary to make gbs back compatible while building single package. Change-Id: Ief248542194d697535387753a13200b426b8fcb6 --- diff --git a/depanneur b/depanneur index e177861..88301c8 100755 --- a/depanneur +++ b/depanneur @@ -609,7 +609,7 @@ sub createrepo sub find_idle { my $idle = -1; - foreach my $w (keys %workers) { + foreach my $w (sort keys %workers) { my $tid = $workers{$w}->{tid}; my $state = $workers{$w}->{state}; if (! defined(threads->object($tid))) { @@ -618,7 +618,7 @@ sub find_idle { last; } } - foreach my $w (keys %workers) { + foreach my $w (sort keys %workers) { if ( $workers{$w}->{state} eq 'idle' ) { $idle = $w; last;