summaryrefslogtreecommitdiff
path: root/bin/apt-why
diff options
context:
space:
mode:
Diffstat (limited to 'bin/apt-why')
-rwxr-xr-xbin/apt-why12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/apt-why b/bin/apt-why
index f78d2c4..9af7283 100755
--- a/bin/apt-why
+++ b/bin/apt-why
@@ -9,12 +9,16 @@ use Getopt::Long;
my $cache = AptPkg::Cache->new;
my $not = 0;
+my @deptypes;
GetOptions(
- "not" => \$not,
+ 'not' => \$not,
+ 'deptype=s' => \@deptypes,
);
my $packagename = shift or die("No packagename given");
my @known;
+@deptypes = split(/,/, join(',', @deptypes));
+
sub revdeps {
my $name = shift;
my $package = $cache->{$name};
@@ -22,8 +26,10 @@ sub revdeps {
my $rdeps = $package->{RevDependsList};
foreach (@$rdeps) {
if (
- $cache->{$_->{ParentPkg}{Name}}->{CurrentState} eq 'Installed'
- and $_->{DepType} !~ /^(Conflicts|Replaces|Obsoletes)$/
+ $cache->{$_->{ParentPkg}{Name}}->{CurrentState} eq 'Installed' and (
+ (not @deptypes and $_->{DepType} !~ /^(Conflicts|Replaces|Obsoletes)$/) or
+ (@deptypes and "$_->{DepType}" ~~ @deptypes)
+ )
) {
next if ($_->{ParentPkg}{Name} ~~ @known);
push(@return, $_->{ParentPkg}{Name});