This file is indexed.

/usr/share/doc/libgraphviz-perl/examples/ppmgraph.pl is in libgraphviz-perl 2.04-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/perl -w

use strict;

use lib '../lib';
use Getopt::Long;
use LWP::Simple;
use Pod::Usage;
use GraphViz;
use XML::XPath;

sub depends {
	my ($xp, $os, $pkg) = @_;
	$os = lc $os;
	my $nodeset = $xp->find("/REPOSITORYSUMMARY/SOFTPKG[\@NAME='$pkg']/IMPLEMENTATION/DEPENDENCY[../OS/\@NAME='$os']/\@NAME");
	return map { $xp->findvalue('.', $_) } $nodeset->get_nodelist;

}

sub process {
	my $xp   = shift;
	my $os   = shift;
	my $deps = shift;
	for my $pkg (@_) {
		next if $deps->{$pkg};  # check here since it might have been done in a recursive call
		my @deps = depends($xp, $os, $pkg);
		$deps->{$pkg} = [ @deps ];
		process($xp, $os, $deps, @deps);
	}
	return $deps;
}

our $VERSION='0.01';

my %opts = (
    help     => 0,
    man      => 0,
    verbose  => 0,
    os       => '',
    pkg      => '',
);

GetOptions(\%opts, qw(
    help
    man
    verbose
    os=s
    pkg=s
)) || pod2usage(2);

pod2usage(1) if     $opts{help};
pod2usage(-exitstatus => 0, -verbose => 2) if $opts{man};
pod2usage(1) unless $opts{pkg};
$opts{os}  ||= 'linux';
$opts{pkg} =~ s/::/-/g;

mirror("http://www.activestate.com/PPMPackages/5.6plus/package.lst", "package.lst") unless -f "package.lst";
my $xp = XML::XPath->new(filename => 'package.lst');
my $deps = process($xp, $opts{os}, {}, $opts{pkg});

my $g = GraphViz->new();

for my $pkg (keys %$deps) {
	$g->add_node($pkg);
	for my $dep (@{ $deps->{$pkg} }) {
		$g->add_edge($pkg => $dep);
	}
}

print $g->as_png;

__END__

=head1 NAME

ppmgraph.pl - graph CPAN tarball dependencies

=head1 SYNOPSIS

ppmgraph.pl -os=linux -pkg=Class-DBI >class-dbi.png

=head1 DESCRIPTION

This program takes Activestate's package list (download it from
http://www.activestate.com/PPMPackages/5.6plus/package.lst), which is in
XML format, and uses it to determine dependencies between packages. It
then hands over those dependencies to GraphViz. The resulting graph is
output in PNG format on STDOUT.

Note that this means that dependencies of modules within the tarballs
can't be determined this way, only dependencies between the tarballs
themselves. For these purposes, there will be programs to graph
dependencies between installed modules and the runtime @ISA hierarchy.

=head1 OPTIONS

This section describes the supported command line options. Minimum
matching is supported.

=over 4

=item B<--pkg>

Mandatory option to specify which package to graph the dependency
for. This can be either the name of the module (e.g. C<Class::DBI>)
or the name of the tarball sans version number (e.g. C<Class-DBI>). In
any case, the graph will display tarball names as the node labels,
since that's what's contained in the XML file.

=item B<--os>

Which Operating System to graph the dependency for. At the moment,
ActiveState defines "linux", "solaris" and "MSWin32". If not given,
this option defaults to "linux".

=item B<--help>

Print a brief help message and exit.

=item B<--man>

Print the manual page and exit.

=item B<--verbose>

Print information messages as we go along.

=back

=head1 BUGS

Some. Possibly. I haven't fully tested it. Also, a performance
problem. The package XML file is over a meg, and performance suffers. At
the moment, this is of no concern, but I might switch over to PerlSAX
later. I'm using XPath at the moment since I'm familiar with it.

=head1 AUTHOR

Marcel GrE<uuml>nauer E<lt>marcel@codewerk.comE<gt>

=head1 COPYRIGHT

Copyright 2000 Marcel GrE<uuml>nauer. All rights reserved.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO

GraphViz(3pm)

=cut