From 39046908227689a499ef0701678a41fce99b5ae1 Mon Sep 17 00:00:00 2001 From: "jingui.ren" Date: Wed, 25 Jul 2018 19:52:32 +0800 Subject: [PATCH] remove DATA_LOOP flag and format the code style Change-Id: Idccfc64dc79bcc2399806e528a6b803259443d1d --- depanneur | 89 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/depanneur b/depanneur index c01a0fa..fb7123a 100755 --- a/depanneur +++ b/depanneur @@ -2528,35 +2528,35 @@ if ($style eq 'git') { info("prepare sources..."); read_not_export($not_export_cf); - my @data_queue = (); - foreach my $pack (@pre_packs) { - if ($not_export_source == 1) { - my $name = basename($pack->{"project_base_path"}); - my $r = grep /^$name$/, @not_export; - if ($vmtype eq "kvm") { - $r = 0; - } - if ($r) { - info("skip export $name for accel..."); - my $specs = $pack->{"filename"}; - my $new_p; - $new_p->{"project_base_path"} = $pack->{"project_base_path"}; - $new_p->{"packaging_dir"} = $pack->{"packaging_dir"}; - $new_p->{"upstream_branch"} = $pack->{"upstream_branch"}; - $new_p->{"upstream_tag"} = $pack->{"upstream_tag"}; - my @spec_list = split(",", $specs); - foreach my $spec (@spec_list) { - $new_p->{"filename"} = $spec; - push @packs, $new_p; - } - } else { - info("package $name not support skip export source"); - push @data_queue, $pack; - } - } else { - push @data_queue, $pack; - } - } + my @data_queue = (); + foreach my $pack (@pre_packs) { + if ($not_export_source == 1) { + my $name = basename($pack->{"project_base_path"}); + my $r = grep /^$name$/, @not_export; + if ($vmtype eq "kvm") { + $r = 0; + } + if ($r) { + info("skip export $name for accel..."); + my $specs = $pack->{"filename"}; + my $new_p; + $new_p->{"project_base_path"} = $pack->{"project_base_path"}; + $new_p->{"packaging_dir"} = $pack->{"packaging_dir"}; + $new_p->{"upstream_branch"} = $pack->{"upstream_branch"}; + $new_p->{"upstream_tag"} = $pack->{"upstream_tag"}; + my @spec_list = split(",", $specs); + foreach my $spec (@spec_list) { + $new_p->{"filename"} = $spec; + push @packs, $new_p; + } + } else { + info("package $name not support skip export source"); + push @data_queue, $pack; + } + } else { + push @data_queue, $pack; + } + } my $thread_num = int(sysconf(SC_NPROCESSORS_ONLN)); if ($thread_num > 28) { @@ -2572,9 +2572,8 @@ if ($style eq 'git') { } } ); - DATA_LOOP: foreach my $pack (@data_queue) { - my $pid = $pm->start($pack->{"filename"}) and next DATA_LOOP; + my $pid = $pm->start($pack->{"filename"}) and next; my @packs_arr = (); @packs_arr = prepare_git($config, $pack->{"project_base_path"}, $pack->{"filename"}, $pack->{"packaging_dir"}, $pack->{"upstream_branch"}, $pack->{"upstream_tag"}); @@ -2861,16 +2860,16 @@ while (! $TERM) { } if ($add == 1 ) { push(@order, $name); - last; + last; } } else { - push(@order_clean, $name); - } + push(@order_clean, $name); + } } - #remove unuseful package name from build_order - foreach my $u_name (@order_clean) { - @build_order = grep { $_ ne $u_name} @build_order; - } + #remove unuseful package name from build_order + foreach my $u_name (@order_clean) { + @build_order = grep { $_ ne $u_name} @build_order; + } # No candidate packges and all thread works are idle, and pkgdeps # is updated, in this case, set packages in %tmp_expansion_errors @@ -2919,13 +2918,13 @@ while (! $TERM) { for (; $needed && ! $TERM; $needed--) { - my $job ; - if (scalar (@order) != 0) { - $job = shift(@order); - } - else { - last ; - } + my $job ; + if (scalar (@order) != 0) { + $job = shift(@order); + } + else { + last ; + } my $worker = find_idle(); my $index; -- 2.34.1