| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Arch Perl library, Copyright (C) 2005 Enno Cramer |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
4
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
|
5
|
|
|
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or |
|
6
|
|
|
|
|
|
|
# (at your option) any later version. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
9
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11
|
|
|
|
|
|
|
# GNU General Public License for more details. |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
14
|
|
|
|
|
|
|
# along with this program; if not, write to the Free Software |
|
15
|
|
|
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
13
|
use 5.005; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
33
|
|
|
18
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Arch::Test::Framework; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use Arch::Test::Archive; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
23
|
1
|
|
|
1
|
|
422
|
use Arch::Test::Tree; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
24
|
1
|
|
|
1
|
|
6
|
use Arch::Test::Cases; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
5
|
use Arch::TempFiles qw(); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
12
|
|
|
27
|
1
|
|
|
1
|
|
4
|
use Arch::Util qw(); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
854
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new ($;%) { |
|
30
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
31
|
0
|
|
|
|
|
|
my %args = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
0
|
|
|
|
my $home = $args{home} || Arch::TempFiles::temp_dir('arch-test'); |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
0
|
|
|
|
my $self = { |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
36
|
|
|
|
|
|
|
arch_uid => '', |
|
37
|
|
|
|
|
|
|
home => $home, |
|
38
|
|
|
|
|
|
|
library => $args{library} || "$home/library", |
|
39
|
|
|
|
|
|
|
archives => $args{archives} || "$home/archives", |
|
40
|
|
|
|
|
|
|
trees => $args{trees} || "$home/trees", |
|
41
|
|
|
|
|
|
|
ids => {}, |
|
42
|
|
|
|
|
|
|
}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
0
|
|
|
|
die "Cannot access directory $self->{home}\n" |
|
45
|
|
|
|
|
|
|
unless -d $home && -w $home; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
bless $self, $class; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# setup home directory |
|
50
|
0
|
|
|
|
|
|
foreach my $dir (( |
|
51
|
|
|
|
|
|
|
$self->archives_dir, |
|
52
|
|
|
|
|
|
|
$self->library_dir, |
|
53
|
|
|
|
|
|
|
$self->trees_dir |
|
54
|
|
|
|
|
|
|
)) { |
|
55
|
0
|
0
|
|
|
|
|
mkdir $dir unless -d $dir; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
unless (-d "$self->{home}/.arch-params") { |
|
59
|
0
|
|
0
|
|
|
|
$self->run_tla( |
|
60
|
|
|
|
|
|
|
'my-id', |
|
61
|
|
|
|
|
|
|
$args{userid} || 'Arch Perl Test ' |
|
62
|
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->run_tla( |
|
65
|
|
|
|
|
|
|
'my-revision-library', |
|
66
|
|
|
|
|
|
|
$self->library_dir |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->run_tla( |
|
70
|
|
|
|
|
|
|
'library-config', |
|
71
|
|
|
|
|
|
|
'--sparse', '--non-greedy', |
|
72
|
|
|
|
|
|
|
$self->library_dir |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$self->{arch_uid} = $self->run_tla('my-id', '--uid'); |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $self; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# field access |
|
82
|
|
|
|
|
|
|
sub arch_uid ($) { |
|
83
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return $self->{arch_uid}; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub home_dir ($) { |
|
89
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $self->{home}; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub library_dir ($) { |
|
95
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return $self->{library}; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub archives_dir ($) { |
|
101
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return $self->{archives}; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub trees_dir ($) { |
|
107
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return $self->{trees}; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# run with correct environment |
|
113
|
|
|
|
|
|
|
sub run_tla ($@) { |
|
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
local $ENV{HOME} = $self->home_dir; |
|
117
|
0
|
|
|
|
|
|
my @lines = Arch::Util::run_tla(@_); |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
die "run_tla(".join(' ', @_).") failed: $?\n" |
|
120
|
|
|
|
|
|
|
if $?; |
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
return wantarray ? @lines : $lines[0]; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub gen_id ($$) { |
|
126
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
127
|
0
|
|
|
|
|
|
my $section = shift; |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
|
$self->{ids}->{$section} = 0 |
|
130
|
|
|
|
|
|
|
unless exists $self->{ids}->{$section}; |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
return $self->{ids}->{$section}++; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub make_archive ($;$) { |
|
136
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
137
|
0
|
|
0
|
|
|
|
my $name = shift |
|
138
|
|
|
|
|
|
|
|| $self->arch_uid . '--archive-' . $self->gen_id('archives'); |
|
139
|
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
my $path = $self->archives_dir . "/$name"; |
|
141
|
0
|
|
|
|
|
|
$self->run_tla('make-archive', $name, $path); |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
return Arch::Test::Archive->new($self, $name); |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub make_tree ($$;$) { |
|
147
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
148
|
0
|
|
|
|
|
|
my $version = shift; |
|
149
|
0
|
|
0
|
|
|
|
my $tree = shift || 'tree-' . $self->gen_id('trees'); |
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
my $path = $self->trees_dir . "/$tree"; |
|
152
|
0
|
0
|
|
|
|
|
mkdir($path) || die "mkdir($path) failed: $!\n"; |
|
153
|
0
|
|
|
|
|
|
$self->run_tla('init-tree', '-d', $path, $version); |
|
154
|
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
return Arch::Test::Tree->new($self, $path); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
1; |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
__END__ |