From 3458ddbbc94d2a2c5d016e3bac1d14af4b7e8a62 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 15 Mar 2020 12:02:59 +0000 Subject: installer: fix tracking of installed packages (mga#26284) The installer keeps a record of the packages that have been installed, but was not recording the first package in each transaction. If an affected package was selected in a later step, the installer would attempt to reinstall it. With the latest rpm, this results in a fatal error. --- perl-install/install/pkgs.pm | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'perl-install/install/pkgs.pm') diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm index 91a57c2cf..2fcd0eccc 100644 --- a/perl-install/install/pkgs.pm +++ b/perl-install/install/pkgs.pm @@ -868,24 +868,14 @@ sub _install_raw { my ($is_installing, $verify_just_closed); my $exit_code = urpm::main_loop::run($packages, $packages->{state}, undef, undef, { - open_helper => $callback, - verify => sub { - my ($_data, $_cb_type, $_pkg_id, $subtype, $_amout, $_total, $_pkg_name) = @_; - if ($subtype eq 'start') { - $is_installing = 0; - } elsif ($subtype eq 'stop') { - $is_installing = 1; - $verify_just_closed = 1; - } - }, + open_helper => sub { + &$callback; + $is_installing = 0; + }, + verify => $callback, close_helper => sub { my ($db, $packages, $_type, $id) = @_; &$callback; - # ignore first close after end of verify: - if ($is_installing && $verify_just_closed) { - undef $verify_just_closed; - return; - } return if !$is_installing; # don't check if it's installed if it's being verified my $pkg = defined $id && $packages->{depslist}[$id] or return; print $LOG $pkg->fullname . "\n"; @@ -899,7 +889,11 @@ sub _install_raw { } else { log::l($pkg->name . " not installed, " . URPM::rpmErrorString()); } - }, inst => $callback, + }, + inst => sub { + &$callback; + $is_installing = 1; + }, trans => $callback, # FIXME: implement already_installed_or_not_installable bad_signature => sub { -- cgit v1.2.1