Changeset 1595 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder


Ignore:
Timestamp:
May 24, 2012, 10:54:48 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • pb_system is back to 3 params, as the previously undocumented "mayfail" 3rd parameter povides what the 4th was dded for. callers adapted in relationship
Location:
devel/pb-modules/lib/ProjectBuilder
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1592 r1595  
    137137The first parameter is the shell command to call. This command should NOT use redirections.
    138138The second parameter is the message to print on screen. If none is given, then the command is printed.
    139 The third parameter print the result of the command after correct execution if value is verbose. If value is noredir, it avoids redirecting outputs (e.g. for vi). If value is quiet, doesn't print anything at all.
    140 The fourth parameter determines whether failure of the command is ok even if $Global::pb_stop_on_error is set, because the caller will be handling the error.
     139The third parameter prints the result of the command after correct execution if value is "verbose". If value is "noredir", it avoids redirecting outputs (e.g. for vi). If value is "quiet", doesn't print anything at all. If value is "mayfail", failure of the command is ok even if $Global::pb_stop_on_error is set, because the caller will be handling the error.
    141140This function returns as a result the return value of the system command.
    142141
     
    150149my $cmt=shift || $cmd;
    151150my $verbose=shift || undef;
    152 my $failure_ok = shift || 0;
    153151my $redir = "";
    154152
     
    177175
    178176if (defined $error) {
    179     pb_log(0, $error) if (((! defined $verbose) || ($verbose ne "quiet")) || ($Global::pb_stop_on_error && ! $failure_ok));
     177    pb_log(0, $error) if (((! defined $verbose) || ($verbose ne "quiet")) || ($Global::pb_stop_on_error));
    180178    pb_display_file("$ENV{'PBTMP'}/system.$$.log") if ((-f "$ENV{'PBTMP'}/system.$$.log") and ((! defined $verbose) || ($verbose ne "quiet") || $Global::pb_stop_on_error));
    181     if (($Global::pb_stop_on_error) && (! $failure_ok)) {
     179    if ($Global::pb_stop_on_error) {
    182180        confess "error running command ($cmd) with cwd=$cwd, pid=$$";
    183181    }
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r1553 r1595  
    336336# This may not be // proof. We should test for availability of repo and sleep if not
    337337my $cmd = "$pbos->{'install'} $deps";
    338 my $ret = pb_system($cmd, "Installing dependencies ($cmd)",undef,1);
     338my $ret = pb_system($cmd, "Installing dependencies ($cmd)","mayfail");
    339339# Try to accomodate deficient proxies
    340340if ($ret != 0) {
     
    446446    next if $p =~ /^\s*$/o;
    447447    if ($pbos->{'type'} eq  "rpm") {
    448         my $res = pb_system("rpm -q --whatprovides --quiet $p","","quiet",1);
     448        my $res = pb_system("rpm -q --whatprovides --quiet $p","","mayfail");
    449449        next if ($res eq 0);
    450450        pb_log(1, "INFO: missing dependency $p\n");
    451451    } elsif ($pbos->{'type'} eq "deb") {
    452         my $res = pb_system("dpkg -L $p","","quiet",1);
     452        my $res = pb_system("dpkg -L $p","","mayfail");
    453453        next if ($res eq 0);
    454454        open(CMD,"dpkg -l $p |") or die "Unable to run dpkg -l $p: $!";
     
    562562            my $pn = $bn;
    563563            $pn =~ s/\.rpm//;
    564             if (pb_system("rpm -q --quiet $pn","","quiet",1) != 0) {
     564            if (pb_system("rpm -q --quiet $pn","","mayfail") != 0) {
    565565                pb_system("sudo rpm -Uvh $ENV{'PBTMP'}/$bn","Adding package to setup repository");
    566566            }
Note: See TracChangeset for help on using the changeset viewer.