summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-10-15 17:12:03 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-10-15 17:12:03 +0000
commit64f60e96cd8b895cfd908d030d5e6d482b53b98f (patch)
treec3c38c120ff99a6aa547f1bd410bf23e08b19f0e /urpm.pm
parent6381a6079098697ddaba5ff6810a2e87658bca26 (diff)
downloadurpmi-64f60e96cd8b895cfd908d030d5e6d482b53b98f.tar
urpmi-64f60e96cd8b895cfd908d030d5e6d482b53b98f.tar.gz
urpmi-64f60e96cd8b895cfd908d030d5e6d482b53b98f.tar.bz2
urpmi-64f60e96cd8b895cfd908d030d5e6d482b53b98f.tar.xz
urpmi-64f60e96cd8b895cfd908d030d5e6d482b53b98f.zip
allow to define the cache directory for RPMs when setting --download-all
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm21
1 files changed, 13 insertions, 8 deletions
diff --git a/urpm.pm b/urpm.pm
index ee0fb519..44b1ed16 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -99,15 +99,9 @@ sub prefer_rooted {
-e "$root$file" ? "$root$file" : $file;
}
-sub userdir_prefix {
- my ($_urpm) = @_;
- '/tmp/.urpmi-';
-}
-sub userdir {
- my ($urpm) = @_;
- $< or return;
+sub init_cache_dir {
+ my ($urpm, $dir) = @_;
- my $dir = ($urpm->{urpmi_root} || '') . userdir_prefix($urpm) . $<;
mkdir $dir, 0755; # try to create it
-d $dir && ! -l $dir or $urpm->{fatal}(1, N("fail to create directory %s", $dir));
@@ -118,6 +112,17 @@ sub userdir {
$dir;
}
+sub userdir_prefix {
+ my ($_urpm) = @_;
+ '/tmp/.urpmi-';
+}
+sub userdir {
+ my ($urpm) = @_;
+ $< or return;
+
+ my $dir = ($urpm->{urpmi_root} || '') . userdir_prefix($urpm) . $<;
+ init_cache_dir($$urpm, $dir);
+}
sub ensure_valid_cachedir {
my ($urpm) = @_;
if (my $dir = userdir($urpm)) {