summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-24 10:20:09 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-24 10:20:09 +0000
commita3ebda940b2d75d0a28e4b250ce6a23de06f9bba (patch)
tree1f04c7a5af27384c3b084213e014b91b5551b30e
parent5e1c20f181fac8df0636ecd04b24832ddb6cbc27 (diff)
downloadurpmi-a3ebda940b2d75d0a28e4b250ce6a23de06f9bba.tar
urpmi-a3ebda940b2d75d0a28e4b250ce6a23de06f9bba.tar.gz
urpmi-a3ebda940b2d75d0a28e4b250ce6a23de06f9bba.tar.bz2
urpmi-a3ebda940b2d75d0a28e4b250ce6a23de06f9bba.tar.xz
urpmi-a3ebda940b2d75d0a28e4b250ce6a23de06f9bba.zip
- urpmi, urpmi.addmedia, urpmi.update:
o have fatal errors on some errors that must not happen (eg: moving rpm from download dir to cachedir)
-rw-r--r--NEWS3
-rw-r--r--urpm/get_pkgs.pm4
-rw-r--r--urpm/media.pm10
-rw-r--r--urpm/removable.pm4
-rw-r--r--urpm/sys.pm5
5 files changed, 17 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 189fc99e..1311bdd3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
- urpmf:
o fix mirrorlist handling
+- urpmi, urpmi.addmedia, urpmi.update:
+ o have fatal errors on some errors that must not happen (eg: moving rpm from
+ download dir to cachedir)
Version 5.5 - 23 February 2008, by Pascal "Pixel" Rigaux
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index cc8d41af..7ed81ce6 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -170,8 +170,8 @@ sub download_packages_of_distant_media {
{
#- it seems the the file has been downloaded correctly and has been checked to be valid.
unlink "$rpms_dir/$filename";
- urpm::util::move("$partial_dir/$filename", "$rpms_dir/$filename");
- -r "$rpms_dir/$filename" and $sources->{$i} = "$rpms_dir/$filename";
+ urpm::sys::move_or_die($urpm, "$partial_dir/$filename", "$rpms_dir/$filename");
+ $sources->{$i} = "$rpms_dir/$filename";
}
unless ($sources->{$i}) {
$error_sources->{$i} = $distant_sources{$i};
diff --git a/urpm/media.pm b/urpm/media.pm
index 93b84628..6aff6977 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -1153,14 +1153,14 @@ sub get_descriptions_remote {
unlink "$urpm->{cachedir}/partial/descriptions";
if (-e statedir_descriptions($urpm, $medium)) {
- urpm::util::move(statedir_descriptions($urpm, $medium), "$urpm->{cachedir}/partial/descriptions");
+ urpm::sys::move_or_die($urpm, statedir_descriptions($urpm, $medium), "$urpm->{cachedir}/partial/descriptions");
}
urpm::download::sync($urpm, $medium, [ reduce_pathname("$medium->{url}/media_info/descriptions") ], quiet => 1)
or #- try older location
urpm::download::sync($urpm, $medium, [ reduce_pathname("$medium->{url}/../descriptions") ], quiet => 1);
if (-e "$urpm->{cachedir}/partial/descriptions") {
- urpm::util::move("$urpm->{cachedir}/partial/descriptions", statedir_descriptions($urpm, $medium));
+ urpm::sys::move_or_die($urpm, "$urpm->{cachedir}/partial/descriptions", statedir_descriptions($urpm, $medium));
}
}
sub get_synthesis__local {
@@ -1486,12 +1486,12 @@ sub _update_medium_ {
#- use new files
unlink statedir_synthesis($urpm, $medium);
- urpm::util::move(cachedir_with_synthesis($urpm, $medium),
- statedir_synthesis($urpm, $medium));
+ urpm::sys::move_or_die($urpm, cachedir_with_synthesis($urpm, $medium),
+ statedir_synthesis($urpm, $medium));
unlink statedir_MD5SUM($urpm, $medium);
if (!$medium->{with_synthesis}) { # no MD5SUM when using with_synthesis, urpmi.update will update everytime!
- urpm::util::move("$urpm->{cachedir}/partial/MD5SUM",
+ urpm::sys::move_or_die($urpm, "$urpm->{cachedir}/partial/MD5SUM",
statedir_MD5SUM($urpm, $medium)) if -e "$urpm->{cachedir}/partial/MD5SUM";
}
diff --git a/urpm/removable.pm b/urpm/removable.pm
index 1ebad613..f215bf84 100644
--- a/urpm/removable.pm
+++ b/urpm/removable.pm
@@ -134,8 +134,8 @@ sub copy_packages_of_removable_media {
{
#- now we can consider the file to be fine.
unlink "$urpm->{cachedir}/rpms/$filename";
- urpm::util::move("$urpm->{cachedir}/partial/$filename", "$urpm->{cachedir}/rpms/$filename");
- -r "$urpm->{cachedir}/rpms/$filename" and $sources->{$i} = "$urpm->{cachedir}/rpms/$filename";
+ urpm::sys::move_or_die($urpm, "$urpm->{cachedir}/partial/$filename", "$urpm->{cachedir}/rpms/$filename");
+ $sources->{$i} = "$urpm->{cachedir}/rpms/$filename";
}
}
unless ($sources->{$i}) {
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 6d2cdec1..91c38b06 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -229,6 +229,11 @@ sub opendir_safe {
return $d;
}
+sub move_or_die {
+ my ($urpm, $file, $dest) = @_;
+ urpm::util::move($file, $dest) or $urpm->{fatal}(1, N("Can't move file %s to %s", $file, $dest));
+}
+
1;
__END__