diff options
author | Thierry Vignaud <tv@mandriva.org> | 2009-03-24 15:35:06 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2009-03-24 15:35:06 +0000 |
commit | 9b42b44628726615fafe2b7e145cf73acc7cdd66 (patch) | |
tree | f84e98694ca11918f0eed85d88daf6a800951b14 /urpm/install.pm | |
parent | 6869cdfc8f0f579c0cc1b110bdcad2a5e23e973b (diff) | |
download | urpmi-9b42b44628726615fafe2b7e145cf73acc7cdd66.tar urpmi-9b42b44628726615fafe2b7e145cf73acc7cdd66.tar.gz urpmi-9b42b44628726615fafe2b7e145cf73acc7cdd66.tar.bz2 urpmi-9b42b44628726615fafe2b7e145cf73acc7cdd66.tar.xz urpmi-9b42b44628726615fafe2b7e145cf73acc7cdd66.zip |
(install) fix a circular reference that was causing rpmdb to be opened
many times in installer
(regression introduced in r253510 when adding new callbacks for the installer)
Diffstat (limited to 'urpm/install.pm')
-rw-r--r-- | urpm/install.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/urpm/install.pm b/urpm/install.pm index c57688b6..4faab2db 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -224,17 +224,21 @@ sub install { my $fh; #- assume default value for some parameter. $options{delta} ||= 1000; + + #- ensure perl does not create a circular reference below, otherwise all this won't be collected, + # and rpmdb won't be closed: + my ($callback_open_helper, $callback_close_helper) = ($options{callback_open_helper}, $options{callback_close_helper}); $options{callback_open} = sub { my ($_data, $_type, $id) = @_; $index++; - $options{callback_open_helper} and $options{callback_open_helper}->(@_); + $callback_open_helper and $callback_open_helper->(@_); $fh = urpm::sys::open_safe($urpm, '<', $install->{$id} || $upgrade->{$id}); $fh ? fileno $fh : undef; }; $options{callback_close} = sub { my ($urpm, undef, $pkgid) = @_; return unless defined $pkgid; - $options{callback_close_helper} and $options{callback_close_helper}->($db, @_); + $callback_close_helper and $callback_close_helper->($db, @_); get_README_files($urpm, $trans, $urpm->{depslist}[$pkgid]); close $fh if defined $fh; }; |