diff options
author | Marcelo Leitner <mrl@mandriva.com> | 2007-06-25 17:44:03 +0000 |
---|---|---|
committer | Marcelo Leitner <mrl@mandriva.com> | 2007-06-25 17:44:03 +0000 |
commit | 96b2a46bf03035920e73597af096516830e65ae8 (patch) | |
tree | c1b722904bd827212ea2168809f13831d7a17494 /lib | |
parent | 968d3027f5d0c1b8b57706504e5b7a173a59684f (diff) | |
download | iurt-96b2a46bf03035920e73597af096516830e65ae8.tar iurt-96b2a46bf03035920e73597af096516830e65ae8.tar.gz iurt-96b2a46bf03035920e73597af096516830e65ae8.tar.bz2 iurt-96b2a46bf03035920e73597af096516830e65ae8.tar.xz iurt-96b2a46bf03035920e73597af096516830e65ae8.zip |
- Protect the cache against empty medias, as current iurt command handler will
abort the whole thing if add_media fails.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Urpmi.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index 259b81e..00e4a12 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -113,6 +113,7 @@ sub urpmi_command { foreach my $m (@{$run->{additional_media}{media}}) { my $name = "$run->{additional_media}{repository}_$m"; $name =~ s![/:]!_!g; + my $url; if (($run->{additional_media}{repository} =~ m!^(http:|ftp:)!)) { $url = $run->{additional_media}{repository}; @@ -120,6 +121,16 @@ sub urpmi_command { else { $url = "/urpmi_medias/$run->{distro}/$m"; } + + # Check if the media is not empty, as add_media will abort if it fails + opendir (my $DP, $url) or next; + my @contents = readdir $DP; + close ($DP); + if ($#contents <= 1) { + # Just entries: . .. + continue; + } + if (!add_media($self, $chroot_tmp, $name, "$name $url")) { plog("ERROR: Unable to add media $m"); } |