From 9df41c80fe74a07f057e2f711649018748604e9e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 11 Sep 2007 08:56:46 +0000 Subject: move cleaning of cachedir out of selected2list() --- urpm/get_pkgs.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'urpm/get_pkgs.pm') diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index 268bb212..944aaf62 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -9,6 +9,14 @@ use urpm::media; use urpm 'file_from_local_url'; +sub clean_all_cache { + my ($urpm) = @_; + #- clean download directory, do it here even if this is not the best moment. + $urpm->{log}(N("cleaning %s and %s", "$urpm->{cachedir}/partial", "$urpm->{cachedir}/rpms")); + urpm::sys::clean_dir("$urpm->{cachedir}/partial"); + urpm::sys::clean_dir("$urpm->{cachedir}/rpms"); +} + #- select sources for selected packages, #- according to keys of the packages hash. #- returns a list of lists containing the source description for each rpm, @@ -36,13 +44,6 @@ sub selected2list { $file2fullnames{$pkg->filename}{$pkg->fullname} = undef; } - if ($options{clean_all}) { - #- clean download directory, do it here even if this is not the best moment. - $urpm->{log}(N("cleaning %s and %s", "$urpm->{cachedir}/partial", "$urpm->{cachedir}/rpms")); - urpm::sys::clean_dir("$urpm->{cachedir}/partial"); - urpm::sys::clean_dir("$urpm->{cachedir}/rpms"); - } - #- examine the local repository, which is trusted (no gpg or pgp signature check but md5 is now done). foreach my $filepath (glob("$urpm->{cachedir}/rpms/*")) { next if -d $filepath; -- cgit v1.2.1