summaryrefslogtreecommitdiffstats
path: root/urpm/download.pm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm/download.pm')
-rw-r--r--urpm/download.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index c1b07820..fe6097dd 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -836,6 +836,21 @@ sub sync_url {
sync_rel($urpm, { url => dirname($url) }, [basename($url)], %options);
}
+sub sync_rel_to {
+ my ($urpm, $medium, $rel_file, $dest_file, %options) = @_;
+
+ my $download_dir = $options{dir} || "$urpm->{cachedir}/partial";
+ my $result_file = "$download_dir/" . basename($rel_file);
+
+ if (sync_rel($urpm, $medium, [$rel_file], %options)) {
+ $result_file ne $dest_file or rename($result_file, $dest_file) or return;
+ 1;
+ } else {
+ unlink $result_file;
+ undef;
+ }
+}
+
#- deprecated, use sync_url() or sync_rel() instead
#-
#- $medium can be undef