Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 21 additions & 45 deletions dev/import-perl5/patches/CPAN-Module.pm.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
--- perl5/cpan/CPAN/lib/CPAN/Module.pm
+++ src/main/perl/lib/CPAN/Module.pm
@@ -16,0 +17,6 @@
@@ -14,0 +15,6 @@
+}
+
+sub perlonjava_provider {
+ my ($self) = @_;
+ require PerlOnJava::ProviderManifest;
+ return PerlOnJava::ProviderManifest->provider_for($self->{ID});
+}
+
@@ -460,7 +466,7 @@
CPAN->debug("dist-reqtype[$pack->{reqtype}]".
"self-reqtype[$self->{reqtype}]") if $CPAN::DEBUG;
if ($pack->{reqtype}) {
@@ -463 +469 @@
- if ($pack->{reqtype} eq "b" && $self->{reqtype} =~ /^[rc]$/) {
+ if ($pack->{reqtype} =~ /^(?:b|t|q)$/ && $self->{reqtype} =~ /^[rc]$/) {
$pack->{reqtype} = $self->{reqtype};
if (
exists $pack->{install}
@@ -473,7 +479,7 @@
) {
delete $pack->{install};
$CPAN::Frontend->mywarn
@@ -476 +482 @@
- ("Promoting $pack->{ID} from 'build_requires' to 'requires'");
+ ("Promoting $pack->{ID} from a non-runtime prerequisite to 'requires'");
}
}
} else {
@@ -509,6 +515,14 @@
#-> sub CPAN::Module::test ;
sub test {
my $self = shift;
@@ -511,0 +518,8 @@
+ if ($ENV{PERLONJAVA_PROVIDER_CONFORMANCE}) {
+ my $provider = $self->perlonjava_provider
+ or die $self->id . " is not declared in PerlOnJava's provider manifest\n";
Expand All @@ -37,22 +22,10 @@
+ $self->id, $provider->{provider}, $provider->{version},
+ ));
+ }
# $self->{badtestcnt} ||= 0;
$self->rematein('test',@_);
}
@@ -532,6 +546,8 @@
#-> sub CPAN::Module::uptodate ;
sub uptodate {
my ($self) = @_;
@@ -534,0 +549,2 @@
+ my $provider = $self->perlonjava_provider;
+ return 1 if $provider && $provider->{shadow_policy} eq 'forbidden';
local ($_);
my $inst = $self->inst_version or return 0;
my $cpan = $self->cpan_version;
@@ -569,6 +585,16 @@
#-> sub CPAN::Module::install ;
sub install {
my($self) = @_;
@@ -571,0 +588,10 @@
+ if (my $provider = $self->perlonjava_provider) {
+ if ($provider->{shadow_policy} eq 'forbidden') {
+ $CPAN::Frontend->myprint(sprintf(
Expand All @@ -63,16 +36,19 @@
+ return 1;
+ }
+ }
my($doit) = 0;
if ($self->uptodate
&&
@@ -652,6 +678,9 @@
#-> sub CPAN::Module::inst_version ;
sub inst_version {
my($self) = @_;
@@ -654,0 +681,3 @@
+ if (my $provider = $self->perlonjava_provider) {
+ return $provider->{version};
+ }
my $parsefile = $self->inst_file or return;
my $have = $self->parse_version($parsefile);
$have;
@@ -671 +700,7 @@
- if (ALARM_IMPLEMENTED) {
+ # MM_Unix::parse_version only scans bundled jar resources line by line; it
+ # cannot execute module code or block on filesystem I/O. A wall-clock
+ # alarm here merely turns temporary CPU starvation into a false "module
+ # not installed" result, which can send CPAN into recursive core-module
+ # dependency resolution. Keep the safety timeout for ordinary files.
+ my $use_alarm = ALARM_IMPLEMENTED && $parsefile !~ /^jar:/;
+ if ($use_alarm) {
@@ -684 +719 @@
- alarm(0) if ALARM_IMPLEMENTED;
+ alarm(0) if $use_alarm;
70 changes: 47 additions & 23 deletions dev/import-perl5/patches/CPAN.pm.patch
Original file line number Diff line number Diff line change
@@ -1,39 +1,63 @@
--- perl5/cpan/CPAN/lib/CPAN.pm 2026-04-10 11:04:21
+++ src/main/perl/lib/CPAN.pm 2026-08-10 10:12:28
@@ -703,6 +703,13 @@
CPAN::HandleConfig->load unless $CPAN::Config_loaded++;
CPAN->debug("mgr[$mgr] class[$class]") if $CPAN::DEBUG;
CPAN::Index->reload;
--- perl5/cpan/CPAN/lib/CPAN.pm
+++ src/main/perl/lib/CPAN.pm
@@ -705,0 +706,7 @@
+ # Metadata caches can contain hundreds of thousands of entries. Keep
+ # startup cheap by creating their mutable session wrappers only when a
+ # command really asks to enumerate the whole class.
+ for my $id (keys %{ $META->{readonly}{$class} || {} }) {
+ $META->{readwrite}{$class}{$id} ||=
+ $class->new(ID => $id, RO => $META->{readonly}{$class}{$id});
+ }
values %{ $META->{readwrite}{$class} }; # unsafe meta access, ok
}

@@ -1320,7 +1327,9 @@
$id ||= "";
# unsafe meta access, ok?
return $META->{readwrite}{$class}{$id} if exists $META->{readwrite}{$class}{$id};
@@ -1323 +1330,3 @@
- $META->{readwrite}{$class}{$id} ||= $class->new(ID => $id);
+ my $ro = $META->{readonly}{$class}{$id};
+ $META->{readwrite}{$class}{$id} ||=
+ $class->new(ID => $id, defined($ro) ? (RO => $ro) : ());
}

#-> sub CPAN::new ;
@@ -1441,7 +1450,10 @@
if ($foul) {
$CPAN::Frontend->mywarn("Lost build_dir detected ($foul), giving up all cached test results of currently running session.\n");
for my $dbd (sort keys %{$self->{is_tested}}) { # distro-build-dir
@@ -1444 +1453,4 @@
- SEARCH: for my $d (sort { $a->id cmp $b->id } $CPAN::META->all_objects("CPAN::Distribution")) {
+ # build_dir and test state exist only on mutable objects touched in
+ # this session; cached read-only distributions cannot match here.
+ SEARCH: for my $d (sort { $a->id cmp $b->id }
+ values %{ $CPAN::META->{readwrite}{'CPAN::Distribution'} || {} }) {
if ($d->{build_dir} && $d->{build_dir} eq $dbd) {
$CPAN::Frontend->mywarn(sprintf "Flushing cache for %s\n", $d->pretty_id);
$d->fforce("");
@@ -1479 +1491,2 @@
- my @dirs = map {("$_/blib/arch", "$_/blib/lib")} $self->_list_sorted_descending_is_tested;
+ my @tested_build_dirs = $self->_list_sorted_descending_is_tested;
+ my @dirs = map {("$_/blib/arch", "$_/blib/lib")} @tested_build_dirs;
@@ -1480,0 +1494,9 @@
+
+ # set_perl5lib is called at every distribution phase. Feeding the
+ # PERL5LIB produced by the previous call back into the next one used to
+ # duplicate the complete dependency graph repeatedly. Large graphs such
+ # as Dist::Zilla's eventually consumed gigabytes while CPAN rescanned the
+ # same paths. Preserve first-seen order while making phase setup
+ # idempotent.
+ my %seen_perllib;
+ my @combined_dirs = grep { !$seen_perllib{$_}++ } @dirs, @env;
@@ -1481,0 +1504,18 @@
+ # A tested-but-not-yet-installed prerequisite can provide command-line
+ # tools as well as Perl libraries. CPAN already exposes its blib/lib and
+ # blib/arch through PERL5LIB; expose blib/script through PATH for the same
+ # lifetime. This lets downstream build rules invoke declared tools such
+ # as Template Toolkit's `tpage` without prematurely installing the
+ # prerequisite. Repeated phase setup must remain idempotent because the
+ # same dependency graph is visited during configure, make, and test.
+ my @script_dirs = grep { -d $_ }
+ map { "$_/blib/script" } @tested_build_dirs;
+ if (@script_dirs) {
+ my @path = defined($ENV{PATH}) && length($ENV{PATH})
+ ? split(/\Q$Config::Config{path_sep}\E/, $ENV{PATH})
+ : ();
+ my %seen;
+ $ENV{PATH} = join $Config::Config{path_sep},
+ grep { !$seen{$_}++ } @script_dirs, @path;
+ }
+
@@ -1484 +1524 @@
- $ENV{PERL5LIB} = join $Config::Config{path_sep}, @dirs, @env;
+ $ENV{PERL5LIB} = join $Config::Config{path_sep}, @combined_dirs;
@@ -1494 +1534 @@
- $ENV{PERL5LIB} = join $Config::Config{path_sep}, @dirs, @env;
+ $ENV{PERL5LIB} = join $Config::Config{path_sep}, @combined_dirs;
@@ -1497 +1537 @@
- my $newenv = join $Config::Config{path_sep}, @dirs, @env;
+ my $newenv = join $Config::Config{path_sep}, @combined_dirs;
172 changes: 0 additions & 172 deletions dev/modules/Memoize.md

This file was deleted.

13 changes: 5 additions & 8 deletions src/main/perl/lib/I18N/LangTags/List.pm
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

require 5;
package I18N::LangTags::List;
# Time-stamp: "2004-10-06 23:26:21 ADT"
use strict;
our (%Name, %Is_Disrec, $Debug);
our $VERSION = '0.41';
our $VERSION = '0.42';
# POD at the end.

#----------------------------------------------------------------------
Expand All @@ -14,19 +11,19 @@ our $VERSION = '0.41';
my $count = 0;
my($disrec,$tag,$name);
my $last_name = '';
while(<I18N::LangTags::List::DATA>) {
while(my $line = <DATA>) {
if($seeking) {
$seeking = 0 if m/=for woohah/;
$seeking = 0 if $line =~ m/=for woohah/;
} elsif( ($disrec, $tag, $name) =
m/(\[?)\{([-0-9a-zA-Z]+)\}(?:\s*:)?\s*([^\[\]]+)/
$line =~ m/(\[?)\{([-0-9a-zA-Z]+)\}(?:\s*:)?\s*([^\[\]]+)/
) {
$name =~ s/\s*[;\.]*\s*$//g;
next unless $name;
++$count;
print "<$tag> <$name>\n" if $Debug;
$last_name = $Name{$tag} = $name;
$Is_Disrec{$tag} = 1 if $disrec;
} elsif (m/[Ff]ormerly \"([-a-z0-9]+)\"/) {
} elsif ($line =~ m/[Ff]ormerly \"([-a-z0-9]+)\"/) {
$Name{$1} = "$last_name (old tag)" if $last_name;
$Is_Disrec{$1} = 1;
}
Expand Down
Loading
Loading