summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-13 10:04:48 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-13 10:04:48 +0000
commit7bc61a82411b425ac3e7fee85cf236583099e687 (patch)
tree9e8f820d61128a3de523f2a8ee7b5cabadbc4df0 /urpm.pm
parent297793b46bb3cee25553f11adafd9691b52d0358 (diff)
downloadurpmi-7bc61a82411b425ac3e7fee85cf236583099e687.tar
urpmi-7bc61a82411b425ac3e7fee85cf236583099e687.tar.gz
urpmi-7bc61a82411b425ac3e7fee85cf236583099e687.tar.bz2
urpmi-7bc61a82411b425ac3e7fee85cf236583099e687.tar.xz
urpmi-7bc61a82411b425ac3e7fee85cf236583099e687.zip
create remove_obsolete_headers_in_cache out of update_media
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm40
1 files changed, 22 insertions, 18 deletions
diff --git a/urpm.pm b/urpm.pm
index 7abfd694..e9e6e39e 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1893,6 +1893,27 @@ sub _update_medium_second_pass {
$callback && $callback->('done', $medium->{name});
}
+sub remove_obsolete_headers_in_cache {
+ my ($urpm) = @_;
+ my %headers;
+ my $dh = $urpm->opendir_safe("$urpm->{cachedir}/headers");
+ if ($dh) {
+ local $_;
+ while (defined($_ = readdir $dh)) {
+ m|^([^/]*-[^-]*-[^-]*\.[^\.]*)(?::\S*)?$| and $headers{$1} = $_;
+ }
+ closedir $dh;
+ }
+ $urpm->{log}(N("found %d headers in cache", scalar(keys %headers)));
+ foreach (@{$urpm->{depslist}}) {
+ delete $headers{$_->fullname};
+ }
+ $urpm->{log}(N("removing %d obsolete headers in cache", scalar(keys %headers)));
+ foreach (values %headers) {
+ unlink "$urpm->{cachedir}/headers/$_";
+ }
+}
+
#- 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.
@@ -1952,25 +1973,8 @@ sub update_media {
#- useful according to the depslist.
if ($urpm->{modified}) {
if ($options{noclean}) {
- local $_;
- my %headers;
- my $dh = $urpm->opendir_safe("$urpm->{cachedir}/headers");
- if ($dh) {
- while (defined($_ = readdir $dh)) {
- m|^([^/]*-[^-]*-[^-]*\.[^\.]*)(?::\S*)?$| and $headers{$1} = $_;
- }
- closedir $dh;
- }
- $urpm->{log}(N("found %d headers in cache", scalar(keys %headers)));
- foreach (@{$urpm->{depslist}}) {
- delete $headers{$_->fullname};
- }
- $urpm->{log}(N("removing %d obsolete headers in cache", scalar(keys %headers)));
- foreach (values %headers) {
- unlink "$urpm->{cachedir}/headers/$_";
- }
+ remove_obsolete_headers_in_cache($urpm);
}
-
#- write config files in any case
$urpm->write_config;
dump_proxy_config();