text
stringlengths
0
834k
my $o = shift;
my $pkg = shift;
my $version = shift;
my $target_name = shift;
my $status = shift;
if ($status eq 'COMPLETE') {
$o->inform(
""Successfully removed $pkg version $version from $target_name.\n""
)
}
else {
$o->inform(<<END);
$SEP
Remove '$pkg' version $version from $target_name.
$SEP
END
}
}
sub cb_install {
my $o = shift;
unshift @_, $o, 'install';
&cb_status;
}
sub cb_upgrade {
my $o = shift;
unshift @_, $o, 'upgrade';
&cb_status;
}
sub cb_status {
my $o = shift;
my $ACTION = shift;
my $pkg = shift;
my $version = shift;
my $target_name = shift;
my $status = shift;
my $bytes = shift;
my $total = shift;
my $secs = shift;
my $cols = $ENV{COLUMNS} || 78;
$o->inform(<<END) and return if ($status eq 'PRE-INSTALL');
$SEP
\u$ACTION '$pkg' version $version in $target_name.
$SEP
END
# Print the output on one line, repeatedly:
my ($line, $pad, $eol);
if ($status eq 'DOWNLOAD') {
if ($bytes < $total) {
$line = ""Transferring data: $bytes/$total bytes."";
$eol = ""\r"";
}
else {
$line = ""Downloaded $bytes bytes."";
$eol = ""\n"";
}
}
elsif ($status eq 'PRE-EXPAND') {
$line = """"; #""Extracting package. This may take a few seconds."";
$eol = ""\r""; #""\n"";
}
elsif ($status eq 'EXPAND') {
$line = ""Extracting $bytes/$total: $secs"";
$eol = $bytes < $total ? ""\r"" : ""\n"";
}
elsif ($status eq 'COMPLETE') {
my $verb = $ACTION eq 'install' ? 'installed' : 'upgraded';
$o->inform(
""Successfully $verb $pkg version $version in $target_name.\n""
);
return;
}
$pad = ' ' x ($cols - length($line));
$o->verbose($line, $pad, $eol);
}
sub warn_profile_change {
my $o = shift;
my $ok = shift;
my $profile_track = $o->conf('profile-track');
my $profile = PPM::UI::profile_get()->result;
if ($profile_track) {
$o->verbose(<<END);
Tracking changes to profile '$profile'.
END
}
}
sub parse_range {
my @numbers;
my $arg;
while ($arg = shift) {
while ($arg) {