Skip to content

Commit

Permalink
Don't fail just because a single CPAN module is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Jan 12, 2011
1 parent f92470f commit ff37c78
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cpan/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ Modules can be forcibly compiled and install from the latest source instead of A
---- Changes since 1.440 ----
Sped up the fetching of Perl modules installed from RPM and Debian packages.
Switched the install and current modules tabs.
---- Changes since 1.530 ----
When upgrading multiple Perl modules from CPAN, don't give up because just one could not be found.
27 changes: 25 additions & 2 deletions cpan/download.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,28 @@ elsif ($in{'source'} == 3) {
}
}
close(LIST);

# Fail if any modules are missing from CPAN
for($i=0; $i<@cpan; $i++) {
push(@missing, "<tt>$cpan[$i]</tt>") if (!$source[$i]);
}
&install_error(&text('download_ecpan', join(" ", @missing)))
if (@missing);

if ($in{'missingok'}) {
# If missing modules are OK, exclude them from the sources list
for($i=0; $i<@cpan; $i++) {
if (!$source[$i]) {
splice(@source, $i, 1);
splice(@cpan, $i, 1);
$i--;
}
}
@cpan || &install_error(&text('download_ecpan',
join(" ", @missing)));
}
elsif (@missing) {
# Fail due to missing modules
&install_error(&text('download_ecpan', join(" ", @missing)));
}
$source = join("<br>", @source);

# Download the actual modules
Expand Down Expand Up @@ -285,6 +302,12 @@ for($i=0; $i<@mods; $i++) {
print &ui_table_row(@mods > 1 ? $text{'download_mods'} : $text{'download_mod'},
$modmsg);

# Missing modules
if (@missing) {
print &ui_table_row($text{'download_missingok'},
join(" ", @missing));
}

# Source
print &ui_table_row($text{'download_src'}, $source);

Expand Down
1 change: 1 addition & 0 deletions cpan/lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ download_missing=Missing $1 modules
download_nomissing=All installed
download_ebuild=One or more of the Perl modules needs $1 to be built, but this Perl module is not installed.
download_yum=Installing Perl module $1 from package $2 ..
download_missingok=Modules missing from CPAN

install_title=Install Module
install_untar=Untarring module file
Expand Down
2 changes: 1 addition & 1 deletion cpan/uninstall_mods.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require './cpan-lib.pl';

if ($in{'upgrade'}) {
# Just redirect to the install page from CPAN
&redirect("download.cgi?source=3&cpan=".
&redirect("download.cgi?missingok=1&source=3&cpan=".
&urlize(join(" ", @d)));
exit;
}
Expand Down

0 comments on commit ff37c78

Please sign in to comment.