From f3b27dc1b28fd869d41152a838aa0ee59cb4d672 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 26 Sep 2007 09:58:44 +0000 Subject: throw exception on failure, not to delete files that can be copied because of lack of space (upstream commit 1398) --- lib/Youri/Submit/Action/Install.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Youri/Submit/Action/Install.pm b/lib/Youri/Submit/Action/Install.pm index c6ce573..c26ec47 100644 --- a/lib/Youri/Submit/Action/Install.pm +++ b/lib/Youri/Submit/Action/Install.pm @@ -43,11 +43,17 @@ sub run { unless ($self->{_test}) { # create destination dir if needed - system("install -d -m " . ($self->{_perms} + 111) . " $dest") - unless -d $dest; + if (! -d $dest) { + my $status = + system("install -d -m " . ($self->{_perms} + 111) . " $dest"); + croak "Unable to create directory $dest: $?" if $status; + } # install file to new location - system("install -m $self->{_perms} $file $dest/$rpm"); + my $status = + system("install -m $self->{_perms} $file $dest"); + croak "Unable to install file $file to $dest: $?" if $status; + my $arch = $package->get_arch(); $repository->set_arch_changed($target, $arch); $repository->set_install_dir_changed($dest); -- cgit v1.2.1