text
stringlengths
0
834k
my $stop_be;
for my $pkg (@_) {
if (my $why = $ppm->cannot_install($pkg)) {
print ""Can't install "", $pkg->name_version, "": "", $why, ""\n"";
$stop++;
$stop_be++ if $why =~ /business edition/i;
}
}
if ($stop) {
if ($stop_be) {
print ""\n"";
print_be_info();
}
return;
}
}
unless ($area) {
$area = $ppm->default_install_area;
unless ($area) {
my $msg = ""All available install areas are readonly.
Run 'ppm help area' to learn how to set up private areas."";
require ActiveState::Path;
if (ActiveState::Path::find_prog(""sudo"")) {
$msg .= ""\nYou might also try 'sudo ppm' to raise your privileges."";
}
die $msg;
}
ppm_log(""NOTICE"", ""Installing into $area"");
}
$area = $ppm->area($area);
$| = 1;
my $summary = $ppm->install(packages => \@_, area => $area, force => $force);
if (my $count = $summary->{count}) {
for my $what (sort keys %$count) {
my $n = $count->{$what} || 0;
printf ""%4d file%s %s\n"", $n, ($n == 1 ? """" : ""s""), $what;
}
}
}
sub do_remove {
$USAGE = ""remove [--area <area>] [--force] <package> ..."";
my $opt_area;
my $opt_force;
require Getopt::Long;
Getopt::Long::GetOptions(
'area=s' => \$opt_area,
'force' => \$opt_force,
) || usage();
usage() unless @ARGV;
my $removed_count = 0;
for my $pkg (@ARGV) {
if ($pkg =~ /^\d+$/) {
print ""$pkg: not installed\n"";
next;
}
my $area;
my $pkg_o;
if ($opt_area) {
$area = $ppm->area($opt_area);
$pkg_o = $area->package($pkg, sloppy => 1);
}
else {
for my $a ($ppm->areas) {
$area = $ppm->area($a);
next unless $area->initialized;
$pkg_o = $area->package($pkg, sloppy => 1);
if ($pkg_o) {
die ""Can't remove from 'perl' area without explicit area specification""
if $a eq ""perl"";
last;
}
}
}
unless ($pkg_o) {
print ""$pkg: not installed\n"";
next;
}
if (lc($pkg_o->{name}) ne lc(do{my $p = $pkg; $p =~ s/::/-/g; $p})) {
die ""'ppm remove $pkg_o->{name}' will uninstall package providing $pkg"";
}
unless ($opt_force) {
my @d = map $_->name, $ppm->packages_depending_on($pkg_o, $area->name);
if (@d) {
my %args = map { $_ => 1 } @ARGV;
@d = grep !$args{$_}, @d;
if (@d) {
print ""$pkg: required by "", join_with(""and"", sort @d), ""\n"";
next;
}
}
}
eval {
$pkg_o->run_script(""uninstall"", $area, undef, {
old_version => $pkg_o->{version},
packlist => $area->package_packlist($pkg_o->{id}),