text
stringlengths
0
834k
if (@res == 1) {
@ARGV = (1);
return do_describe();
}
my %repo_name;
for my $id ($ppm->repos) {
my $o = $ppm->repo($id);
next unless $o->{enabled};
$repo_name{$id} = $o->{name} || $id;
}
my $cannot_install_count = 0;
for (@res) {
$cannot_install_count++ if $_->[5];
}
if ($cannot_install_count) {
if ($cannot_install_count == @res) {
print ""*** Warning: None of the matched packages can be installed.\n"";
}
else {
print ""*** Warning: Some of the matched package require a valid Business\n"";
print ""*** Edition subscription to be installed. These are marked with [BE].\n"";
}
print_be_info();
print ""\n"";
}
if (@res < 10) {
my $count = 0;
for (@res) {
my($name, $version, $date, $abstract, $repo_id, $cannot_install) = @$_;
$count++;
print ""\n"" unless $count == 1;
print ""$count: $name"";
print "" [BE]"" if $cannot_install && $cannot_install_count != @res;
print ""\n"";
print "" $abstract\n"" if $abstract;
print "" Version: $version\n"";
if ($date) {
$date =~ s/[T ].*//;
print "" Released: "", $date, ""\n"";
}
print "" Repo: "", ($repo_name{$repo_id} || $repo_id), ""\n""
if keys %repo_name > 1;
}
}
else {
my $count = 0;
my $count_width = length(scalar(@res));
for (@res) {
$count++;
printf ""%*d: %s %s"", $count_width, $count, $_->[0], $_->[1];
print "" [BE]"" if $_->[5] && $cannot_install_count != @res;
print ""\n"";
}
}
}
else {
print ""*** no packages matching '$pattern' found ***\n"";
}
}
sub do_describe {
$USAGE = ""describe <num>"";
usage() unless @ARGV == 1;
my $num = shift(@ARGV);
$num =~ s/:$//;
usage unless $num =~ /^\d+$/;
my $pkg = $ppm->search_lookup($num) ||
die ""*** no package #$num, do a '$PROGNAME search' first ***\n"";
my $pad = "" "" x (length($num) + 2);
print ""$num: $pkg->{name}"";
if (my $why = $ppm->cannot_install($pkg)) {
print "" *** can't install: $why ***"";
}
print ""\n"";
print ""${pad}$pkg->{abstract}\n"" if $pkg->{abstract};
print ""${pad}Version: $pkg->{version}\n"";
if (my $date = $pkg->{release_date}) {
$date =~ s/[T ].*//;
print ""${pad}Released: "", $date, ""\n"";
}
print ""${pad}Author: $pkg->{author}\n"" if $pkg->{author};
for my $role (qw(provide require)) {
for my $feature (sort keys %{$pkg->{$role} || {}}) {
next if $feature eq $pkg->{name};
(my $pretty_feature = $feature) =~ s/::$//;
print ""${pad}\u$role: $pretty_feature"";
if (my $vers = $pkg->{$role}{$feature}) {
print "" version $vers"";
print "" or better"" if $role eq ""require"";
}
print ""\n"";
}
}
my $repo = $ppm->repo($pkg->{repo_id});
print ""${pad}Repo: $repo->{name}\n"";
if ((my $ppmx = $pkg->codebase_abs) =~ m,^https?://ppm4(?:-be)?\.activestate.com/,) {