| 1 | #!/usr/bin/perl -w | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||
| 4 | # line 4 | ||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | |||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 9 | use Getopt::Long; | ||||||||||||||||||||||||||||||||||||
| 10 | 3 | ||||||||||||||||||||||||||||||||||||
| 11 | our $Id = substr q$Id: patchaperlup 310 2009-02-21 14:45:30Z k $, 4; | ||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | |||||||||||||||||||||||||||||||||||
|
Condition50%1/2
{'darwin', 'gzcat'}->{$^O} || 'zcat'
MC/DC0%0/1
{'darwin', 'gzcat'}->{$^O} || 'zcat'
{'darwin', 'gzcat'}->{$^O}
Truth table50%1/2
A
A= {'darwin', 'gzcat'}->{$^O}
| |||||||||||||||||||||||||||||||||||||
| 13 | our $Zcat = { darwin => 'gzcat' }->{$^O} || 'zcat'; | ||||||||||||||||||||||||||||||||||||
| 14 | 3 | ||||||||||||||||||||||||||||||||||||
| 15 | our %Opt = (); | ||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Subroutine
find_patchls: not called CC=4 SCAR=24.6
| |||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | sub find_patchls { | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 18 | 0 | use File::Spec; | |||||||||||||||||||||||||||||||||||
| 19 | 0 | my $res; | |||||||||||||||||||||||||||||||||||
| 20 | 0 | for my $p (File::Spec->path, "Porting") { | |||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | my $t = File::Spec->catfile($p,"patchls"); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 22 | 0 | if (-x $t) { | |||||||||||||||||||||||||||||||||||
| 23 | 0 | $res = $t; | |||||||||||||||||||||||||||||||||||
| 24 | last; | ||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 27 | $res ? File::Spec->rel2abs($res) : 0; | ||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Subroutine
unCR: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||
| 30 | 0 | sub unCR { | |||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my($f) = shift; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 32 | 0 | return unless -f $f; | |||||||||||||||||||||||||||||||||||
| 33 | 0 | local *UNCR; | |||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | local $/; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 35 | 0 | open UNCR, "<$f" or die "Could not open <$f: $!"; | |||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my $content = <UNCR>; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | close UNCR or die "Could not close $f: $!"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 38 | 0 | $content =~ s/\015//g or return; | |||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my($dev,$inode,$mode) = stat $f; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | unlink $f or die "Could not unlink $f: $!"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 41 | 0 | open UNCR, ">$f" or die "Could not open >$f: $!"; | |||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | print UNCR $content; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 43 | 0 | close UNCR or die "Could not close $f: $!"; | |||||||||||||||||||||||||||||||||||
| 44 | chmod $mode, $f; | ||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Subroutine
contains_cr: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||
| 47 | 0 | sub contains_cr { | |||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my($file) = shift; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 49 | 0 | open F, $file or die "Couldn't open $file: $!"; | |||||||||||||||||||||||||||||||||||
| 50 | 0 | local($/) = "\n"; | |||||||||||||||||||||||||||||||||||
| 51 | 0 | my $firstline = <F>; | |||||||||||||||||||||||||||||||||||
| 52 | $firstline =~ /\cM/; | ||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||
| 54 | 2 | ▶ | |||||||||||||||||||||||||||||||||||
|
Subroutine
usage: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 55 | 2 | sub usage () { | |||||||||||||||||||||||||||||||||||
| 56 | "Usage $0 | ||||||||||||||||||||||||||||||||||||
| 57 | --perldir perldirectory-to-alter | ||||||||||||||||||||||||||||||||||||
| 58 | --diffdir patchdirectory | ||||||||||||||||||||||||||||||||||||
| 59 | [--writedotpatch] | ||||||||||||||||||||||||||||||||||||
| 60 | [--branch branch defaults to perl (the trunk)] | ||||||||||||||||||||||||||||||||||||
| 61 | [--start number-of-first-patch] | ||||||||||||||||||||||||||||||||||||
| 62 | [--upto number-of-last-patch] | ||||||||||||||||||||||||||||||||||||
| 63 | [--quiet] | ||||||||||||||||||||||||||||||||||||
| 64 | [--verbose] | ||||||||||||||||||||||||||||||||||||
| 65 | [--nounlink] | ||||||||||||||||||||||||||||||||||||
| 66 | [--version] | ||||||||||||||||||||||||||||||||||||
| 67 | [--h]"; | ||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Subroutine
verbose: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub verbose { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 71 | 0 | return if $Opt{quiet}; | |||||||||||||||||||||||||||||||||||
| 72 | printf STDERR @_; | ||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||
| 75 | MAIN: { | ||||||||||||||||||||||||||||||||||||
| 76 | 3 | ||||||||||||||||||||||||||||||||||||
| 77 | GetOptions( | ||||||||||||||||||||||||||||||||||||
| 78 | \%Opt, | ||||||||||||||||||||||||||||||||||||
| 79 | "branch=s", | ||||||||||||||||||||||||||||||||||||
| 80 | "diffdir=s", | ||||||||||||||||||||||||||||||||||||
| 81 | "h!", | ||||||||||||||||||||||||||||||||||||
| 82 | "nounlink!", | ||||||||||||||||||||||||||||||||||||
| 83 | "perldir=s", | ||||||||||||||||||||||||||||||||||||
| 84 | "quiet!", | ||||||||||||||||||||||||||||||||||||
| 85 | "start=i", | ||||||||||||||||||||||||||||||||||||
| 86 | "upto=i", | ||||||||||||||||||||||||||||||||||||
| 87 | "verbose+", | ||||||||||||||||||||||||||||||||||||
| 88 | "version+", | ||||||||||||||||||||||||||||||||||||
| 89 | "writedotpatch!", | ||||||||||||||||||||||||||||||||||||
| 90 | ); | ||||||||||||||||||||||||||||||||||||
| 91 | 3 | ||||||||||||||||||||||||||||||||||||
| 92 | 3 | ▶ | print "Version: $Id\n"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 93 | 1 | if ($Opt{version}) { | |||||||||||||||||||||||||||||||||||
| 94 | exit; | ||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||
| 96 | 2 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$main::Opt{'h'} && (print(&usage()) && exit)
print &usage() and exit
MC/DC0%0/2
$main::Opt{'h'} && (print(&usage()) && exit)
$main::Opt{'h'}
print &usage()
Truth table0%0/3
A && B
A= $main::Opt{'h'}B= print &usage()
| |||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | print usage and exit if $Opt{h}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $perldir = $Opt{perldir} or die usage; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | my $diffdir = $Opt{diffdir} or die usage; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$main::Opt{"verbose"} ||= 0
MC/DC0%0/1
$main::Opt{"verbose"} ||= 0
$main::Opt{"verbose"}
Truth table0%0/2
A
A= $main::Opt{"verbose"}
| |||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $Opt{verbose} ||= 0; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$main::Opt{"branch"} ||= "perl"
MC/DC0%0/1
$main::Opt{"branch"} ||= "perl"
$main::Opt{"branch"}
Truth table0%0/2
A
A= $main::Opt{"branch"}
| |||||||||||||||||||||||||||||||||||||
| 101 | $Opt{branch} ||= "perl"; | ||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 103 | 0 | die "perldir[$perldir] not found" unless -d $perldir; | |||||||||||||||||||||||||||||||||||
| 104 | 0 | print "Perldir: $perldir\n"; | |||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | my $already_patched; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 106 | 0 | if (defined $Opt{start}) { | |||||||||||||||||||||||||||||||||||
| 107 | $already_patched = $Opt{start}-1; | ||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | } else { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ( open F, "$perldir/Changes" ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | while (<F>) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 111 | 0 | next unless /^\[\s*(\d+)\]\sBy:\s/; # //; | |||||||||||||||||||||||||||||||||||
| 112 | 0 | $already_patched = $1; | |||||||||||||||||||||||||||||||||||
| 113 | last; | ||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||
| 115 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 116 | warn "PAPU: Couldn't open $perldir/Changes: $!"; | ||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 118 | 0 | unless ($already_patched) { | |||||||||||||||||||||||||||||||||||
| 119 | die "PAPU: Could not determine last integrated patch via $perldir/Changes | ||||||||||||||||||||||||||||||||||||
| 120 | Need --start option to determine the first patch to apply"; | ||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||
| 122 | 0 | } | |||||||||||||||||||||||||||||||||||
| 123 | $|=1; | ||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 125 | 0 | die "diffdir[$diffdir] not found" unless -d $diffdir; | |||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | print "Diffdir: $diffdir\n"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 127 | my $diffdir_abs = File::Spec->file_name_is_absolute($diffdir) ? | ||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $diffdir : File::Spec->catdir(Cwd::cwd,$diffdir); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 129 | 0 | opendir DIR, $diffdir_abs or die "Couldn't opendir $diffdir_abs: $!"; | |||||||||||||||||||||||||||||||||||
| 130 | 0 | my @diffs = sort { $a <=> $b } grep s/^(\d+)\.gz/$1/, readdir DIR; | |||||||||||||||||||||||||||||||||||
| 131 | 0 | closedir DIR; | |||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my $first_diff = $diffs[0]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | die "\$already_patched undefined!" unless defined $already_patched; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | die "\$diffs[0] undefined!" unless defined $diffs[0]; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 135 | 0 | if ($already_patched > $diffs[0]) { | |||||||||||||||||||||||||||||||||||
| 136 | verbose "Your patchdirectory starts with patch %d, but your perldir | ||||||||||||||||||||||||||||||||||||
| 137 | has the patches up to %d already applied. Skipping those not needed. | ||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | ", $diffs[0], $already_patched; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 139 | shift @diffs while $diffs[0] <= $already_patched; | ||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||
| 142 | # Now it is possible that the first patch we have here is only | ||||||||||||||||||||||||||||||||||||
| 143 | # patching the Changes file and that this patch has already been | ||||||||||||||||||||||||||||||||||||
| 144 | # applied during the release. We need to be more tolerant on the first | ||||||||||||||||||||||||||||||||||||
| 145 | # patch. | ||||||||||||||||||||||||||||||||||||
| 146 | 0 | ||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $latest_diff = $diffs[-1]; | |||||||||||||||||||||||||||||||||||
| 148 | 0 | $latest_diff =~ s/\D.*//; | |||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | for my $arg (qw(upto start)) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ($Opt{$arg}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 151 | 0 | if ($Opt{$arg} > $latest_diff) { | |||||||||||||||||||||||||||||||||||
| 152 | warn "PAPU: Option for $arg\[$Opt{$arg}] bigger than | ||||||||||||||||||||||||||||||||||||
| 153 | 0 | latest[$latest_diff]. Won't apply any patch.\a\n"; | |||||||||||||||||||||||||||||||||||
| 154 | sleep 5; | ||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 156 | 0 | if ($Opt{$arg}<$diffs[0]) { | |||||||||||||||||||||||||||||||||||
| 157 | die "Invalid option for $arg\[$Opt{$arg}], must be between $first_diff and $latest_diff\n"; | ||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | } else { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ($arg eq "upto") { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@diffs and $diffs[-1] > $main::Opt{$arg}
MC/DC0%0/2
@diffs and $diffs[-1] > $main::Opt{$arg}
@diffs
$diffs[-1] > $main::Opt{$arg}
Truth table0%0/3
A and B
A= @diffsB= $diffs[-1] > $main::Opt{$arg}
| |||||||||||||||||||||||||||||||||||||
| 160 | 0 | pop @diffs while @diffs && $diffs[-1] > $Opt{$arg}; | |||||||||||||||||||||||||||||||||||
| 161 | $latest_diff = $Opt{$arg}; | ||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | } else { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@diffs and $diffs[0] < $main::Opt{$arg}
MC/DC0%0/2
@diffs and $diffs[0] < $main::Opt{$arg}
@diffs
$diffs[0] < $main::Opt{$arg}
Truth table0%0/3
A and B
A= @diffsB= $diffs[0] < $main::Opt{$arg}
| |||||||||||||||||||||||||||||||||||||
| 163 | shift @diffs while @diffs && $diffs[0] < $Opt{$arg}; | ||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 168 | 0 | chdir $perldir or die "Couldn't chdir to $perldir: $!"; | |||||||||||||||||||||||||||||||||||
| 169 | 0 | my @fails; | |||||||||||||||||||||||||||||||||||
| 170 | 0 | verbose "Prescanning all patch files for contents\n"; | |||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | my $tmpfile = "tmp.patchls.$$"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 172 | my $patchls = find_patchls() or | ||||||||||||||||||||||||||||||||||||
| 173 | die "Couldn't find patchls utility in PATH nor in Porting/ directory. | ||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||
| 175 | ### Please install the small perl program 'patchls' in your path. You find it in | ||||||||||||||||||||||||||||||||||||
| 176 | ### perl 5.8.3 in the Porting/ directory. Do not use an older version of it. | ||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||
| 178 | 0 | "; | |||||||||||||||||||||||||||||||||||
| 179 | 0 | open F, "| perl $patchls - > $tmpfile"; | |||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | for my $d ( @diffs ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 181 | 0 | verbose "\r%10s of %10s to %10s", $d, $diffs[0], $diffs[-1] unless $d % 100; | |||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | my $pathdiff = "$diffdir_abs/$d.gz"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 183 | 0 | warn "Couldn't find pathdiff[$pathdiff]",next unless -f $pathdiff; | |||||||||||||||||||||||||||||||||||
| 184 | 0 | open G, "$Zcat $pathdiff|"; | |||||||||||||||||||||||||||||||||||
| 185 | 0 | local $/; | |||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | print F <G>; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 187 | close G or die "Could not run '$Zcat $pathdiff': $!"; | ||||||||||||||||||||||||||||||||||||
| 188 | 0 | } | |||||||||||||||||||||||||||||||||||
| 189 | 0 | close F; | |||||||||||||||||||||||||||||||||||
| 190 | verbose "\n"; | ||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 192 | 0 | open F, $tmpfile or die "Couldn't open $tmpfile: $!"; | |||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | my %pfiles; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 194 | 0 | while (<F>) { | |||||||||||||||||||||||||||||||||||
| 195 | 0 | s/^-:\s//; | |||||||||||||||||||||||||||||||||||
| 196 | 0 | chomp $_; | |||||||||||||||||||||||||||||||||||
| 197 | 0 | my @pfiles = grep { -f $_ } split m{ }, $_; | |||||||||||||||||||||||||||||||||||
| 198 | @pfiles{@pfiles} = (); | ||||||||||||||||||||||||||||||||||||
| 199 | 0 | } | |||||||||||||||||||||||||||||||||||
| 200 | 0 | close F; | |||||||||||||||||||||||||||||||||||
| 201 | unlink $tmpfile; | ||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||
| 203 | # at the time of patch 7632, some files in the repository were changed | ||||||||||||||||||||||||||||||||||||
| 204 | 0 | # to contain no CR | |||||||||||||||||||||||||||||||||||
| 205 | if (1) { | ||||||||||||||||||||||||||||||||||||
| 206 | 0 | ||||||||||||||||||||||||||||||||||||
| 207 | 0 | @ARGV = grep contains_cr($_), keys %pfiles; | |||||||||||||||||||||||||||||||||||
| 208 | @ARGV = grep !m!lib/unicode/syllables.txt!, @ARGV; | ||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 210 | 0 | if (@ARGV) { | |||||||||||||||||||||||||||||||||||
| 211 | 0 | verbose "Removing CR from %d files:\n", scalar @ARGV; | |||||||||||||||||||||||||||||||||||
| 212 | 0 | $^I = ".withCR"; | |||||||||||||||||||||||||||||||||||
| 213 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my $b = 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 215 | while (<>) { | ||||||||||||||||||||||||||||||||||||
| 216 | 0 | # in 5.7.1 we had files that contained 0x0d0d0a on line endings | |||||||||||||||||||||||||||||||||||
| 217 | 0 | s/[\r\n]+\z/\n/; | |||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | print; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 219 | 0 | if (eof(ARGV)) { | |||||||||||||||||||||||||||||||||||
| 220 | verbose "%s\n", $ARGV; | ||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||
| 222 | 0 | } | |||||||||||||||||||||||||||||||||||
| 223 | 0 | my $lines = $.; | |||||||||||||||||||||||||||||||||||
| 224 | verbose "\n"; | ||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||
| 227 | # 2006-02-25: upto bleadperl 27302 we always had -N as a switch here | ||||||||||||||||||||||||||||||||||||
| 228 | # but then 27302 was a straight reverse and -N was inappropriate. I | ||||||||||||||||||||||||||||||||||||
| 229 | # seem to recall that -N had a reasoning to prevent patch from being | ||||||||||||||||||||||||||||||||||||
| 230 | # clever, but now I remove it and wait what breaks... Aaah, removing | ||||||||||||||||||||||||||||||||||||
| 231 | # -N does not help here, so the bug is somewhere else... I see that | ||||||||||||||||||||||||||||||||||||
| 232 | # the perforce change #252 to sv.h is in both 27297 and in 27302, so | ||||||||||||||||||||||||||||||||||||
| 233 | # we should treat it as a APC bug. But we need to skip | ||||||||||||||||||||||||||||||||||||
| 234 | # //depot/perl/sv.h#252 in 27302 now. | ||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||
| 236 | # 2006-07-03 akoenig: patch number 28434 was the first one needing a | ||||||||||||||||||||||||||||||||||||
| 237 | # fuzz factor of 3. I have not investigated who is to blame for that. | ||||||||||||||||||||||||||||||||||||
| 238 | 0 | ||||||||||||||||||||||||||||||||||||
| 239 | our %SKIP = map { $_ => undef } ( | ||||||||||||||||||||||||||||||||||||
| 240 | "//depot/perl/ext/Thread/die.t#1", | ||||||||||||||||||||||||||||||||||||
| 241 | "//depot/perl/ext/Thread/die2.t#1", | ||||||||||||||||||||||||||||||||||||
| 242 | "//depot/perl/ext/B/B/Asmdata.pm#3", | ||||||||||||||||||||||||||||||||||||
| 243 | "//depot/perl/ext/Errno/Errno_pm.PL#1", | ||||||||||||||||||||||||||||||||||||
| 244 | "//depot/perl/ext/Errno/Makefile.PL#1", | ||||||||||||||||||||||||||||||||||||
| 245 | "//depot/perl/t/lib/errno.t#1", | ||||||||||||||||||||||||||||||||||||
| 246 | "//depot/perl/MANIFEST#110", | ||||||||||||||||||||||||||||||||||||
| 247 | "//depot/perl/t/op/tr.t#1", | ||||||||||||||||||||||||||||||||||||
| 248 | "//depot/perl/pod/perlop.pod#22", | ||||||||||||||||||||||||||||||||||||
| 249 | "//depot/perl/lib/ExtUtils/MM_Cygwin.pm#5", | ||||||||||||||||||||||||||||||||||||
| 250 | "//depot/perl/t/op/utf8decode.t#4", | ||||||||||||||||||||||||||||||||||||
| 251 | "//depot/perl/t/op/utf8decode.t#5", | ||||||||||||||||||||||||||||||||||||
| 252 | "//depot/perl/t/op/utf8decode.t#6", | ||||||||||||||||||||||||||||||||||||
| 253 | "//depot/perl/t/op/utf8decode.t#7", | ||||||||||||||||||||||||||||||||||||
| 254 | "//depot/perl/t/op/utf8decode.t#8", | ||||||||||||||||||||||||||||||||||||
| 255 | "//depot/perl/t/op/utf8decode.t#9", | ||||||||||||||||||||||||||||||||||||
| 256 | "//depot/perl/t/op/utf8decode.t#10", | ||||||||||||||||||||||||||||||||||||
| 257 | "//depot/perl/sv.h#252", | ||||||||||||||||||||||||||||||||||||
| 258 | "//depot/perl/pod/perlmodlib.pod#76", # 21543 | ||||||||||||||||||||||||||||||||||||
| 259 | "//depot/perl/pod/perltoc.pod#193", # 21543 | ||||||||||||||||||||||||||||||||||||
| 260 | "//depot/perl/pod/buildtoc#27", # 21544 | ||||||||||||||||||||||||||||||||||||
| 261 | 0 | ); | |||||||||||||||||||||||||||||||||||
| 262 | 0 | our %OVERRIDE_SKIP; | |||||||||||||||||||||||||||||||||||
| 263 | $OVERRIDE_SKIP{"//depot/perl/sv.h#252"}{27297} = undef; # apply | ||||||||||||||||||||||||||||||||||||
| 264 | 0 | ||||||||||||||||||||||||||||||||||||
| 265 | our %TOUCH = map { $_ => undef } ( | ||||||||||||||||||||||||||||||||||||
| 266 | "//depot/perl/ext/threads/shared/typemap#4" | ||||||||||||||||||||||||||||||||||||
| 267 | ); | ||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||
| 269 | # 2006-11-30 akoenig: patch number 29196 was the first to need a -p2 | ||||||||||||||||||||||||||||||||||||
| 270 | 0 | # and I have reported as bug in APC... | |||||||||||||||||||||||||||||||||||
| 271 | our %PSWITCH = ( | ||||||||||||||||||||||||||||||||||||
| 272 | # 29196 => "-p2", ...and Philippe M. Chiasson fixed it the same day | ||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||
| 274 | 0 | ||||||||||||||||||||||||||||||||||||
| 275 | our %CREATE = | ||||||||||||||||||||||||||||||||||||
| 276 | ( | ||||||||||||||||||||||||||||||||||||
| 277 | # perl -e 'use Data::Dumper; open my $fh, shift or die; local $/; $Data::Dumper::Terse=1; $Data::Dumper::Useqq=1; print Dumper <$fh>;' APC/perl-current/t/op/regexp_unicode_prop_thr.t | ||||||||||||||||||||||||||||||||||||
| 278 | "//depot/perl/t/op/regexp_unicode_prop_thr.t#1" => "#!./perl\n\nchdir 't' if -d 't';\n\@INC = ('../lib', '.');\n\nrequire 'thread_it.pl';\nthread_it(qw(op regexp_unicode_prop.t));\n", | ||||||||||||||||||||||||||||||||||||
| 279 | ); | ||||||||||||||||||||||||||||||||||||
| 280 | 0 | ||||||||||||||||||||||||||||||||||||
| 281 | 0 | for my $d ( @diffs ) { | |||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | my $pathdiff = "$diffdir_abs/$d.gz"; | ||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$main::PSWITCH{$d} || '-p1'
MC/DC0%0/1
$main::PSWITCH{$d} || '-p1'
$main::PSWITCH{$d}
Truth table0%0/2
A
A= $main::PSWITCH{$d}
| |||||||||||||||||||||||||||||||||||||
| 283 | my $pswitch = $PSWITCH{$d} || "-p1"; | ||||||||||||||||||||||||||||||||||||
| 284 | my $patchcommand = sprintf( | ||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | "patch %s -g0 %s -N --fuzz=3", | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 286 | $Opt{verbose}>0 ? "" : "-s", | ||||||||||||||||||||||||||||||||||||
| 287 | $pswitch, | ||||||||||||||||||||||||||||||||||||
| 288 | ); | ||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | verbose "\rapplying %s # for %d\n", $patchcommand, $d | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$main::Opt{"verbose"} > 0 and not $d % 100
MC/DC0%0/2
$main::Opt{"verbose"} > 0 and not $d % 100
$main::Opt{"verbose"} > 0
not $d % 100
Truth table0%0/3
A and not(B)
A= $main::Opt{"verbose"} > 0B= not $d % 100
| |||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if $Opt{verbose}>0 and not $d % 100; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 292 | print "Firstpatch: $d\n" if $d==$diffs[0]; | ||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||
| 294 | 0 | # First do the deletes, they are not line by line in the patches | |||||||||||||||||||||||||||||||||||
| 295 | 0 | local *Z; | |||||||||||||||||||||||||||||||||||
| 296 | 0 | open Z, "$Zcat $pathdiff |"; | |||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | my $indexseen; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | while (<Z>) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 299 | $indexseen++, last if /^Index/; | ||||||||||||||||||||||||||||||||||||
| 300 | 0 | } | |||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | open Z, "$Zcat $pathdiff |"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | while (<Z>) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | last if /^Differences\s/; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 304 | 0 | next unless m{^\s*\.\.\. //.+perl/(.+)#\d+ delete$}; | |||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | my $delfile = $1; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 306 | 0 | unless (-f $delfile){ | |||||||||||||||||||||||||||||||||||
| 307 | 0 | warn "PAPU warning: Could not find $delfile for deletion, ignoring"; | |||||||||||||||||||||||||||||||||||
| 308 | next; | ||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 310 | unlink $delfile or die "Could not unlink $delfile: $!"; | ||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | # we must remove directories that become empty | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | while ($delfile =~ s|/[^/]+$||) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 313 | last unless rmdir $delfile; # usually fails | ||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 317 | 0 | next unless $indexseen; # pre-filter garbage patches | |||||||||||||||||||||||||||||||||||
| 318 | 0 | my $pouth; # "patch-out-handle" | |||||||||||||||||||||||||||||||||||
| 319 | 0 | my $poutf = "tmp.patch.$$.out"; # "patch-out-file" | |||||||||||||||||||||||||||||||||||
| 320 | 0 | open $pouth, "| $patchcommand > $poutf 2>&1"; | |||||||||||||||||||||||||||||||||||
| 321 | 0 | my $curbranch = ''; | |||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | my $skip = 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | DIFFLINE: while (<Z>) { | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 324 | 0 | if (m[^==== (//depot/((?:[^/]+/)?perl)/([^#]+)#\d+) \((.*?)\)]) { | |||||||||||||||||||||||||||||||||||
| 325 | 0 | my $repopath = $1; | |||||||||||||||||||||||||||||||||||
| 326 | 0 | $curbranch = $2; | |||||||||||||||||||||||||||||||||||
| 327 | my $f = $3; | ||||||||||||||||||||||||||||||||||||
| 328 | 0 | # warn "file[$f]curbranch[$curbranch]Opt{branch}[$Opt{branch}]"; | |||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $type = $4; | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
exists $main::SKIP{$repopath} and not exists $main::OVERRIDE_SKIP{$repopath}{$d}
MC/DC0%0/2
exists $main::SKIP{$repopath} and not exists $main::OVERRIDE_SKIP{$repopath}{$d}
exists $main::SKIP{$repopath}
not exists $main::OVERRIDE_SKIP{$repopath}{$d}
Truth table0%0/3
A and not(B)
A= exists $main::SKIP{$repopath}B= not exists $main::OVERRIDE_SKIP{$repopath}{$d}
| |||||||||||||||||||||||||||||||||||||
| 330 | if ( | ||||||||||||||||||||||||||||||||||||
| 331 | exists $SKIP{$repopath} | ||||||||||||||||||||||||||||||||||||
| 332 | and not exists $OVERRIDE_SKIP{$repopath}{$d} | ||||||||||||||||||||||||||||||||||||
| 333 | 0 | ) { | |||||||||||||||||||||||||||||||||||
| 334 | 0 | warn "PAPU warning: deliberately skipping $repopath\n"; | |||||||||||||||||||||||||||||||||||
| 335 | 0 | $skip = 1; | |||||||||||||||||||||||||||||||||||
| 336 | next; | ||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | } elsif (exists $TOUCH{$repopath}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 338 | 0 | open my $fh, ">", $f or die; | |||||||||||||||||||||||||||||||||||
| 339 | next DIFFLINE; | ||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | } elsif (exists $CREATE{$repopath}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 341 | 0 | open my $fh, ">", $f or die; | |||||||||||||||||||||||||||||||||||
| 342 | 0 | print $fh $CREATE{$repopath}; | |||||||||||||||||||||||||||||||||||
| 343 | next DIFFLINE; | ||||||||||||||||||||||||||||||||||||
| 344 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 345 | $skip = 0; | ||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $type =~ /text/ or $type =~ /binary|ktext/
MC/DC0%0/2
not $type =~ /text/ or $type =~ /binary|ktext/
not $type =~ /text/
$type =~ /binary|ktext/
Truth table0%0/3
not(A) or B
A= not $type =~ /text/B= $type =~ /binary|ktext/
| |||||||||||||||||||||||||||||||||||||
| 347 | 0 | if ($type !~ /text/ || $type =~ /binary|ktext/) { | |||||||||||||||||||||||||||||||||||
| 348 | warn "PAPU warning: patch contains" | ||||||||||||||||||||||||||||||||||||
| 349 | ." file $f (type $type), skipped\n"; | ||||||||||||||||||||||||||||||||||||
| 350 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 351 | unCR($f); | ||||||||||||||||||||||||||||||||||||
| 352 | 0 | } | |||||||||||||||||||||||||||||||||||
| 353 | next; | ||||||||||||||||||||||||||||||||||||
| 354 | } elsif (m[^==== //depot/([^/]+)/]) { | ||||||||||||||||||||||||||||||||||||
| 355 | 0 | # Not one of the branches we support (e.g. perlio in 13945) | |||||||||||||||||||||||||||||||||||
| 356 | $curbranch = $1; | ||||||||||||||||||||||||||||||||||||
| 357 | # warn "curbranch[$curbranch]"; | ||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | next if $skip; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if ($Opt{branch}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($curbranch) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$curbranch eq qq[$main::Opt{"branch"}/perl] or $curbranch eq $main::Opt{"branch"}
MC/DC0%0/2
$curbranch eq qq[$main::Opt{"branch"}/perl] or $curbranch eq $main::Opt{"branch"}
$curbranch eq qq[$main::Opt{"branch"}/perl]
$curbranch eq $main::Opt{"branch"}
Truth table0%0/3
A or B
A= $curbranch eq qq[$main::Opt{"branch"}/perl]B= $curbranch eq $main::Opt{"branch"}
| |||||||||||||||||||||||||||||||||||||
| 362 | 0 | if ($curbranch eq "$Opt{branch}/perl" || $curbranch eq $Opt{branch}) { | |||||||||||||||||||||||||||||||||||
| 363 | 0 | s/\015//g; | |||||||||||||||||||||||||||||||||||
| 364 | print $pouth $_; | ||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||
| 367 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 368 | 0 | s/\015//g; | |||||||||||||||||||||||||||||||||||
| 369 | print $pouth $_; | ||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 372 | 0 | close Z or die "Could not run '$Zcat $pathdiff': $!"; | |||||||||||||||||||||||||||||||||||
| 373 | 0 | close $pouth; # may fail | |||||||||||||||||||||||||||||||||||
| 374 | 0 | my $poutfail = $?; | |||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | local $/; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 376 | 0 | open $pouth, $poutf or die "Could not open $poutf: $!"; | |||||||||||||||||||||||||||||||||||
| 377 | 0 | my $pout = <$pouth>; | |||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | close $pouth; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | unlink $poutf or die "Could not unlink $poutf: $!"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pout or $poutfail
MC/DC0%0/2
$pout or $poutfail
$pout
$poutfail
Truth table0%0/3
A or B
A= $poutB= $poutfail
| |||||||||||||||||||||||||||||||||||||
| 380 | warn "\n----stdout+err patching $d (ret=$poutfail)---\n$pout----EOF----\n" | ||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if $pout || $poutfail; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | if ($poutfail == 0) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 383 | verbose "\rapplied patch # %s.%s", $d, $Opt{verbose}>0 ? "\n" : " "; | ||||||||||||||||||||||||||||||||||||
| 384 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 385 | 0 | my $ls = `$Zcat $pathdiff | perl $patchls -`; | |||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | chomp $ls; | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||
| 387 | 0 | if ($ls eq "-: Changes") { | |||||||||||||||||||||||||||||||||||
| 388 | warn "PAPU $d: Patch error on 'Changes' file ignored.\n"; | ||||||||||||||||||||||||||||||||||||
| 389 | 0 | } elsif ($pout =~ /patch: \*\*\*\* Only garbage was found in the patch input./) { | |||||||||||||||||||||||||||||||||||
| 390 | ▶ | warn "PAPU $d: 'Only Garbage' patch error ignored.\n"; | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$pout =~ /Reversed .* patch detected!/ and $d - $already_patched < 4
MC/DC0%0/2
$pout =~ /Reversed .* patch detected!/ and $d - $already_patched < 4
$pout =~ /Reversed .* patch detected!/
$d - $already_patched < 4
Truth table0%0/3
A and B
A= $pout =~ /Reversed .* patch detected!/B= $d - $already_patched < 4
| |||||||||||||||||||||||||||||||||||||
| 391 | 0 | } elsif ($pout =~ /Reversed .* patch detected!/ && ($d - $already_patched)<4) { | |||||||||||||||||||||||||||||||||||
| 392 | warn "PAPU $d: Reversed patches immediately after a snapshot indicate the failure is likely to be an artifact. Error ignored.\n"; | ||||||||||||||||||||||||||||||||||||
| 393 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | my @rej1; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 395 | 0 | while ($pout =~ /saving rejects to (?:file )?(\S+)\.rej/gc) { | |||||||||||||||||||||||||||||||||||
| 396 | push @rej1, $1; | ||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | |||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 399 | 0 | if (@rej1) { | |||||||||||||||||||||||||||||||||||
| 400 | 0 | my %rej; | |||||||||||||||||||||||||||||||||||
| 401 | 0 | @rej{@rej1}=(); | |||||||||||||||||||||||||||||||||||
| 402 | 0 | for my $f (qw(Changes patchlevel.h)) { | |||||||||||||||||||||||||||||||||||
| 403 | delete $rej{$f}; | ||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$d == 4475 and exists $rej{"djgpp/configure.bat"}
MC/DC0%0/2
$d == 4475 and exists $rej{"djgpp/configure.bat"}
$d == 4475
exists $rej{"djgpp/configure.bat"}
Truth table0%0/3
A and B
A= $d == 4475B= exists $rej{"djgpp/configure.bat"}
| |||||||||||||||||||||||||||||||||||||
| 405 | 0 | if ($d==4475 && exists $rej{"djgpp/configure.bat"}) { | |||||||||||||||||||||||||||||||||||
| 406 | warn "PAPU: Known problem patch 4475 seems harmless: ignoring"; | ||||||||||||||||||||||||||||||||||||
| 407 | 0 | } elsif ($d==32694) { | |||||||||||||||||||||||||||||||||||
| 408 | warn "PAPU: Known problem patch 32694 seems harmless: ignoring"; | ||||||||||||||||||||||||||||||||||||
| 409 | 0 | } elsif ($d==23556) { | |||||||||||||||||||||||||||||||||||
| 410 | warn "PAPU: Known problem patch 23556 seems harmless: ignoring"; | ||||||||||||||||||||||||||||||||||||
| 411 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | my @rej2 = keys %rej; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 413 | 0 | if (@rej2) { | |||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | my $extra = ""; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 415 | 0 | if (@rej2 > 40) { | |||||||||||||||||||||||||||||||||||
| 416 | 0 | $extra = sprintf " AND %d FILES MORE", @rej2-30; | |||||||||||||||||||||||||||||||||||
| 417 | splice @rej2, 30, $#rej2-30; | ||||||||||||||||||||||||||||||||||||
| 418 | 0 | } | |||||||||||||||||||||||||||||||||||
| 419 | 0 | warn "PAPU: Problem with patch $d (files: @rej2$extra)\n"; | |||||||||||||||||||||||||||||||||||
| 420 | push @fails, $d; | ||||||||||||||||||||||||||||||||||||
| 421 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 422 | warn "PAPU $d: Rejects were only on [@rej1]: these can usually be ignored\n"; | ||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||
| 425 | } else { | ||||||||||||||||||||||||||||||||||||
| 426 | 0 | # all other sorts of errors | |||||||||||||||||||||||||||||||||||
| 427 | 0 | warn "PAPU: Registering as a failing patch d[$d]"; | |||||||||||||||||||||||||||||||||||
| 428 | push @fails, $d; | ||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||
| 432 | 0 | } | |||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | verbose "\n"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 434 | 0 | if (@fails) { | |||||||||||||||||||||||||||||||||||
| 435 | 0 | verbose "The following patches had errors:\n"; | |||||||||||||||||||||||||||||||||||
| 436 | 0 | verbose join "", map {"\t$_\n"} @fails; | |||||||||||||||||||||||||||||||||||
| 437 | 0 | verbose "\n"; | |||||||||||||||||||||||||||||||||||
| 438 | die "Errors while patching\n"; | ||||||||||||||||||||||||||||||||||||
| 439 | 0 | } else { | |||||||||||||||||||||||||||||||||||
| 440 | print "Lastpatch: $diffs[-1]\n"; | ||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||
| 443 | 3 | ▶ | # Removing files not in MANIFEST | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 444 | 0 | use ExtUtils::Manifest; | |||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | my @rm = ExtUtils::Manifest::filecheck; | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 446 | 0 | if ($Opt{nounlink}) { | |||||||||||||||||||||||||||||||||||
| 447 | verbose "Keeping files not in MANIFEST: @rm\n"; | ||||||||||||||||||||||||||||||||||||
| 448 | 0 | } elsif (@rm) { | |||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | verbose "Removing files not in MANIFEST: @rm\n"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 450 | unlink @rm or die "Could not unlink @rm: $!"; | ||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | } | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | if ($Opt{writedotpatch}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 453 | 0 | open my $fh, ">", ".patch" or die "Could not open .patch: $!"; | |||||||||||||||||||||||||||||||||||
| 454 | print $fh $diffs[-1], "\n"; | ||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||
| 456 | 0 | ||||||||||||||||||||||||||||||||||||
| 457 | verbose qq{Now you can make a new perl by running e.g.: | ||||||||||||||||||||||||||||||||||||
| 458 | cd $perldir && sh Configure -des && make test | ||||||||||||||||||||||||||||||||||||
| 459 | }; | ||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||
| 462 | __END__ | ||||||||||||||||||||||||||||||||||||