| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Smoke::Syncer::FTP; |
|
2
|
11
|
|
|
11
|
|
67
|
use warnings; |
|
|
11
|
|
|
|
|
21
|
|
|
|
11
|
|
|
|
|
340
|
|
|
3
|
11
|
|
|
11
|
|
53
|
use strict; |
|
|
11
|
|
|
|
|
18
|
|
|
|
11
|
|
|
|
|
359
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.029'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
51
|
use base 'Test::Smoke::Syncer::Base'; |
|
|
11
|
|
|
|
|
21
|
|
|
|
11
|
|
|
|
|
1013
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 Test::Smoke::Syncer::FTP |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This handles syncing by getting the source-tree from ActiveState's APC |
|
12
|
|
|
|
|
|
|
repository. It uses the C that implements a |
|
13
|
|
|
|
|
|
|
mirror function. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
11
|
|
|
11
|
|
73
|
use File::Spec::Functions; |
|
|
11
|
|
|
|
|
25
|
|
|
|
11
|
|
|
|
|
4568
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head2 Test::Smoke::Syncer::FTP->new( %args ) |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Known args for this class: |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
* ftphost (public.activestate.com) |
|
24
|
|
|
|
|
|
|
* ftpusr (anonymous) |
|
25
|
|
|
|
|
|
|
* ftppwd (smokers@perl.org) |
|
26
|
|
|
|
|
|
|
* ftpsdir (/pub/apc/perl-????) |
|
27
|
|
|
|
|
|
|
* ftpcdir (/pub/apc/perl-????-diffs) |
|
28
|
|
|
|
|
|
|
* ftype (undef|binary|ascii) |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
* ddir |
|
31
|
|
|
|
|
|
|
* v |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 $syncer->sync() |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This does the actual syncing: |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
* Check {ftpcdir} for the latest changenumber |
|
40
|
|
|
|
|
|
|
* Mirror |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub sync { |
|
45
|
3
|
|
|
3
|
1
|
5906
|
my $self = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
20
|
$self->pre_sync; |
|
48
|
3
|
|
|
|
|
448
|
require Test::Smoke::FTPClient; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $fc = Test::Smoke::FTPClient->new( $self->{ftphost}, { |
|
51
|
|
|
|
|
|
|
v => $self->{v}, |
|
52
|
|
|
|
|
|
|
passive => $self->{ftppassive}, |
|
53
|
|
|
|
|
|
|
fuser => $self->{ftpusr}, |
|
54
|
|
|
|
|
|
|
fpwd => $self->{ftppwd}, |
|
55
|
|
|
|
|
|
|
ftype => $self->{ftype}, |
|
56
|
3
|
|
|
|
|
56
|
} ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
21
|
$fc->connect; |
|
59
|
|
|
|
|
|
|
|
|
60
|
3
|
100
|
|
|
|
8
|
$fc->mirror( @{ $self }{qw( ftpsdir ddir )}, 1 ) or return; |
|
|
3
|
|
|
|
|
12
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
66
|
$self->{client} = $fc; |
|
63
|
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
21
|
my $plevel = $self->create_dot_patch; |
|
65
|
2
|
|
|
|
|
44
|
$self->post_sync; |
|
66
|
2
|
|
|
|
|
8
|
return $plevel; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 $syncer->create_dot_patch |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This needs to go to the *-diffs directory on APC and find the patch |
|
72
|
|
|
|
|
|
|
whith the highest number, that should be our current patchlevel. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_dot_patch { |
|
77
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
|
78
|
2
|
|
|
|
|
6
|
my $ftp = $self->{client}->{client}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
9
|
$ftp->cwd( $self->{ftpcdir} ); |
|
81
|
12
|
|
|
|
|
21
|
my $plevel = (sort { $b <=> $a } map { |
|
82
|
2
|
|
|
|
|
45
|
s/\.gz$//; $_ |
|
|
10
|
|
|
|
|
219
|
|
|
|
10
|
|
|
|
|
30
|
|
|
83
|
|
|
|
|
|
|
} grep /\d+\.gz/ => $ftp->ls)[0]; |
|
84
|
|
|
|
|
|
|
|
|
85
|
2
|
|
|
|
|
17
|
my $dotpatch = catfile( $self->{ddir}, '.patch' ); |
|
86
|
2
|
|
|
|
|
9
|
local *DOTPATH; |
|
87
|
2
|
50
|
|
|
|
107
|
if ( open DOTPATCH, "> $dotpatch" ) { |
|
88
|
2
|
|
|
|
|
22
|
print DOTPATCH $plevel; |
|
89
|
2
|
50
|
|
|
|
56
|
close DOTPATCH or do { |
|
90
|
0
|
|
|
|
|
0
|
require Carp; |
|
91
|
0
|
|
|
|
|
0
|
Carp::carp( "Error writing '$dotpatch': $!" ); |
|
92
|
|
|
|
|
|
|
}; |
|
93
|
|
|
|
|
|
|
} else { |
|
94
|
0
|
|
|
|
|
0
|
require Carp; |
|
95
|
0
|
|
|
|
|
0
|
Carp::carp( "Error creating '$dotpatch': $!" ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
2
|
|
|
|
|
11
|
return $plevel; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
(c) 2002-2013, All rights reserved. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
* Abe Timmerman |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
109
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
See: |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
* , |
|
114
|
|
|
|
|
|
|
* |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
117
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
118
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |