diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/apt-why | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/bin/apt-why b/bin/apt-why index aa011c6..f78d2c4 100755 --- a/bin/apt-why +++ b/bin/apt-why @@ -45,105 +45,6 @@ recurse($packagename, 0); __END__ -sub revdeps { - my $rdepsref = shift; - my $depsref; - my $parent; - - foreach(@$rdepsref) { - undef($parent); - $parent->{name} = $_->{ParentPkg}{Name}; - $parent->{ver} = $_->{ParentVer}{VerStr}; - $parent->{current_state} = $cache->{$_->{ParentPkg}{Name}}->{CurrentState}; - $parent->{selected_state} = $cache->{$_->{ParentPkg}{Name}}->{SelectedState}; - $parent->{deptype} = $_->{DepType}; - $parent->{targetname} = $_->{TargetPkg}{Name}; - if ($_->{TargetVer}) { - $parent->{depsign} = $_; - $parent->{depver} = $_; - } - $depsref->{$parent->{name}} = $parent; - } - return($depsref); -} - -sub why { - my $revdeps = revdeps(shift); - my $why; - foreach(keys(%$revdeps)) { - if ($revdeps->{$_}->{current_state} eq 'Installed' and $revdeps->{$_}->{deptype} !~ /^(Conflicts|Replaces|Obsoletes)$/) { - $why->{$_} = $revdeps->{$_}; - } - } - return($why); -} - -sub why_not { - my $revdeps = revdeps(shift); - my $why_not; - foreach(keys(%$revdeps)) { - if ($revdeps->{$_}->{current_state} eq 'Installed' and $revdeps->{$_}->{deptype} =~ /^(Conflicts|Replaces|Obsoletes)$/) { - $why_not->{$_} = $revdeps->{$_}; - } - } - return($why_not); -} - -sub short_states { - my $pkg = shift; - my $state = ''; - switch($pkg->{selected_state}) { - case('Unkwnon') { - $state .= ' '; - } case('Install') { - $state .= 'i'; - } case('Hold') { - $state .= 'h'; - } case('DeInstall') { - $state .= 'r'; - } case('Purge') { - $state .= 'p'; - } - } - switch($pkg->{current_state}) { - case('Installed') { - $state .= 'i'; - } case('UnPacked') { - $state .= 'u'; - } case('HalfConfigured') { - $state .= 'f'; - } case('HalfInstalled') { - $state .= 'h'; - } case('ConfigFiles') { - $state .= 'c'; - } case('NotInstalled') { - $state .= ' '; - } - } - return($state); -} - - -sub print_deps { - my $deps = shift; - foreach(keys(%$deps)) { - printf "%-2s %-30s %-15s %s\n", short_states($deps->{$_}), $deps->{$_}->{name}, $deps->{$_}->{deptype}, $deps->{$_}->{targetname}; - } -} - -print "State: $package->{CurrentState}\n"; -if ($package->{Flags} =~ /Essential/) { - print "Essential: yes\n"; -} - -if ($not) { - print_deps(why_not($package->{RevDependsList})); -} else { - print_deps(why($package->{RevDependsList})); -} - -__END__ - =head1 NAME apt-why - filtered reverse dependency displayer using AptPkg::Cache |