diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-10-15 17:12:03 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-10-15 17:12:03 +0000 |
commit | 64f60e96cd8b895cfd908d030d5e6d482b53b98f (patch) | |
tree | c3c38c120ff99a6aa547f1bd410bf23e08b19f0e /urpm.pm | |
parent | 6381a6079098697ddaba5ff6810a2e87658bca26 (diff) | |
download | urpmi-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.pm | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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)) { |