diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 20:47:36 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 20:47:36 +0000 |
commit | dbb4b2aa0171758725dd8f35279f4d2c176a8f5d (patch) | |
tree | e6814d1b107af994171cd9300ed850ba36d673df | |
parent | c617573f7ca65da803615991419db926420f22b1 (diff) | |
download | urpmi-dbb4b2aa0171758725dd8f35279f4d2c176a8f5d.tar urpmi-dbb4b2aa0171758725dd8f35279f4d2c176a8f5d.tar.gz urpmi-dbb4b2aa0171758725dd8f35279f4d2c176a8f5d.tar.bz2 urpmi-dbb4b2aa0171758725dd8f35279f4d2c176a8f5d.tar.xz urpmi-dbb4b2aa0171758725dd8f35279f4d2c176a8f5d.zip |
use code from urpm::orphans
-rw-r--r-- | rpm-find-leaves | 8 | ||||
-rw-r--r-- | urpm/select.pm | 38 |
2 files changed, 3 insertions, 43 deletions
diff --git a/rpm-find-leaves b/rpm-find-leaves index c1adc351..1a419cbf 100644 --- a/rpm-find-leaves +++ b/rpm-find-leaves @@ -4,7 +4,7 @@ use strict; use urpm; use urpm::msg; -use urpm::select; +use urpm::orphans; my %options = ( restrict_group => 0, @@ -42,9 +42,7 @@ while ($_ = shift) { } my $discard = $options{restrict_group} && sub { $_[0]->group !~ /\Q$options{group}/oi }; -my $leaves = urpm::select::installed_leaves($urpm, $discard); +my $leaves = urpm::orphans::installed_leaves($urpm, $discard); -my @l = $options{fullname} ? - map { scalar $_->fullname } values %$leaves : - keys %$leaves; +my @l = map { $options{fullname} ? scalar $_->fullname : $_->name } @$leaves; print "$_\n" foreach sort @l; diff --git a/urpm/select.pm b/urpm/select.pm index 495e81c7..0bca73ec 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -619,42 +619,4 @@ sub translate_why_removed_one { $fullname . ($s ? "\n ($s)" : ''); } -sub installed_packages_packed { - my ($urpm) = @_; - - my $db = urpm::db_open_or_die_($urpm) or die "Can't open RPM db\n"; - my @l; - $db->traverse(sub { - my ($pkg) = @_; - $pkg->pack_header; - push @l, $pkg; - }); - \@l; -} - -sub installed_leaves { - my ($urpm, $o_discard) = @_; - - my $packages = installed_packages_packed($urpm); - - my (%l, %provides); - foreach my $pkg (@$packages) { - next if $o_discard && $o_discard->($pkg); - $l{$pkg->name} = $pkg; - push @{$provides{$_}}, $pkg foreach $pkg->provides_nosense; - } - - foreach my $pkg (@$packages) { - foreach my $prop ($pkg->requires) { - my $n = URPM::property2name($prop); - foreach my $p (@{$provides{$n} || []}) { - $p != $pkg && $p->provides_overlap($prop) and - delete $l{$p->name}; - } - } - } - - \%l; -} - 1; |