summaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves
diff options
context:
space:
mode:
Diffstat (limited to 'rpm-find-leaves')
-rw-r--r--rpm-find-leaves23
1 files changed, 13 insertions, 10 deletions
diff --git a/rpm-find-leaves b/rpm-find-leaves
index 32d9668c..5c7fb496 100644
--- a/rpm-find-leaves
+++ b/rpm-find-leaves
@@ -2,21 +2,24 @@
@ARGV and die "usage: rpm-find-leaves\n";
-use rpmtools;
-
-$db = rpmtools::db_open('');
-rpmtools::db_traverse($db, [ qw(name version release provides requires) ], sub {
- push @packages, $_[0];
-});
-rpmtools::db_close($db);
+use URPM;
+my @packages;
+{
+ my $db = URPM::DB::open;
+ $db->traverse(sub {
+ my ($p) = @_;
+ $p->pack_header;
+ push @packages, $p;
+ });
+}
foreach my $pkg (@packages) {
- $l{$pkg->{name}} = 1;
- push @{$provides{$_}}, $pkg->{name} foreach @{$pkg->{provides} || []};
+ $l{$pkg->name} = 1;
+ push @{$provides{$_}}, $pkg->name foreach $pkg->provides_nosense;
}
foreach my $pkg (@packages) {
- delete @l{grep { $_ ne $pkg->{name} } @{$provides{$_} || []}} foreach @{$pkg->{requires} || []};
+ delete @l{grep { $_ ne $pkg->name } @{$provides{$_} || []}} foreach $pkg->requires_nosense;
}
print "$_\n" foreach sort keys %l;