summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-22 15:18:58 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-22 15:18:58 +0000
commit7c16df1327b2d9e01fc27bf78aa355dd9b273a4d (patch)
tree2ff39755a6c4c580343ba167477ad19e5ca52341 /urpm
parentb1a2665d555a370184f3ebb6fa0b1de4c0ac92f0 (diff)
downloadurpmi-7c16df1327b2d9e01fc27bf78aa355dd9b273a4d.tar
urpmi-7c16df1327b2d9e01fc27bf78aa355dd9b273a4d.tar.gz
urpmi-7c16df1327b2d9e01fc27bf78aa355dd9b273a4d.tar.bz2
urpmi-7c16df1327b2d9e01fc27bf78aa355dd9b273a4d.tar.xz
urpmi-7c16df1327b2d9e01fc27bf78aa355dd9b273a4d.zip
get_content() as a wrapper around sync() to get file content
Diffstat (limited to 'urpm')
-rw-r--r--urpm/download.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index fce2bf5e..2d2ee2e1 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -741,6 +741,21 @@ sub sync {
};
}
+sub get_content {
+ my ($urpm, $url) = @_;
+
+ my $file = "$urpm->{cachedir}/partial/" . basename($url);
+
+ unlink $file; # prevent "partial file" errors
+ urpm::download::sync($urpm, undef, [ $url ]) or return;
+
+ my @l = cat_($file);
+ unlink $file;
+
+ wantarray ? @l : join('', @l);
+}
+
+
#- syncing algorithms.
sub _sync_webfetch_raw {
my ($urpm, $files, $options) = @_;