text
stringlengths
0
834k
$ppmx =~ s/\.tar\.gz$/.ppmx/;
print ""${pad}Link: $ppmx\n"";
}
elsif ((my $ppd = $pkg->{ppd_uri}) =~ /\.ppd$/) {
print ""${pad}Link: $ppd\n"";
}
if (my $name = is_cpan_package($pkg->{name})) {
print ""${pad}CPAN: http://search.cpan.org/dist/$name-$pkg->{version}/\n"";
}
for my $area ($ppm->areas) {
my $area_pkg = eval { $ppm->area($area)->package($pkg->{name}) };
next unless $area_pkg;
print ""${pad}Installed: $area_pkg->{version} ($area)\n"";
}
return;
}
sub do_tree {
$USAGE = ""tree [<num> | <package>]"";
usage unless @ARGV == 1;
my $pkg = shift(@ARGV);
if ($pkg =~ /^\d+$/) {
my $tmp = $ppm->search_lookup($pkg) ||
die ""*** no package #$pkg, do a '$PROGNAME search' first ***\n"";
$pkg = $tmp;
}
else {
my $tmp = $ppm->package_best($pkg, 0) ||
die ""*** no package called $pkg ***\n"";
$pkg = $tmp;
}
_tree($pkg, {});
}
sub _tree {
my($pkg, $seen, $reason, $depth) = @_;
$depth ||= 0;
print "" "" x $depth, ""package "", $pkg->name_version;
print "" provide $reason"" if $reason && $reason ne $pkg->{name};
print ""\n"";
if ($seen->{$pkg->name_version}++) {
return;
}
my $require = $pkg->{require};
if ($require && %$require) {
my %subpkg;
for my $feature (sort keys %$require) {
print "" "" x $depth, "" needs $feature"";
my $vers = $require->{$feature};
if ($vers) {
print "" $vers or better"";
}
my @facts;
my $found;
for my $area_name ($ppm->areas) {
my $area = $ppm->area($area_name);
next unless $area->initialized;
if (my $have = $area->feature_have($feature)) {
$have = 0 if $have eq ""0E0"";
push(@facts, ($have || $vers ? ""v$have "" : """") . ""installed in $area_name area"");
$found++ if $have >= $vers;
}
}
push(@facts, ""not installed"") unless $found;
if (my $subpkg = $ppm->package_best($feature, $vers)) {
my $h = $subpkg{$subpkg->name_version} ||= {
pkg => $subpkg,
};
push(@{$h->{reason}}, $feature) if $feature ne $pkg->name;
}
else {
push(@facts, ""not provided by any repo"");
}
print "" ("", join_with(""and"", @facts), "")"" if @facts;
print ""\n"";
}
for (sort keys %subpkg) {
my $h = $subpkg{$_};
_tree($h->{pkg}, $seen, join_with(""and"", @{$h->{reason}}), $depth + 1);
}
}
else {
print "" "" x $depth , "" (no dependencies)\n"";
}
}
sub do_install {
$USAGE = ""install [--force] [--nodeps] [--area <area>] <module> | <url> | <file> | <num>"";
my $force;
my $area;
my $nodeps;
my $sync = 1;
require Getopt::Long;
Getopt::Long::GetOptions(