summaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves
blob: 3ab5a47073316c0b028424903c01cb9ad4beb3a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl

@ARGV and die "usage: rpm-find-leaves\n";

use URPM;
my @packages;
{
    my $db = URPM::DB::open or die;
    $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_nosense;
}

foreach my $pkg (@packages) {
    delete @l{grep { $_ ne $pkg->name } @{$provides{$_} || []}} foreach $pkg->requires_nosense;
}

print "$_\n" foreach sort keys %l;