summaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-12-19 20:49:19 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-12-19 20:49:19 +0000
commita033de58c091af821e3323963be6ce6dcf101afc (patch)
treea5f452a614e3e4a64cbd96035c754f55dc733818 /rpm-find-leaves
parent1dee2c62b8b19cefa4dbf096027428ef786ec057 (diff)
downloadurpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar
urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar.gz
urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar.bz2
urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar.xz
urpmi-a033de58c091af821e3323963be6ce6dcf101afc.zip
no_comment
Diffstat (limited to 'rpm-find-leaves')
-rw-r--r--rpm-find-leaves20
1 files changed, 16 insertions, 4 deletions
diff --git a/rpm-find-leaves b/rpm-find-leaves
index 30f3f2f1..f94190c5 100644
--- a/rpm-find-leaves
+++ b/rpm-find-leaves
@@ -1,7 +1,19 @@
#!/usr/bin/perl
+local $_ = join '', @ARGV;
+
+/-h/ and die "usage: rpm-find-leaves [--show-unknown]\n";
+
+$show_unknown = /-show-unknown/;
+
$r = join '|', map { chop; $l{$_} = 1; quotemeta } `rpm -qa --queryformat "%{NAME}\n"`;
-$R = qr/ $r/;
-open F, "/etc/urpmi/depslist" or die "can't find depslist\n";
-$R && /(\S+)-[^-]+-[^-]+ / && delete $l{$1} foreach <F>;
-print "$_\n" foreach keys %l;
+$R = qr/ ($r)-\d/;
+$R2 = qr/$r /;
+open F, "/var/lib/urpmi/depslist" or die "can't find depslist\n";
+F: foreach (<F>) {
+ my ($p) = /(\S+)-[^-]+-[^-]+ /;
+ $p =~ $R2 or next; # not installed
+ $L{$p} = 1;
+ delete $l{$1} while /$R/g;
+}
+$show_unknown || $L{$_} and print "$_\n" foreach keys %l;