line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Smoke::Syncer::FTP; |
2
|
11
|
|
|
11
|
|
117
|
use warnings; |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
392
|
|
3
|
11
|
|
|
11
|
|
63
|
use strict; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
476
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.029'; |
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
78
|
use base 'Test::Smoke::Syncer::Base'; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
1226
|
|
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
|
|
83
|
use File::Spec::Functions; |
|
11
|
|
|
|
|
31
|
|
|
11
|
|
|
|
|
5853
|
|
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
|
8337
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
32
|
$self->pre_sync; |
48
|
3
|
|
|
|
|
988
|
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
|
|
|
|
|
52
|
} ); |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
21
|
$fc->connect; |
59
|
|
|
|
|
|
|
|
60
|
3
|
100
|
|
|
|
4
|
$fc->mirror( @{ $self }{qw( ftpsdir ddir )}, 1 ) or return; |
|
3
|
|
|
|
|
10
|
|
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
65
|
$self->{client} = $fc; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
22
|
my $plevel = $self->create_dot_patch; |
65
|
2
|
|
|
|
|
50
|
$self->post_sync; |
66
|
2
|
|
|
|
|
14
|
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
|
|
|
|
|
12
|
my $ftp = $self->{client}->{client}; |
79
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
15
|
$ftp->cwd( $self->{ftpcdir} ); |
81
|
12
|
|
|
|
|
28
|
my $plevel = (sort { $b <=> $a } map { |
82
|
2
|
|
|
|
|
55
|
s/\.gz$//; $_ |
|
10
|
|
|
|
|
244
|
|
|
10
|
|
|
|
|
55
|
|
83
|
|
|
|
|
|
|
} grep /\d+\.gz/ => $ftp->ls)[0]; |
84
|
|
|
|
|
|
|
|
85
|
2
|
|
|
|
|
16
|
my $dotpatch = catfile( $self->{ddir}, '.patch' ); |
86
|
2
|
|
|
|
|
11
|
local *DOTPATH; |
87
|
2
|
50
|
|
|
|
139
|
if ( open DOTPATCH, "> $dotpatch" ) { |
88
|
2
|
|
|
|
|
26
|
print DOTPATCH $plevel; |
89
|
2
|
50
|
|
|
|
77
|
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
|
|
|
|
|
13
|
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 |