summaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-03-15 12:07:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-03-15 12:07:29 +0000
commitb3f100c61315e544c3ab16d3e5d4640b66db0a76 (patch)
tree91aaa1f6e9430d96e4fac0d5e4502e13c33c5e7c /rpm-find-leaves
parent49caebb2f47495fe8dc444d9cfd597ad11df68ea (diff)
downloadurpmi-b3f100c61315e544c3ab16d3e5d4640b66db0a76.tar
urpmi-b3f100c61315e544c3ab16d3e5d4640b66db0a76.tar.gz
urpmi-b3f100c61315e544c3ab16d3e5d4640b66db0a76.tar.bz2
urpmi-b3f100c61315e544c3ab16d3e5d4640b66db0a76.tar.xz
urpmi-b3f100c61315e544c3ab16d3e5d4640b66db0a76.zip
adapt for depslist.ordered
Diffstat (limited to 'rpm-find-leaves')
-rw-r--r--rpm-find-leaves33
1 files changed, 23 insertions, 10 deletions
diff --git a/rpm-find-leaves b/rpm-find-leaves
index f94190c5..781422b7 100644
--- a/rpm-find-leaves
+++ b/rpm-find-leaves
@@ -1,19 +1,32 @@
#!/usr/bin/perl
+use lib "../rpmtools";
+
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)-\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;
+use rpmtools;
+
+$f = "/var/lib/urpmi/depslist.ordered";
+open F, $f or die "read_depslist: can't open file $f\n";
+$o = new rpmtools;
+$o->read_depslist(\*F);
+
+chop, $l{$_} = 1 foreach `rpm -qa --queryformat "%{name}\n"`;
+
+%m = %l;
+
+foreach (@{$o->{depslist}}) {
+ delete $m{$_->{name}} or next;
+ delete $l{$o->{depslist}[$_]{name}} foreach split ' ', $_->{deps};
+}
+
+!$m{$_} and print "$_\n" foreach sort keys %l;
+
+if ($show_unknown) {
+ print "\n";
+ print "$_\n" foreach sort keys %m;
}
-$show_unknown || $L{$_} and print "$_\n" foreach keys %l;