/[soft]/rpm/urpmi/branches/1/rpm-find-leaves
ViewVC logotype

Contents of /rpm/urpmi/branches/1/rpm-find-leaves

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3132 - (show annotations) (download)
Wed Feb 29 23:59:36 2012 UTC (8 years, 4 months ago) by tv
File size: 1180 byte(s)
branch

1 #!/usr/bin/perl
2
3 use strict;
4
5 use urpm;
6 use urpm::msg;
7 use urpm::orphans;
8
9 my %options = (
10 restrict_group => 0,
11 group => 'System/Libraries',
12 root => '',
13 );
14
15 my $usage = N("usage: %s [options]
16 where [options] are from
17 ", $0) . N(" -h|--help - print this help message.
18 ") . N(" --root <path> - use the given root instead of /
19 ") . N(" -g [group] - restrict results to specified group.
20 ") . N(" defaults to %s.
21 ", $options{group}) . N(" -f - output rpm full name (NVRA)
22 ");
23
24 my $urpm = urpm->new;
25
26 while ($_ = shift) {
27 $_ eq '--root' and do {
28 my $root = shift;
29 $root and urpm::set_files($urpm, $root);
30 next;
31
32 };
33 $_ eq '-g' and do {
34 $options{restrict_group} = 1;
35 next if !@ARGV || $ARGV[0] =~ /^-/;
36 my $group = shift;
37 $options{group} = $group;
38 next;
39 };
40 $_ eq '-f' and do { $options{fullname} = 1; next };
41 print $usage; exit 1;
42 }
43
44 my $discard = $options{restrict_group} && sub { $_[0]->group !~ /\Q$options{group}/oi };
45 my $leaves = urpm::orphans::installed_leaves($urpm, $discard);
46
47 my @l = map { $options{fullname} ? scalar $_->fullname : $_->name } @$leaves;
48 print "$_\n" foreach sort @l;

  ViewVC Help
Powered by ViewVC 1.1.28