From: Jun Wang Date: Thu, 1 Sep 2016 06:04:21 +0000 (+0800) Subject: 1.Improve build order for multiple building X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e94e9ef94ae047acc84b37290a30659e39cb824b;p=tools%2Fdepanneur.git 1.Improve build order for multiple building 2.Reduce copy files for rpm packages,using mv instead Change-Id: I8244130d0ef436bbe7868e542499904201d765b7 --- diff --git a/depanneur b/depanneur index 5b26994..e3d5ea3 100755 --- a/depanneur +++ b/depanneur @@ -5,6 +5,7 @@ use warnings; use File::Spec::Functions; use JSON; use HTML::Template; +use Time::HiRes qw ( sleep time ); # Pretreatment for adding build path to search BEGIN { @@ -1811,9 +1812,8 @@ sub build_package { chomp($srcrpmdirpath); mkdir_p "$success_logs_path/$name-$version-$release"; if (-e "$scratch/.build.log") { - my_system ("cp $scratch/.build.log $success_logs_path/$name-$version-$release/log.txt"); + my_system ("sudo /bin/mv $scratch/.build.log $success_logs_path/$name-$version-$release/log.txt"); $succeeded{"$name"} = "$success_logs_path/$name-$version-$release/log.txt"; - my_system ("sudo /bin/rm -f $scratch/.build.log "); } # Detach and terminate { @@ -1824,14 +1824,14 @@ sub build_package { #copy the new ones to local repo update_repo_with_rpms(\%srpmpaths, @srpms); if ($skip_srcrpm == 0){ - my_system ("cp $scratch/$srcrpmdirpath/*.rpm $srpm_repo_path"); + my_system ("sudo /bin/mv $scratch/$srcrpmdirpath/*.rpm $srpm_repo_path"); } } if (my @rpms = bsd_glob "$scratch/$rpmdirpath/*/*.rpm") { #remove old rpms in local repo #copy the new ones to local repo update_repo_with_rpms (\%rpmpaths, @rpms); - my_system ("cp $scratch/$rpmdirpath/*/*.rpm $rpm_repo_path"); + my_system ("sudo /bin/mv $scratch/$rpmdirpath/*/*.rpm $rpm_repo_path"); } my_system("$build_dir/createrpmdeps $rpm_repo_path > $order_dir/.repo.cache.local "); @@ -1846,8 +1846,7 @@ sub build_package { mkdir_p "$fail_logs_path/$name-$version-$release"; if ( -f "$scratch/.build.log" ) { # move failed log from build root - my_system ("cp $scratch/.build.log $fail_logs_path/$name-$version-$release/log.txt"); - my_system ("sudo /bin/rm -f $scratch/.build.log"); + my_system ("sudo /bin/mv $scratch/.build.log $fail_logs_path/$name-$version-$release/log.txt"); $errors{"$name"} = "$fail_logs_path/$name-$version-$release/log.txt"; warning("build failed, Leaving the logs in $fail_logs_path/$name-$version-$release/log.txt"); } else { @@ -2336,7 +2335,7 @@ if ($debug) { # be processed while (! $TERM) { my @order = (); - my @o = (); + my @order_clean = (); { # update glocal vars %repo and %pkgdeps etc. @@ -2383,9 +2382,17 @@ while (! $TERM) { } if ($add == 1 ) { push(@order, $name); - } + last; + } else { + 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; + } # No candidate packges and all thread works are idle, and pkgdeps # is updated, in this case, set packages in %tmp_expansion_errors # as real expansion_errors, and all packages depend on these packages @@ -2409,14 +2416,10 @@ while (! $TERM) { # so just wait 1 second and do another resolve procedure if (@order == 0) { # Waiting thread workers done, then re-calculate ready packages - sleep(1); + sleep(0.1); next; - } else { - info("next pass:"); - foreach my $o (@order) { - print $o . "\n"; - } - } + } + if ($dryrun) { exit 1 } @@ -2431,7 +2434,7 @@ while (! $TERM) { # There is no idle thread if ($needed == 0) { # Waiting for build threads finish - sleep(1); + sleep(0.1); next; }