summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm')
-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
4 files changed, 14 insertions, 9 deletions
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__