diff options
Diffstat (limited to 'Rpmdrake')
-rw-r--r-- | Rpmdrake/pkg.pm | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 112d3457..80492eb4 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -316,7 +316,6 @@ sub get_installed_packages { # Queue of base capabilities my @base_capabilities = ("basesystem", split /,\s*/, $urpm->{global_config}{'prohibit-remove'}); - my @installed_pkgs; my %providers; reset_pbar_count(0.33); while (my $dep = shift @base_capabilities) { @@ -324,29 +323,20 @@ sub get_installed_packages { # URPM::Package::requires_nosense may return version info at the end of # dependency name $dep =~ s/(.+)\[.+\]$/\1/; - next if exists $providers{$dep}; + my $tag = ( $dep =~ m|^/| ) ? 'path' : 'whatprovides'; my $n; $n = $db->traverse_tag($tag, [ $dep ], sub { my $pkg = shift @_; my $name = urpm_name($pkg); unless ($all_pkgs->{$name}) { - $all_pkgs->{$name} = { - selected => 0, - pkg => $pkg, - urpm_name => $name, - base => \$n - }; - push @installed_pkgs, $name; + $all_pkgs->{$name}{base} = \$n; push @{$providers{$dep}}, $name; push @base_capabilities, $pkg->requires_nosense; update_pbar($gurpm); } }); - for (@{$providers{$dep}}) { - $all_pkgs->{$_}{pkg}->set_flag_base(1) if $n == 1; - } } # Search for all other installed packages (costly operation). @@ -355,21 +345,20 @@ sub get_installed_packages { my $pkg = shift @_; my $name = urpm_name($pkg); update_pbar($gurpm); - unless ($name =~ /@/ or $all_pkgs->{$name}) { - $all_pkgs->{$name} = { - selected => 0, - pkg => $pkg, - urpm_name => $name, - } unless ($all_pkgs->{$name} && - $all_pkgs->{$name}{description}); - - push @installed_pkgs, $name; + unless ($name =~ /@/) { # FIXME Why check for @ in package names? + $all_pkgs->{$name}{selected} = 0; + $all_pkgs->{$name}{pkg} = $pkg; + $all_pkgs->{$name}{urpm_name} => $name; + + if (my $n = $all_pkgs->{$name}{base}) { + $pkg->set_flag_base if $$n == 1; + } # Needed in order to call methods on objects outside ->traverse $pkg->pack_header; } }); - @installed_pkgs; + keys %$all_pkgs; } urpm::select::add_packages_to_priority_upgrade_list('rpmdrake'); |