summaryrefslogtreecommitdiff
path: root/bin/apt-why
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-06-19 18:08:47 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-06-19 18:08:47 +0200
commitef2c53a42a329550c654e635fb204a6da03f25ec (patch)
tree1faaa49377d273d243d08616043f44382fca2851 /bin/apt-why
parent24847a6c6dbe2d770d9c982b3da5dbacbdbf89cd (diff)
apt-why: Don't filter certain dependency types, use default @deptypes instead
Diffstat (limited to 'bin/apt-why')
-rwxr-xr-xbin/apt-why10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/apt-why b/bin/apt-why
index ad23c72..d27fef5 100755
--- a/bin/apt-why
+++ b/bin/apt-why
@@ -11,6 +11,7 @@ use Getopt::Long;
my $cache = AptPkg::Cache->new;
my $max_depth = 5;
my @deptypes;
+my @default_deptypes = ('Depends', 'Recommends', 'Suggests');
GetOptions(
'deptype=s' => \@deptypes,
'depth=i' => \$max_depth,
@@ -19,6 +20,9 @@ my $packagename = shift or die("No packagename given");
my @known;
@deptypes = split(/,/, join(',', @deptypes));
+unless (@deptypes) {
+ @deptypes = @default_deptypes;
+}
sub revdeps {
my $name = shift;
@@ -27,10 +31,8 @@ sub revdeps {
my $rdeps = $package->{RevDependsList};
foreach (@$rdeps) {
if (
- $cache->{$_->{ParentPkg}{Name}}->{CurrentState} eq 'Installed' and (
- (not @deptypes and $_->{DepType} !~ /^(Conflicts|Replaces|Obsoletes)$/) or
- (@deptypes and "$_->{DepType}" ~~ @deptypes)
- )
+ $cache->{$_->{ParentPkg}{Name}}->{CurrentState} eq 'Installed'
+ and "$_->{DepType}" ~~ @deptypes
) {
next if ($_->{ParentPkg}{Name} ~~ @known);
push(@return, $_->{ParentPkg}{Name});