From 3ec10907cdac80d0d8ddacd7596cf9df40b0af40 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 13 Nov 2006 09:32:16 +0000 Subject: create clean_dir() out of get_source_packages --- urpm.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/urpm.pm b/urpm.pm index a3fa2b8b..392207f2 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1202,6 +1202,15 @@ sub recursive_find_rpm_files { keys %f; } +sub clean_dir { + my ($dir) = @_; + + require File::Path; + File::Path::rmtree([$dir]); + mkdir $dir, 0755; +} + + #- Update the urpmi database w.r.t. the current configuration. #- Takes care of modifications, and tries some tricks to bypass #- the recomputation of base files. @@ -2404,11 +2413,7 @@ sub get_source_packages { } #- clean download directory, do it here even if this is not the best moment. - if ($options{clean_all}) { - require File::Path; - File::Path::rmtree(["$urpm->{cachedir}/partial"]); - mkdir "$urpm->{cachedir}/partial", 0755; - } + clean_dir("$urpm->{cachedir}/partial") if $options{clean_all}; foreach my $medium (@{$urpm->{media} || []}) { my (%sources, %list_examined, $list_warning); -- cgit v1.2.1