line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Repository::APC::BAP; |
2
|
2
|
|
|
2
|
|
2456
|
use Perl::Repository::APC; |
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
68
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
19
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
78
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2070
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $Id = q$Id: BAP.pm 294 2008-02-22 10:42:30Z k $; |
8
|
|
|
|
|
|
|
our $VERSION = sprintf "%.3f", 1 + substr(q$Rev: 294 $,4)/1000; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
0
|
|
0
|
0
|
|
unless (@_ == 2){ |
12
|
0
|
|
|
|
|
|
require Carp; |
13
|
0
|
|
|
|
|
|
Carp::croak(sprintf "Not enough arguments for %s -> new ()\n", __PACKAGE__); |
14
|
|
|
|
|
|
|
} |
15
|
0
|
|
|
|
|
|
my $proto = shift; |
16
|
0
|
|
0
|
|
|
|
my $class = ref $proto || $proto; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $apc = shift; |
19
|
0
|
|
|
|
|
|
my $self; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$self->{APC} = $apc; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
bless $self => $class; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub translate { |
27
|
0
|
|
|
0
|
1
|
|
my($self,$branch,$baseperl,$patchlevel) = @_; |
28
|
0
|
0
|
|
|
|
|
die sprintf "%s -> translate called without a branch argument", __PACKAGE__ |
29
|
|
|
|
|
|
|
unless $branch; |
30
|
0
|
|
|
|
|
|
my($prev, $nextperl, @patches, @ver); |
31
|
0
|
|
|
|
|
|
my $apc = $self->{APC}; |
32
|
0
|
0
|
|
|
|
|
if ($branch eq "perl") { |
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$prev = "0"; |
34
|
|
|
|
|
|
|
} elsif (my($bv) = $branch =~ /^maint-(.*)/) { |
35
|
|
|
|
|
|
|
# maintainance nightmare: we currently (rev 123) have no access to |
36
|
|
|
|
|
|
|
# any metadata that tell us the perl we need |
37
|
0
|
0
|
|
|
|
|
if ($bv eq "5.004") { |
|
|
0
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$prev = "0"; |
39
|
|
|
|
|
|
|
} elsif ($branch =~ /\//) { # currently only "maint-5.6/perl-5.6.2" |
40
|
0
|
0
|
|
|
|
|
if ($branch eq "maint-5.6/perl-5.6.2") { |
41
|
0
|
|
|
|
|
|
$prev = "5.6.1"; |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
|
die "Illegal value for branch[$branch]"; # carp doesn't make it better |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} else { |
46
|
0
|
|
|
|
|
|
$prev = "$bv.0"; # 5.6 -> 5.6.0 etc. |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
@ver = $prev; |
50
|
0
|
|
|
|
|
|
for ( |
51
|
|
|
|
|
|
|
my $next = $apc->first_in_branch($branch); |
52
|
|
|
|
|
|
|
$next; |
53
|
|
|
|
|
|
|
$next = $apc->next_in_branch($next) |
54
|
|
|
|
|
|
|
) { |
55
|
0
|
|
|
|
|
|
$nextperl = $next; |
56
|
0
|
|
|
|
|
|
@patches = @{$apc->patches($next)}; |
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
push @ver, $next; |
58
|
0
|
0
|
0
|
|
|
|
if ($patchlevel && $patchlevel >= $patches[0] && $patchlevel <= $patches[-1]){ |
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
59
|
0
|
0
|
0
|
|
|
|
if (defined $baseperl && length $baseperl && |
|
0
|
|
0
|
|
|
|
|
60
|
|
|
|
|
|
|
grep { $_ eq $baseperl } @ver) { |
61
|
0
|
0
|
|
|
|
|
unless ($prev eq $baseperl){ |
62
|
0
|
|
|
|
|
|
die "Fatal error: patch $patchlevel is outside the patchset based on $baseperl\n"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
last; |
66
|
|
|
|
|
|
|
} elsif (defined $baseperl && length($baseperl)) { |
67
|
0
|
0
|
|
|
|
|
if ($baseperl eq "0") { |
68
|
0
|
0
|
|
|
|
|
if ($ver[0] eq "0") { |
69
|
0
|
|
|
|
|
|
last; |
70
|
|
|
|
|
|
|
} else { |
71
|
0
|
|
|
|
|
|
die "Fatal error: 0 is not starting point for branch $branch\n"; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} else { |
74
|
0
|
0
|
0
|
|
|
|
last if $prev && $baseperl eq $prev || @ver>1 && $baseperl eq $ver[-2]; |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
$prev = $next; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
0
|
0
|
|
|
|
if (defined $baseperl && length $baseperl) { |
80
|
0
|
0
|
|
|
|
|
if ($baseperl eq "0") { |
81
|
|
|
|
|
|
|
# always OK? |
82
|
|
|
|
|
|
|
} else { |
83
|
0
|
0
|
|
|
|
|
unless (grep { $_ eq $baseperl } @ver){ |
|
0
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
die "Fatal error: $baseperl is not part of branch $branch"; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} else { |
88
|
0
|
0
|
|
|
|
|
if (@ver > 1) { |
|
|
0
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
$baseperl = $ver[-2]; |
90
|
|
|
|
|
|
|
} elsif (@ver == 1) { |
91
|
0
|
|
|
|
|
|
$baseperl = $ver[0]; |
92
|
0
|
|
|
|
|
|
$baseperl =~ s/1$/0/; |
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
die "Could not determine base perl version"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
0
|
0
|
|
|
|
|
if ($patchlevel) { |
98
|
0
|
0
|
|
|
|
|
unless (grep { $_ eq $patchlevel } @patches){ |
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my @neighbors = $self->neighbors($patchlevel,\@patches); |
100
|
0
|
|
|
|
|
|
my $tellmore; |
101
|
0
|
0
|
|
|
|
|
if (@neighbors) { |
102
|
0
|
0
|
|
|
|
|
if (@neighbors == 1) { |
103
|
0
|
|
|
|
|
|
$tellmore = "$neighbors[0] would be"; |
104
|
|
|
|
|
|
|
} else { |
105
|
0
|
|
|
|
|
|
$tellmore = "$neighbors[0] or $neighbors[1] would be"; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} else { |
108
|
0
|
|
|
|
|
|
$tellmore = "Range is from $patches[0] to $patches[-1]"; |
109
|
|
|
|
|
|
|
} |
110
|
0
|
|
|
|
|
|
die "Fatal error: patch $patchlevel is not part of the patchset for $baseperl |
111
|
|
|
|
|
|
|
($tellmore)\n"; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} else { |
114
|
0
|
|
|
|
|
|
$patchlevel = $patches[-1]; |
115
|
|
|
|
|
|
|
} |
116
|
0
|
|
|
|
|
|
my $firstpatch = $patches[0]; |
117
|
0
|
|
|
|
|
|
my $dir = $apc->get_diff_dir($branch,$patchlevel); |
118
|
0
|
|
|
|
|
|
return ($baseperl, $nextperl, $firstpatch, $patchlevel, $dir); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub neighbors { |
122
|
0
|
|
|
0
|
0
|
|
my($self,$x,$arr) = @_; |
123
|
0
|
0
|
|
|
|
|
return if $x < $arr->[0]; |
124
|
0
|
0
|
|
|
|
|
return if $x > $arr->[-1]; |
125
|
0
|
|
|
|
|
|
my @res; |
126
|
0
|
|
|
|
|
|
for my $i (0..$#$arr) { |
127
|
0
|
0
|
|
|
|
|
if ($arr->[$i] < $x) { |
|
|
0
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
$res[0] = $arr->[$i]; |
129
|
|
|
|
|
|
|
} elsif ($arr->[$i] > $x) { |
130
|
0
|
|
0
|
|
|
|
$res[1] ||= $arr->[$i]; |
131
|
0
|
|
|
|
|
|
last; |
132
|
|
|
|
|
|
|
} else { |
133
|
|
|
|
|
|
|
# must not happen |
134
|
0
|
|
|
|
|
|
die "Panic: neighbors called with matching element"; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} |
137
|
0
|
|
|
|
|
|
@res; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |