diff options
Diffstat (limited to 'iurt')
-rwxr-xr-x | iurt | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -929,15 +929,24 @@ retry: system("rm -rf $local_spool/log/$srpm/"); } elsif (!$run{discard_packages}) { plog('OK', "build successful, copying packages to $local_spool."); - - system("cp $chroot_tmp/home/$luser/rpmbuild/RPMS/*/*.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpmbuild/RPMS/ to $local_spool ($!)"); + if (system("cp $chroot_tmp/home/$luser/rpmbuild/RPMS/*/*.rpm $local_spool &>/dev/null")) { + # If copy fails (like disk full), report a failure and delete partially copied files + for my $package (@packages) { + unlink "$local_spool/$package"; + } + plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpmbuild/RPMS/ to $local_spool ($!)"); + } } if ($run{copy_srpm}) { # replace the old srpm unlink "$local_spool/$old_srpm"; - system("cp $chroot_tmp/home/$luser/rpmbuild/SRPMS/$srpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpmbuild/SRPMS/ to $local_spool ($!)"); + if (system("cp $chroot_tmp/home/$luser/rpmbuild/SRPMS/$srpm $local_spool &>/dev/null")) { + # If copy fails (like disk full), remove partially copied file and report a failure + unlink "$local_spool/$srpm"; + plog('ERROR', "ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpmbuild/SRPMS/ to $local_spool ($!)"); + } } process_queue($config, \%run, \@wrong_rpm, 1); } |