diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-11-30 07:15:22 -0600 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-11-30 07:15:22 -0600 |
commit | c262a5b4f50d10652b262b7b256000b2a3487a24 (patch) | |
tree | f1e41f28c725a3d2b647e5ae4189087badcae105 /SBO-Lib/lib/SBO/Lib.pm | |
parent | 317db7ea3e8e4b908e2c918310ecb3fe29569f4b (diff) | |
download | sbotools2-c262a5b4f50d10652b262b7b256000b2a3487a24.tar.xz |
fix bug where exit status of slackbuild was lost due to piping it to tee, introduced when reducing amount rewriting done to slackbuilds
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 385a3da..a6c205e 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -577,6 +577,7 @@ sub perform_sbo { my ($cmd, %changes); # set any changes we need to make to the .SlackBuild, setup the command + $cmd = '( '; $args{JOBS} = 0 if $args{JOBS} eq 'FALSE'; if ($args{ARCH} eq 'x86_64' and ($args{C32} || $args{X32})) { @@ -585,11 +586,14 @@ sub perform_sbo { } elsif ($args{X32}) { $changes{arch_out} = 'i486'; } - $cmd = '. /etc/profile.d/32dev.sh &&'; + $cmd .= '. /etc/profile.d/32dev.sh &&'; } $cmd .= " $args{OPTS}" if $args{OPTS}; $cmd .= " MAKEOPTS=\"-j$args{JOBS}\"" if $args{JOBS}; - $cmd .= " /bin/sh $location/$sbo.SlackBuild"; + # get a tempfile to store the exit status of the slackbuild + my $exit_temp = tempfile (DIR => $tempdir); + my $exit_fn = get_tmp_extfn $exit_temp; + $cmd .= " /bin/sh $location/$sbo.SlackBuild; echo \$? > $exit_fn )"; my $tempfh = tempfile (DIR => $tempdir); my $fn = get_tmp_extfn $tempfh; $cmd .= " | tee -a $fn"; @@ -597,7 +601,9 @@ sub perform_sbo { SLACKBUILD => "$location/$sbo.SlackBuild", CHANGES => \%changes, ); - chdir $location, my $out = system $cmd; + chdir $location, system $cmd; + seek $exit_temp, 0, 0; + my $out = do {local $/; <$exit_temp>}; revert_slackbuild "$location/$sbo.SlackBuild"; die "$sbo.SlackBuild returned non-zero exit status\n" unless $out == 0; my $pkg = get_pkg_name $tempfh; |