summaryrefslogtreecommitdiffstats
path: root/urpm/get_pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-24 10:58:31 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-24 10:58:31 +0000
commit52734f88a237a83a09e9fda07ddd14606a71e062 (patch)
tree5c4688779cfa5ae799a5ae35a2a7c8e7aeeabe18 /urpm/get_pkgs.pm
parentaaf182ce4dd27e7ab847e8cf35f1e97210c07be2 (diff)
downloadurpmi-52734f88a237a83a09e9fda07ddd14606a71e062.tar
urpmi-52734f88a237a83a09e9fda07ddd14606a71e062.tar.gz
urpmi-52734f88a237a83a09e9fda07ddd14606a71e062.tar.bz2
urpmi-52734f88a237a83a09e9fda07ddd14606a71e062.tar.xz
urpmi-52734f88a237a83a09e9fda07ddd14606a71e062.zip
display a "bad rpms" message instead of "files are missing" when the downloaded rpm is bad.
this adds a new callback for rpmdrake: "bad_rpms" this modifies the API of urpm::get_pkgs::download_packages_of_distant_media ($error_sources is now { url => reason } instead of { id => url })
Diffstat (limited to 'urpm/get_pkgs.pm')
-rw-r--r--urpm/get_pkgs.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index b6a792dc..4bda4e99 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -110,6 +110,8 @@ sub selected2list {
sub download_packages_of_distant_media {
my ($urpm, $list, $sources, $error_sources, %options) = @_;
+ my %errors;
+
#- get back all ftp and http accessible rpm files into the local cache
foreach my $n (0..$#$list) {
my %distant_sources;
@@ -126,7 +128,7 @@ sub download_packages_of_distant_media {
if (-r $local_file) {
$sources->{$i} = $local_file;
} else {
- $error_sources->{$i} = $local_file;
+ $errors{$i} = [ $local_file, 'missing' ];
}
} elsif ($url =~ m!^([^:]*):/(.*/([^/]*\.rpm))\Z!) {
$distant_sources{$i} = "$1:/$2"; #- will download now
@@ -165,22 +167,27 @@ sub download_packages_of_distant_media {
#- present the error to the user.
foreach my $i (keys %distant_sources) {
my ($filename) = $distant_sources{$i} =~ m|/([^/]*\.rpm)$|;
- if ($filename && -s "$partial_dir/$filename" &&
- URPM::verify_rpm("$partial_dir/$filename", nosignatures => 1))
- {
- #- it seems the the file has been downloaded correctly and has been checked to be valid.
- unlink "$rpms_dir/$filename";
- urpm::sys::move_or_die($urpm, "$partial_dir/$filename", "$rpms_dir/$filename");
- $sources->{$i} = "$rpms_dir/$filename";
+ if ($filename && -s "$partial_dir/$filename") {
+ if (URPM::verify_rpm("$partial_dir/$filename", nosignatures => 1)) {
+ #- it seems the the file has been downloaded correctly and has been checked to be valid.
+ unlink "$rpms_dir/$filename";
+ urpm::sys::move_or_die($urpm, "$partial_dir/$filename", "$rpms_dir/$filename");
+ $sources->{$i} = "$rpms_dir/$filename";
+ } else {
+ unlink "$partial_dir/$filename";
+ $errors{$i} = [ $distant_sources{$i}, 'bad' ];
+ }
} else {
- $error_sources->{$i} = $distant_sources{$i};
+ $errors{$i} = [ $distant_sources{$i}, 'missing' ];
}
}
}
}
#- clean failed download which have succeeded.
- delete @$error_sources{keys %$sources};
+ delete @$errors{keys %$sources};
+
+ %$error_sources = map { @$_ } values %errors;
1;
}