Perl-Repository-APC
view release on metacpan or search on metacpan
scripts/patchaperlup view on Meta::CPAN
has the patches up to %d already applied. Skipping those not needed.
", $diffs[0], $already_patched;
shift @diffs while $diffs[0] <= $already_patched;
}
# Now it is possible that the first patch we have here is only
# patching the Changes file and that this patch has already been
# applied during the release. We need to be more tolerant on the first
# patch.
my $latest_diff = $diffs[-1];
$latest_diff =~ s/\D.*//;
for my $arg (qw(upto start)) {
if ($Opt{$arg}) {
if ($Opt{$arg} > $latest_diff) {
warn "PAPU: Option for $arg\[$Opt{$arg}] bigger than
latest[$latest_diff]. Won't apply any patch.\a\n";
sleep 5;
}
if ($Opt{$arg}<$diffs[0]) {
die "Invalid option for $arg\[$Opt{$arg}], must be between $first_diff and $latest_diff\n";
} else {
if ($arg eq "upto") {
pop @diffs while @diffs && $diffs[-1] > $Opt{$arg};
$latest_diff = $Opt{$arg};
} else {
shift @diffs while @diffs && $diffs[0] < $Opt{$arg};
}
}
}
}
chdir $perldir or die "Couldn't chdir to $perldir: $!";
my @fails;
verbose "Prescanning all patch files for contents\n";
my $tmpfile = "tmp.patchls.$$";
my $patchls = find_patchls() or
die "Couldn't find patchls utility in PATH nor in Porting/ directory.
### Please install the small perl program 'patchls' in your path. You find it in
### perl 5.8.3 in the Porting/ directory. Do not use an older version of it.
";
open F, "| perl $patchls - > $tmpfile";
for my $d ( @diffs ) {
verbose "\r%10s of %10s to %10s", $d, $diffs[0], $diffs[-1] unless $d % 100;
my $pathdiff = "$diffdir_abs/$d.gz";
warn "Couldn't find pathdiff[$pathdiff]",next unless -f $pathdiff;
open G, "$Zcat $pathdiff|";
local $/;
print F <G>;
close G or die "Could not run '$Zcat $pathdiff': $!";
}
close F;
verbose "\n";
open F, $tmpfile or die "Couldn't open $tmpfile: $!";
my %pfiles;
while (<F>) {
s/^-:\s//;
chomp $_;
my @pfiles = grep { -f $_ } split m{ }, $_;
@pfiles{@pfiles} = ();
}
close F;
unlink $tmpfile;
# at the time of patch 7632, some files in the repository were changed
# to contain no CR
if (1) {
@ARGV = grep contains_cr($_), keys %pfiles;
@ARGV = grep !m!lib/unicode/syllables.txt!, @ARGV;
if (@ARGV) {
verbose "Removing CR from %d files:\n", scalar @ARGV;
$^I = ".withCR";
my $i = 0;
my $b = 0;
while (<>) {
# in 5.7.1 we had files that contained 0x0d0d0a on line endings
s/[\r\n]+\z/\n/;
print;
if (eof(ARGV)) {
verbose "%s\n", $ARGV;
}
}
my $lines = $.;
verbose "\n";
}
}
# 2006-02-25: upto bleadperl 27302 we always had -N as a switch here
# but then 27302 was a straight reverse and -N was inappropriate. I
# seem to recall that -N had a reasoning to prevent patch from being
# clever, but now I remove it and wait what breaks... Aaah, removing
# -N does not help here, so the bug is somewhere else... I see that
# the perforce change #252 to sv.h is in both 27297 and in 27302, so
# we should treat it as a APC bug. But we need to skip
# //depot/perl/sv.h#252 in 27302 now.
# 2006-07-03 akoenig: patch number 28434 was the first one needing a
# fuzz factor of 3. I have not investigated who is to blame for that.
our %SKIP = map { $_ => undef } (
"//depot/perl/ext/Thread/die.t#1",
"//depot/perl/ext/Thread/die2.t#1",
"//depot/perl/ext/B/B/Asmdata.pm#3",
"//depot/perl/ext/Errno/Errno_pm.PL#1",
"//depot/perl/ext/Errno/Makefile.PL#1",
"//depot/perl/t/lib/errno.t#1",
"//depot/perl/MANIFEST#110",
"//depot/perl/t/op/tr.t#1",
"//depot/perl/pod/perlop.pod#22",
"//depot/perl/lib/ExtUtils/MM_Cygwin.pm#5",
"//depot/perl/t/op/utf8decode.t#4",
"//depot/perl/t/op/utf8decode.t#5",
"//depot/perl/t/op/utf8decode.t#6",
"//depot/perl/t/op/utf8decode.t#7",
"//depot/perl/t/op/utf8decode.t#8",
"//depot/perl/t/op/utf8decode.t#9",
"//depot/perl/t/op/utf8decode.t#10",
"//depot/perl/sv.h#252",
( run in 1.123 second using v1.01-cache-2.11-cpan-71847e10f99 )