blob: 32d9668ca8a9adb9b53059c7cde7e22a5c0acbf9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/perl
@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);
foreach my $pkg (@packages) {
$l{$pkg->{name}} = 1;
push @{$provides{$_}}, $pkg->{name} foreach @{$pkg->{provides} || []};
}
foreach my $pkg (@packages) {
delete @l{grep { $_ ne $pkg->{name} } @{$provides{$_} || []}} foreach @{$pkg->{requires} || []};
}
print "$_\n" foreach sort keys %l;
|