diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-09-11 08:56:46 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-09-11 08:56:46 +0000 |
commit | 9df41c80fe74a07f057e2f711649018748604e9e (patch) | |
tree | 63c63f2aba336c6ae8a427502347bb2da76e7ddd /urpm | |
parent | 180517d0747a14ef222e7ca6cfcf022275d31450 (diff) | |
download | urpmi-9df41c80fe74a07f057e2f711649018748604e9e.tar urpmi-9df41c80fe74a07f057e2f711649018748604e9e.tar.gz urpmi-9df41c80fe74a07f057e2f711649018748604e9e.tar.bz2 urpmi-9df41c80fe74a07f057e2f711649018748604e9e.tar.xz urpmi-9df41c80fe74a07f057e2f711649018748604e9e.zip |
move cleaning of cachedir out of selected2list()
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/get_pkgs.pm | 15 | ||||
-rw-r--r-- | urpm/main_loop.pm | 3 |
2 files changed, 10 insertions, 8 deletions
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; diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm index 12ff4291..b3eb5e0d 100644 --- a/urpm/main_loop.pm +++ b/urpm/main_loop.pm @@ -38,9 +38,10 @@ sub run { my ($auto_select, $no_install, $install_src, $clean, $noclean, $force, $parallel, $test, $env) = ($::auto_select, $::no_install, $::install_src, $::clean, $::noclean, $::force, $::parallel, $::test, $::env); + urpm::get_pkgs::clean_all_cache($urpm) if $clean; + my ($local_sources, $list) = urpm::get_pkgs::selected2list($urpm, $state->{selected}, - clean_all => $clean, clean_other => !$noclean && $urpm->{options}{'pre-clean'}, ); unless ($local_sources || $list) { |