- Timestamp:
- May 24, 2012, 10:54:48 AM (12 years ago)
- Location:
- devel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Base.pm
r1592 r1595 137 137 The first parameter is the shell command to call. This command should NOT use redirections. 138 138 The 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. 139 The 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. 141 140 This function returns as a result the return value of the system command. 142 141 … … 150 149 my $cmt=shift || $cmd; 151 150 my $verbose=shift || undef; 152 my $failure_ok = shift || 0;153 151 my $redir = ""; 154 152 … … 177 175 178 176 if (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)); 180 178 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) { 182 180 confess "error running command ($cmd) with cwd=$cwd, pid=$$"; 183 181 } -
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r1553 r1595 336 336 # This may not be // proof. We should test for availability of repo and sleep if not 337 337 my $cmd = "$pbos->{'install'} $deps"; 338 my $ret = pb_system($cmd, "Installing dependencies ($cmd)", undef,1);338 my $ret = pb_system($cmd, "Installing dependencies ($cmd)","mayfail"); 339 339 # Try to accomodate deficient proxies 340 340 if ($ret != 0) { … … 446 446 next if $p =~ /^\s*$/o; 447 447 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"); 449 449 next if ($res eq 0); 450 450 pb_log(1, "INFO: missing dependency $p\n"); 451 451 } elsif ($pbos->{'type'} eq "deb") { 452 my $res = pb_system("dpkg -L $p",""," quiet",1);452 my $res = pb_system("dpkg -L $p","","mayfail"); 453 453 next if ($res eq 0); 454 454 open(CMD,"dpkg -l $p |") or die "Unable to run dpkg -l $p: $!"; … … 562 562 my $pn = $bn; 563 563 $pn =~ s/\.rpm//; 564 if (pb_system("rpm -q --quiet $pn",""," quiet",1) != 0) {564 if (pb_system("rpm -q --quiet $pn","","mayfail") != 0) { 565 565 pb_system("sudo rpm -Uvh $ENV{'PBTMP'}/$bn","Adding package to setup repository"); 566 566 } -
devel/pb/bin/pb
r1594 r1595 1751 1751 $cmd .= " $chkopt" if (defined $chkopt); 1752 1752 $cmd .= " $made"; 1753 my $ret = pb_system("$cmd","Checking validity of rpms with $chkcmd"," verbose",1);1753 my $ret = pb_system("$cmd","Checking validity of rpms with $chkcmd","mayfail"); 1754 1754 pb_log(0,"ERROR: when checking packages validity\n") if ($ret ne 0); 1755 1755 } … … 1768 1768 } 1769 1769 if (-x $chkcmd) { 1770 my $ret = pb_system("$chkcmd $chkopt $made2","Checking validity of debs with $chkcmd"," verbose",1);1770 my $ret = pb_system("$chkcmd $chkopt $made2","Checking validity of debs with $chkcmd","mayfail"); 1771 1771 pb_log(0,"ERROR: when checking packages validity\n") if ($ret ne 0); 1772 1772 } … … 2279 2279 my $ftpput = pb_check_req("ncftpput",1); 2280 2280 my $ftpget = pb_check_req("wget",1); 2281 my ($cpanuser,$cpanpasswd) = pb_conf_get("cpanuser","cpanpasswd"); 2281 my ($cpanuser,$cpanpasswd) = pb_conf_get_if("cpanuser","cpanpasswd"); 2282 return if ((not defined $cpanuser) || (not defined $cpanuser->{$ENV{'PBPROJ'}})); 2283 return if ((not defined $cpanpasswd) || (not defined $cpanpasswd->{$ENV{'PBPROJ'}})); 2282 2284 my ($cpansubdir) = pb_conf_get_if("cpansubdir"); 2283 $shcmd = "$ftpget --post-data \'HIDDENNAME=".$cpanuser ;2284 $shcmd .= "&user=".$cpanuser ;2285 $shcmd .= "&password=".$cpanpasswd ;2285 $shcmd = "$ftpget --post-data \'HIDDENNAME=".$cpanuser->{$ENV{'PBPROJ'}}; 2286 $shcmd .= "&user=".$cpanuser->{$ENV{'PBPROJ'}}; 2287 $shcmd .= "&password=".$cpanpasswd->{$ENV{'PBPROJ'}}; 2286 2288 $shcmd .= "&SUBMIT_pause99_add_uri_upload=\"Upload the checked files\""; 2287 $shcmd .= "&pause99_add_uri_subdirtext=".$cpansubdir if (defined $cpansubdir);2289 $shcmd .= "&pause99_add_uri_subdirtext=".$cpansubdir->{$ENV{'PBPROJ'}} if ((defined $cpansubdir) && (defined $cpansubdir->{$ENV{'PBPROJ'}})); 2288 2290 foreach my $s (split(/ /,$src)) { 2289 2291 $shcmd .= "&pause99_add_uri_upload=".basename($s); … … 2316 2318 # For VE we need to change the owner manually 2317 2319 if ($cmt =~ /^VE/) { 2318 if (defined $shcmdroot) { 2319 # This should help overcome a CentOS 5.8 bug as well as having a simper sequence 2320 pb_system("$shcmdroot chown -R $mac $tdir","Adapt owner in $tdir to $mac"); 2321 } else { 2322 pb_system("$shcmd \"sudo chown -R $mac $tdir\"","Adapt owner in $tdir to $mac"); 2323 } 2320 pb_system("$shcmdroot sed -i '/requiretty/d' /etc/sudoers","Removing potential requiretty in sudoers"); 2321 pb_system("$shcmd \"sudo chown -R $mac $tdir\"","Adapt owner in $tdir to $mac"); 2324 2322 } 2325 2323 … … 2631 2629 pb_system("$cmd &","Launching the VM $vmm"); 2632 2630 # Using system allows to kill it externaly if needed,sosupport that in the call 2633 pb_system("sleep $ENV{'PBVMTMOUT'}","Waiting $ENV{'PBVMTMOUT'} s for VM $v to come up", undef,1);2631 pb_system("sleep $ENV{'PBVMTMOUT'}","Waiting $ENV{'PBVMTMOUT'} s for VM $v to come up","mayfail"); 2634 2632 $vmpid = pb_check_ps($tmpcmd,$vmm); 2635 2633 pb_log(0,"VM $vmm launched (pid $vmpid)\n"); … … 4331 4329 } 4332 4330 my $debsigncmd = pb_check_req("debsign",1); 4333 pb_system("$debsigncmd -m\'$ENV{'PBPACKAGER'}\' $changes","Signing DEB packages", undef,1) if (($changes ne "") && (defined $debsigncmd));4331 pb_system("$debsigncmd -m\'$ENV{'PBPACKAGER'}\' $changes","Signing DEB packages","mayfail") if (($changes ne "") && (defined $debsigncmd)); 4334 4332 } else { 4335 4333 pb_log(0,"I don't know yet how to sign packages for type $pbos->{'type'}.\nPlease give feedback to dev team\n"); -
devel/pb/t/pbtest
r1594 r1595 59 59 sudocmd "killall -u pbtest" 60 60 sudocmd "userdel pbtest" 61 sudocmd "groupdel pbtest" 61 #sudocmd "groupdel pbtest" 1 62 62 sudocmd "useradd pbtest" 63 63 sudocmd "grep -q pbtest /etc/sudoers" -
devel/rpmbootstrap/bin/rpmbootstrap
r1564 r1595 514 514 pb_system("chroot $vepath /bin/bash -c \"yes | /usr/bin/zypper sa $baseurl $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper"); 515 515 } else { 516 pb_system("chroot $vepath /bin/bash -c \"/usr/bin/zypper rr $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper", undef,1); # don't care if remove fails if add succeeds.516 pb_system("chroot $vepath /bin/bash -c \"/usr/bin/zypper rr $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper","mayfail"); # don't care if remove fails if add succeeds. 517 517 pb_system("chroot $vepath /bin/bash -c \"/usr/bin/zypper ar $baseurl $pbos->{'name'}-$pbos->{'version'}\"","Bootstrapping Zypper"); 518 518 }
Note:
See TracChangeset
for help on using the changeset viewer.