diff options
-rw-r--r-- | perl-install/install/pkgs.pm | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm index 87ff120bb..c859fb880 100644 --- a/perl-install/install/pkgs.pm +++ b/perl-install/install/pkgs.pm @@ -842,18 +842,10 @@ sub _unselect_package { sub is_package_installed { my ($db, $pkg) = @_; my $check_installed; - my $done; - my $n=$pkg->name; $db->traverse_tag('name', [ $pkg->name ], sub { my ($p) = @_; - $done = 1; $check_installed ||= $pkg->compare_pkg($p) == 0; - log::l(">> ". $pkg->EVR . " vs ". $p->EVR. " --> check_installed=$check_installed\n"); - warn ">> ". $pkg->EVR . " vs ". $p->EVR. " --> check_installed=$check_installed\n"; - }); - my $real = `rpm -q $n`; - log::l("check_installed=0 for $n b/c pkg wasn't found in db VS $real") if !$done; return $check_installed; } @@ -873,21 +865,26 @@ sub _install_raw { log::l("rpm transactions start"); - my ($is_installing); + my ($is_installing, $verify_just_closed); my $exit_code = urpm::main_loop::run($packages, $packages->{state}, undef, undef, { - open_helper => sub { - my ($db, $packages, $type, $id) = @_; - log::l("OPENING (is_installing=$is_installing) ($db, $packages, $type, $id)\n"); - &$callback; - }, + open_helper => $callback, verify => sub { - my ($data, $cb_type, $pkg_id, $subtype, $amout, $total) = @_; - log::l("VERIFY($data, $cb_type, $pkg_id, $subtype, $amout, $total)\n"); + 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; + } }, close_helper => sub { - my ($db, $packages, $type, $id) = @_; - log::l("CLOSING (is_installing=$is_installing) ($db, $packages, $type, $id)\n"); + 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"; @@ -901,17 +898,7 @@ sub _install_raw { } else { log::l($pkg->name . " not installed, " . URPM::rpmErrorString()); } - }, inst => sub { - my ($data, $cb_type, $pkg_id, $subtype, $amout, $total) = @_; - log::l("INSTALL($data, $cb_type, $pkg_id, $subtype, $amout, $total)\n"); - #eg: * VERIFY(urpm=HASH(0x35cd608), verify, 17729, progress, 1, 51, ) - if ($subtype eq 'start') { - $is_installing = 1; - } elsif ($subtype eq 'stop') { - $is_installing = 0; - } - &$callback; - }, + }, inst => $callback, trans => $callback, # FIXME: implement already_installed_or_not_installable bad_signature => sub { |