From: Ben Pfaff Date: Tue, 16 Feb 2010 05:01:31 +0000 (-0800) Subject: Works OK. Add --batch X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a861f41d5f49d7e57400b2d572fbdb83a62b7d28;p=pspp Works OK. Add --batch --- diff --git a/build-pspp b/build-pspp index 3d3959095a..724221cebd 100755 --- a/build-pspp +++ b/build-pspp @@ -9,8 +9,10 @@ use warnings; my $help = 0; my $build_binary = 1; +my $batch = 0; GetOptions ("h|help" => \$help, - "binary!" => \$build_binary); + "binary!" => \$build_binary, + "batch!" => \$batch); usage () if $help; @@ -22,6 +24,7 @@ chomp $builder; # Select build number. my $build_number = POSIX::strftime("%Y%m%d%H%M%S", localtime); +print "$build_number\n" if $batch; my $topdir = getcwd (); @@ -43,7 +46,7 @@ set_var ("build_number", $build_number); sub start_step { my ($msg) = @_; print LOG " \n$msg\n"; - print "$msg\n"; + print "$msg\n" unless $batch; } sub set_var { @@ -53,7 +56,7 @@ sub set_var { print VAR "$value\n"; close VAR; print LOG "$var=$value\n"; - print "\t$var=$value\n"; + print "\t$var=$value\n" unless $batch; } sub save_result { @@ -98,6 +101,7 @@ if (@ARGV == 2) { # Extract source. start_step ("Extract branch into $builddir/pspp$build_number"); run ("git archive --format=tar --prefix=pspp$build_number/ buildtmp/$$/pspp | (cd $builddir && tar xf -)"); + run ("git branch -D buildtmp/$$/pspp"); # Extract version number. start_step ("Extract repository version number"); @@ -290,6 +294,8 @@ where TARBALL is the name of a tarball produced by "make dist" Options: --help Print this usage message and exit + --no-binary Build source tarballs but no binaries. + --batch Do not print progress to stdout. EOF exit(0); } @@ -329,20 +335,21 @@ sub try_run { $progress .= sprintf ", ETA %d s", $left; } } - print "\r$progress", " " x (79 - length ($progress)), "\r"; + print "\r$progress", " " x (79 - length ($progress)), "\r" + unless $batch; } close (COMMAND); - print "\r", " " x 79, "\r"; + print "\r", " " x 79, "\r" unless $batch; write_timing ($id, time () - $start) if defined ($id); return 1 if !$?; if ($? & 127) { - printf "%s: child died with signal %d, %s coredump\n", + printf STDERR "%s: child died with signal %d, %s coredump\n", $command, ($? & 127), ($? & 128) ? 'with' : 'without'; } else { - printf "%s: child exited with value %d\n", $command, $? >> 8; + printf STDERR "%s: child exited with value %d\n", $command, $? >> 8; } return 0; }