summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-26 20:06:43 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-26 20:06:43 +0000
commitf5c9e895354f331843c53b97c5695ffa6c2c5b52 (patch)
treecf2b002cdf66d74d0deea6ba32b9e2c8b2f00cc1
parent7083a98724d108d5865eb0c6985993dd52622870 (diff)
downloadurpmi-f5c9e895354f331843c53b97c5695ffa6c2c5b52.tar
urpmi-f5c9e895354f331843c53b97c5695ffa6c2c5b52.tar.gz
urpmi-f5c9e895354f331843c53b97c5695ffa6c2c5b52.tar.bz2
urpmi-f5c9e895354f331843c53b97c5695ffa6c2c5b52.tar.xz
urpmi-f5c9e895354f331843c53b97c5695ffa6c2c5b52.zip
create verify_partial_rpm_and_move() out of
download_packages_of_distant_media()
-rw-r--r--urpm/get_pkgs.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index 1b44710f..401ccbad 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -105,6 +105,17 @@ sub selected2list {
(\%local_sources, \@list);
}
+sub verify_partial_rpm_and_move {
+ my ($urpm, $cachedir, $filename) = @_;
+
+ URPM::verify_rpm("$cachedir/partial/$filename", nosignatures => 1) or return;
+
+ #- it seems the the file has been downloaded correctly and has been checked to be valid.
+ unlink "$cachedir/rpms/$filename";
+ urpm::sys::move_or_die($urpm, "$cachedir/partial/$filename", "$cachedir/rpms/$filename");
+ 1;
+}
+
# TODO verify that files are downloaded from the right corresponding media
#- options: quiet, callback,
sub download_packages_of_distant_media {
@@ -166,10 +177,7 @@ sub download_packages_of_distant_media {
foreach my $i (keys %distant_sources) {
my ($filename) = $distant_sources{$i} =~ m|/([^/]*\.rpm)$|;
if ($filename && -s "$cachedir/partial/$filename") {
- if (URPM::verify_rpm("$cachedir/partial/$filename", nosignatures => 1)) {
- #- it seems the the file has been downloaded correctly and has been checked to be valid.
- unlink "$cachedir/rpms/$filename";
- urpm::sys::move_or_die($urpm, "$cachedir/partial/$filename", "$cachedir/rpms/$filename");
+ if (verify_partial_rpm_and_move($urpm, $cachedir, $filename)) {
$sources->{$i} = "$cachedir/rpms/$filename";
} else {
unlink "$cachedir/partial/$filename";