summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-09-07 17:44:43 +0000
committerThierry Vignaud <tv@mageia.org>2012-09-07 17:44:43 +0000
commit3abc4f6f80dcbb791dee2c1c45712e4abc4ea814 (patch)
treeab8e971233f769ea70c30562f608a3f2348a13db
parent5029bcd01326d6aa4d4127a1a443531fe4cb635f (diff)
downloadurpmi-3abc4f6f80dcbb791dee2c1c45712e4abc4ea814.tar
urpmi-3abc4f6f80dcbb791dee2c1c45712e4abc4ea814.tar.gz
urpmi-3abc4f6f80dcbb791dee2c1c45712e4abc4ea814.tar.bz2
urpmi-3abc4f6f80dcbb791dee2c1c45712e4abc4ea814.tar.xz
urpmi-3abc4f6f80dcbb791dee2c1c45712e4abc4ea814.zip
(check_cache_dir) split it out of init_cache_dir() for mgaonline (mga#6083)
-rw-r--r--NEWS2
-rw-r--r--urpm.pm9
2 files changed, 9 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 4248f10a..4bd7835d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- add urpm::check_cache_dir() for mgaonline (mga#6083)
+
Version 7.7 - 5 September 2012
- use xz instead of lzma in order to read metadata
diff --git a/urpm.pm b/urpm.pm
index aa66c3bd..1fdcb875 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -102,13 +102,18 @@ sub prefer_rooted {
-e "$root$file" ? "$root$file" : $file;
}
+sub check_cache_dir {
+ my ($urpm, $dir) = @_;
+ -d $dir && ! -l $dir or $urpm->{fatal}(1, N("fail to create directory %s", $dir));
+ -o $dir && -w $dir or $urpm->{fatal}(1, N("invalid owner for directory %s", $dir));
+}
+
sub init_cache_dir {
my ($urpm, $dir) = @_;
mkdir $dir, 0755; # try to create it
- -d $dir && ! -l $dir or $urpm->{fatal}(1, N("fail to create directory %s", $dir));
- -o $dir && -w $dir or $urpm->{fatal}(1, N("invalid owner for directory %s", $dir));
+ check_cache_dir($urpm, $dir);
mkdir "$dir/partial";
mkdir "$dir/rpms";