| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Smoke::Syncer::Forest; |
|
2
|
11
|
|
|
11
|
|
86
|
use warnings; |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
390
|
|
|
3
|
11
|
|
|
11
|
|
59
|
use strict; |
|
|
11
|
|
|
|
|
23
|
|
|
|
11
|
|
|
|
|
802
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.029'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
59
|
use base 'Test::Smoke::Syncer::Base'; |
|
|
11
|
|
|
|
|
21
|
|
|
|
11
|
|
|
|
|
5390
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 Test::Smoke::Syncer::Forest |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This handles syncing by setting up a master directory that is in sync |
|
12
|
|
|
|
|
|
|
with either a snapshot or the repository. Then it creates a copy of |
|
13
|
|
|
|
|
|
|
this master directory as a hardlink forest and the B |
|
14
|
|
|
|
|
|
|
script is run (if found). Now the source-tree should be up to date |
|
15
|
|
|
|
|
|
|
and ready to be copied as a hardlink forest again, to its final |
|
16
|
|
|
|
|
|
|
destination. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Thanks to Nicholas Clark for donating this idea. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 Test::Smoke::Syncer::Forest->new( %args ) |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Keys for C<%args>: |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
* All keys from the other methods (depending on {fsync}) |
|
27
|
|
|
|
|
|
|
* fsync: which master sync method is to be used |
|
28
|
|
|
|
|
|
|
* mdir: master directory |
|
29
|
|
|
|
|
|
|
* fdir: intermediate directory (first hardlink forest) |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 $syncer->sync( ) |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
C starts with a "traditional" sync according to {ftype} in {mdir}. |
|
36
|
|
|
|
|
|
|
It then creates a copy of {mdir} in {fdir} with hardlinks an tries to run |
|
37
|
|
|
|
|
|
|
the B script in {fdir}. This directory should now contain |
|
38
|
|
|
|
|
|
|
an up to date (working) source-tree wich again using hardlinks is copied |
|
39
|
|
|
|
|
|
|
to the destination directory {ddir}. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub sync { |
|
45
|
1
|
|
|
1
|
1
|
26
|
my $self = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
20
|
my %args = map { ( $_ => $self->{ $_ } ) } keys %$self; |
|
|
34
|
|
|
|
|
86
|
|
|
48
|
1
|
|
|
|
|
29
|
$args{ddir} = $self->{mdir}; |
|
49
|
1
|
50
|
|
|
|
25
|
$self->{v} and print "Prepare to sync ($self->{fsync}|$args{ddir})\n"; |
|
50
|
1
|
|
|
|
|
14
|
my $syncer = Test::Smoke::Syncer->new( $self->{fsync}, \%args ); |
|
51
|
1
|
|
|
|
|
22
|
$syncer->sync; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Now copy the master |
|
54
|
1
|
|
|
|
|
4
|
$args{ddir} = $self->{fdir}; |
|
55
|
1
|
|
|
|
|
5
|
$args{hdir} = $self->{mdir}; |
|
56
|
1
|
50
|
|
|
|
4
|
$self->{v} and print "Prepare to sync (hardlink|$args{ddir})\n"; |
|
57
|
1
|
|
|
|
|
7
|
$syncer = Test::Smoke::Syncer->new( hardlink => \%args ); |
|
58
|
1
|
|
|
|
|
15
|
$syncer->sync; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# now try to run the 'regen_headers.pl' script |
|
61
|
1
|
50
|
|
|
|
32
|
if ( -e File::Spec->catfile( $self->{fdir}, 'regen_headers.pl' ) ) { |
|
62
|
0
|
0
|
|
|
|
0
|
$self->{v} and print "Run 'regen_headers.pl' ($self->{fdir})\n"; |
|
63
|
0
|
|
|
|
|
0
|
my $cwd = Cwd::cwd(); |
|
64
|
0
|
0
|
|
|
|
0
|
chdir $self->{fdir} or do { |
|
65
|
0
|
|
|
|
|
0
|
require Carp; |
|
66
|
0
|
|
|
|
|
0
|
Carp::croak( "Cannot chdir($self->{fdir}) in forest: $!" ); |
|
67
|
|
|
|
|
|
|
}; |
|
68
|
0
|
0
|
|
|
|
0
|
system( "$^X regen_headers.pl" ) == 0 or do { |
|
69
|
0
|
|
|
|
|
0
|
require Carp; |
|
70
|
0
|
|
|
|
|
0
|
Carp::carp( "Error while running 'regen_headers.pl'" ); |
|
71
|
|
|
|
|
|
|
}; |
|
72
|
0
|
0
|
|
|
|
0
|
chdir $cwd or do { |
|
73
|
0
|
|
|
|
|
0
|
require Carp; |
|
74
|
0
|
|
|
|
|
0
|
Carp::croak( "Cannot chdir($cwd) back: $!" ); |
|
75
|
|
|
|
|
|
|
}; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
6
|
$args{ddir} = $self->{ddir}; |
|
79
|
1
|
|
|
|
|
2
|
$args{hdir} = $self->{fdir}; |
|
80
|
1
|
50
|
|
|
|
4
|
$self->{v} and print "Prepare to sync (hardlink|$args{ddir})\n"; |
|
81
|
1
|
|
|
|
|
7
|
$syncer = Test::Smoke::Syncer->new( hardlink => \%args ); |
|
82
|
1
|
|
|
|
|
4
|
my $plevel = $syncer->sync; |
|
83
|
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
13
|
return $plevel; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
(c) 2002-2013, All rights reserved. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
* Abe Timmerman |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
96
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
See: |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
* , |
|
101
|
|
|
|
|
|
|
* |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
104
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
105
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |