#!/usr/bin/perl # we remove old translations (#~ stuff) because some id's may be shared # with what's extracted from the compss, and in such case msgfmt will # not put the translations in the mo :( use MDK::Common; my $line_number = 0; my @contents = cat_($ARGV[0]); foreach (@contents) { $line_number++; /^#, fuzzy/ && $contents[$line_number+1] =~ /^#~/ and next; /^#~/ and next; print; } geia.org/software/rpm/urpmi' title='urpmi Git repository'/>
summaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves
blob: 1a419cbf52a7455b8122266b3b17cddcab27840e (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

use strict;

use urpm;
use urpm::msg;
use urpm::orphans;

my %options = (
    restrict_group => 0,
    group => 'System/Libraries',
    root => '',
);

my $usage = N("usage: %s [options]
where [options] are from
", $0) . N("   -h|--help      - print this help message.
") . N("   --root <path>  - use the given root instead of /
") . N("   -g [group]     - restrict results to specified group.
") . N("                    defaults to %s.
", $options{group}) . N("   -f             - output rpm full name (NVRA)
");

my $urpm = urpm->new;

while ($_ = shift) {
    $_ eq '--root' and do {
	my $root = shift;
	$root and urpm::set_files($urpm, $root);
	next;

    };
    $_ eq '-g' and do {
	$options{restrict_group} = 1;
	next if !@ARGV || $ARGV[0] =~ /^-/;
	my $group = shift;
	$options{group} = $group;
	next;
    };
    $_ eq '-f' and do { $options{fullname} = 1; next };
    print $usage; exit 1;
}

my $discard = $options{restrict_group} && sub { $_[0]->group !~ /\Q$options{group}/oi };
my $leaves = urpm::orphans::installed_leaves($urpm, $discard);

my @l = map { $options{fullname} ? scalar $_->fullname : $_->name } @$leaves;
print "$_\n" foreach sort @l;