text
stringlengths 0
834k
|
|---|
force => \$force,
|
'area=s' => \$area,
|
nodeps => \$nodeps,
|
'sync!' => \$sync,
|
) || usage();
|
usage() unless @ARGV >= 1;
|
my @args;
|
push(@args, force => 1) if $force;
|
push(@args, follow_deps => ""none"") if $nodeps;
|
my $feature = shift(@ARGV);
|
eval {
|
if ($feature =~ m,^[a-z][+\w]+:[^:],) {
|
usage() if @ARGV;
|
# looks like an absolute URL
|
require URI;
|
_install_uri($area, $force, URI->new($feature), @args);
|
}
|
elsif ($feature =~ /\.(?:ppd|ppmx)$/) {
|
usage() if @ARGV;
|
require URI::file;
|
_install_uri($area, $force, URI::file->new_abs($feature), @args);
|
}
|
elsif ($feature =~ /^\d+$/) {
|
usage() if @ARGV;
|
my $pkg = $ppm->search_lookup($feature) ||
|
die ""*** no package #$feature, do a '$PROGNAME search' first ***\n"";
|
my @deps = $ppm->packages_missing(want_deps => [$pkg], @args);
|
_install($area, $force, $pkg, @deps);
|
}
|
else {
|
# search for features in repos
|
$ppm->repo_sync if $sync;
|
my @want = map $ppm->feature_fixup_case($_), $feature, @ARGV;
|
_install($area, $force, $ppm->packages_missing(want => \@want, @args));
|
}
|
};
|
if ($@) {
|
if ($@ =~ /\bwould downgrade\b/) {
|
$@ =~ s/( at )/; use --force to install regardless$1/;
|
}
|
if ($@ =~ /File conflict/ && $@ =~ /The package (\S+) has already/) {
|
my $pkg = $1;
|
$@ =~ s/( at )/ Uninstall $pkg, or use --force to allow files\n to be overwritten.$1/;
|
}
|
die;
|
}
|
}
|
sub do_upgrade {
|
$USAGE = ""upgrade [<pkg> | --install]"";
|
my $install;
|
my $sync = 1;
|
if (@ARGV) {
|
require Getopt::Long;
|
Getopt::Long::GetOptions(
|
'install' => \$install,
|
'sync!' => \$sync,
|
) || usage();
|
usage() if @ARGV > 1;
|
}
|
if (@ARGV && $ARGV[0] =~ /::/) {
|
$ppm->repo_sync if $sync;
|
my $mod = $ppm->feature_fixup_case($ARGV[0]);
|
return _install(undef, 0, $ppm->packages_missing(want => [[$mod, undef]]));
|
}
|
$install++ if @ARGV;
|
my $pkg_count = 0;
|
my $upgrade_count = 0;
|
my %shaddow;
|
$ppm->repo_sync if $sync;
|
for my $area_name ($ppm->areas) {
|
my $area = $ppm->area($area_name);
|
for ($area->packages(""id"", ""name"", ""version"")) {
|
my($pkg_id, $pkg_name, $pkg_version) = @$_;
|
next if @ARGV && lc($ARGV[0]) ne lc($pkg_name);
|
$pkg_count++;
|
next if $shaddow{$pkg_name}++;
|
eval {
|
if (my $best = $ppm->package_best($pkg_name, 0)) {
|
if ($best->{name} eq $pkg_name && $best->{version} ne $pkg_version) {
|
my $pkg = $area->package($pkg_id);
|
if ($best->better_than($pkg)) {
|
print ""$pkg_name $best->{version} (have $pkg_version)\n"";
|
$upgrade_count++;
|
if ($install) {
|
my $install_area = $area_name;
|
if ($install_area eq ""perl"" || $area->readonly) {
|
$install_area = $ppm->default_install_area;
|
unless ($install_area) {
|
die ""No writable install area for the upgrade"";
|
}
|
}
|
# There might be new dependencies that also need to
|
# be installed.
|
my %requires = $best->requires;
|
my @extra = $ppm->packages_missing(
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.