Package: apt-rdepends Version: 1.3.0-1.1 Severity: wishlist The attached patch adds --given-only to apt-rdepends. This is e.g. useful if you install a new package and want a small diagrapm showing which packages are pulled in by dependencies.
apt-cache on the other hand is unable to only graph depends. I agree that all the functionality should finally go to apt-cache, but hacking apt-rdepends was much quicker an easier :-) -- System Information: Debian Release: lenny/sid APT prefers hardy-updates APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy-backports'), (500, 'hardy') Architecture: i386 (i686) Kernel: Linux 2.6.24-19-generic (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages apt-rdepends depends on: ii libapt-pkg-perl 0.1.21build3 Perl interface to libapt-pkg ii perl 5.8.8-12 Larry Wall's Practical Extraction apt-rdepends recommends no packages. -- no debconf information
--- /usr/bin/apt-rdepends 2007-10-26 16:14:34.000000000 +0200 +++ apt-rdepends 2008-08-05 14:48:01.000000000 +0200 @@ -36,6 +36,8 @@ my $reverse = 0; # Are we following Build-Depends? my $builddep = 0; +# Do we only recurse on packages given on commandline +my $givenonly = 0; # We kind of output do we generate? (console, dotty, vcg) my $output = "console"; # Which types of dependencies do we follow? @@ -69,6 +71,7 @@ 'option|o=s' => [EMAIL PROTECTED], 'help|h|?' => \$help, 'version' => \$ver, + 'given-only' => \$givenonly, 'man' => \$man) or pod2usage(verbose => 0); print_version() if ($ver); pod2usage(verbose => 2) if ($man); @@ -267,7 +270,13 @@ my $state = ($reverse ? $dep->{ParentPkg}->{CurrentState} : $dep->{TargetPkg}->{CurrentState}); + my $name = $dep->{$PkgReference}->{Name}; # Push the name of this package into the right pigeonhole. + if ( $givenonly + && grep {0+$dep->{DepType} eq $_} @follow + && ! grep {$name eq $_} @ARGV) { + next; + } $$results{0+$dep->{DepType}}{$dep->{$PkgReference}->{Name}} = [ $version, $state, "$dep->{DepType}"]; # Populate the dictionaries of names for this lcoale @@ -553,6 +562,7 @@ -d, --dotty generates a dotty graph -p, --print-state show the state of each dependency -r, --reverse list packages that depend on the specified one + -g, --given-only only follow packages given on commandline -f, --follow=DEPENDS only follow DEPENDS dependencies recursively -s, --show=DEPENDS only show DEPENDS dependencies --state-follow=STATES only follow STATES states recursively