Changeset 1550


Ignore:
Timestamp:
May 21, 2012, 2:32:38 AM (7 years ago)
Author:
bruno
Message:
  • pb: import cluck (for debugging, not in active use). Add the "all ok" logic to all of the uses of Parallel::ForkManager?. I tried to do pb cmd && pb cmd && pb cmd, the second one failed so the third just threw tons of errors. Add -e to all the bash invocations so they will properly report back errors. Increase the complexity of my workaround for centos5.8 sudoers problem. This one works (But maybe not again with Bruno's adaptation !). (Eric Andersson)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1549 r1550  
    1717# in their respective section
    1818use Getopt::Long qw(:config auto_abbrev no_ignore_case);
     19use Carp 'cluck';
    1920use Data::Dumper;
    2021use English;
     
    10621063
    10631064            # Try to use // processing here
     1065            my $all_ok = 1;
    10641066            my $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel);
     1067            $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
     1068                                    $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0)); });
    10651069
    10661070            pb_log(0,"Preparing delivery ...\n");
     
    11891193            # In the parent, we need to get the result from the children
    11901194            $pm->wait_all_children if (defined $pbparallel);
     1195            die "Aborting, one or more of the children failed." if ((not $all_ok) && ($Global::pb_stop_on_error));
    11911196            my $made = "";
    11921197            my %h = ();
     
    17021707            $made .= " ".pb_get_content($f);
    17031708        }
    1704         die "Aborting, one or more of the children failed.\n" if ((not $all_ok) && ($Global::pb_stop_on_error));
     1709        die "Aborting, one or more of the children failed." if ((not $all_ok) && ($Global::pb_stop_on_error));
    17051710        pb_rm_rf($tmpd);
    17061711    }
     
    22502255    # Do not touch when just announcing
    22512256    if (($cmt ne "Announce") && ($cmt ne "CPAN")) {
    2252         pb_system("$shcmd \"mkdir -p $tdir ; cd $tdir ; echo \'for i in $basesrc; do if [ -f \$i ]; then rm -f \$i; fi; done\ ; $cmd' | bash\"","Preparing $tdir on $cptarget");
     2257        pb_system("$shcmd \"mkdir -p $tdir ; cd $tdir ; echo \'for i in $basesrc; do if [ -f \$i ]; then rm -f \$i; fi; done\ ; $cmd' | bash-e\"","Preparing $tdir on $cptarget");
    22532258    } else {
    22542259        $logres = "> ";
     
    26452650my ($vmexist,$vmpid) = (undef,undef);
    26462651my $pm;
     2652my $all_ok = 1;
    26472653if (defined $pbparallel) {
    26482654    $pm = new Parallel::ForkManager($pbparallel);
     
    26502656    # Set which port the VM/RM will use to communicate
    26512657    $pm->run_on_start(\&pb_set_port);
     2658    $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
     2659                            unless ($code == 0 && $signal == 0 && $dump == 0) {
     2660                                pb_log(0,"ERROR: pid $pid failed\n");
     2661                            }
     2662                        });
    26522663}
    26532664
     
    27762787}
    27772788$pm->wait_all_children if (defined $pbparallel);
     2789die "Aborting, one or more of the children failed." if ((not $all_ok) && ($Global::pb_stop_on_error));
    27782790}
    27792791
     
    29422954
    29432955my $pm;
     2956my $all_ok = 1;
    29442957if (defined $pbparallel) {
    29452958    $pm = new Parallel::ForkManager($pbparallel);
     
    29472960    # Set which port the VM/RM will use to communicate
    29482961    $pm->run_on_start(\&pb_set_port);
     2962    $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
     2963                            $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0));
     2964                        });
    29492965}
    29502966
     
    33153331    my $dir = $m;
    33163332    $dir =~ s/-.*//;
    3317     pb_system("echo \"rm -rf $m* ; wget http://search.cpan.org/CPAN/modules/by-module/$dir/$m-$osperlver->{$m}.tar.gz ; gzip -cd $m-$osperlver->{$m}.tar.gz | tar xf - ; cd $m* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash" ,"Installing perl module $m-$osperlver->{$m}");
     3333    pb_system("echo \"rm -rf $m* ; wget http://search.cpan.org/CPAN/modules/by-module/$dir/$m-$osperlver->{$m}.tar.gz ; gzip -cd $m-$osperlver->{$m}.tar.gz | tar xf - ; cd $m* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash -e" ,"Installing perl module $m-$osperlver->{$m}");
    33183334}
    33193335EOF
     
    34023418}
    34033419$pm->wait_all_children if (defined $pbparallel);
     3420die "Aborting, one or more of the children failed." if ((not $all_ok) && ($Global::pb_stop_on_error));
    34043421return;
    34053422}
Note: See TracChangeset for help on using the changeset viewer.