line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Arepa::Builder; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
7
|
1
|
|
|
1
|
|
4
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
8
|
1
|
|
|
1
|
|
5
|
use File::chmod; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
9
|
1
|
|
|
1
|
|
4
|
use File::Temp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
10
|
1
|
|
|
1
|
|
4
|
use File::Basename; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
11
|
1
|
|
|
1
|
|
5
|
use File::Path; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
12
|
1
|
|
|
1
|
|
4
|
use File::Find; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
13
|
1
|
|
|
1
|
|
4
|
use File::Copy; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
14
|
1
|
|
|
1
|
|
4
|
use Config::Tiny; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
15
|
1
|
|
|
1
|
|
4
|
use YAML::Syck; |
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
40
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
4
|
use Arepa; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
700
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $ui_module = 'Arepa::UI::Text'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub ui_module { |
22
|
1
|
|
|
1
|
1
|
13
|
my ($self, $module) = @_; |
23
|
1
|
50
|
|
|
|
5
|
if (defined $module) { |
24
|
1
|
|
|
|
|
2
|
$ui_module = $module; |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
1
|
|
486
|
eval qq(use $ui_module;); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
83
|
|
27
|
1
|
50
|
|
|
|
9
|
die $@ if $@; |
28
|
0
|
|
|
|
|
0
|
return $ui_module; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub type { |
32
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
33
|
0
|
|
0
|
|
|
0
|
my $class = ref($self) || $self; |
34
|
0
|
|
|
|
|
0
|
$class =~ s/.+:://; |
35
|
0
|
0
|
|
|
|
0
|
if (!$class) { |
36
|
0
|
|
|
|
|
0
|
croak "You should use a proper builder class, not ".ref($self); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
0
|
return lc($class); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
2
|
|
|
2
|
0
|
35
|
my ($class, %attrs) = @_; |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
20
|
return bless { |
45
|
|
|
|
|
|
|
%attrs, |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
$class; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
4
|
|
|
4
|
0
|
33
|
sub name { $_[0]->{name} } |
51
|
0
|
|
|
0
|
1
|
0
|
sub last_build_log { $_[0]->{last_build_log} } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub config { |
54
|
4
|
|
|
4
|
0
|
7
|
my ($self, $key) = @_; |
55
|
4
|
|
|
|
|
181
|
return $self->{$key}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# To be implemented by each type |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub do_init { |
62
|
0
|
|
|
0
|
0
|
0
|
my ($self, $builder) = @_; |
63
|
0
|
|
|
|
|
0
|
croak "Not implemented"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub init { |
67
|
0
|
|
|
0
|
1
|
0
|
my ($self, $builder) = @_; |
68
|
0
|
|
|
|
|
0
|
$self->do_init($builder); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub do_uninit { |
72
|
0
|
|
|
0
|
0
|
0
|
my ($self, $builder) = @_; |
73
|
0
|
|
|
|
|
0
|
croak "Not implemented"; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub uninit { |
77
|
0
|
|
|
0
|
0
|
0
|
my ($self, $builder) = @_; |
78
|
0
|
|
|
|
|
0
|
$self->do_uninit($builder); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub do_compile_package_from_dsc { |
82
|
0
|
|
|
0
|
0
|
0
|
my ($self, $dsc_file, %user_opts) = @_; |
83
|
0
|
|
|
|
|
0
|
croak "Not implemented"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub compile_package_from_dsc { |
87
|
2
|
|
|
2
|
1
|
8
|
my ($self, $dsc_file, %user_opts) = @_; |
88
|
2
|
|
|
|
|
15
|
$self->do_compile_package_from_dsc($dsc_file, %user_opts); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub do_compile_package_from_repository { |
92
|
0
|
|
|
0
|
0
|
|
my ($self, $pkg_name, $pkg_version, %user_opts) = @_; |
93
|
0
|
|
|
|
|
|
croak "Not implemented"; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub compile_package_from_repository { |
97
|
0
|
|
|
0
|
1
|
|
my ($self, $pkg_name, $pkg_version, %user_opts) = @_; |
98
|
0
|
|
|
|
|
|
$self->do_compile_package_from_repository($pkg_name, |
99
|
|
|
|
|
|
|
$pkg_version, |
100
|
|
|
|
|
|
|
%user_opts); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub do_create { |
104
|
0
|
|
|
0
|
0
|
|
my ($self, $builder_dir, $mirror, $distribution, %opts) = @_; |
105
|
0
|
|
|
|
|
|
croak "Not implemented"; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub create { |
109
|
0
|
|
|
0
|
1
|
|
my ($self, $builder_dir, $mirror, $distribution, %user_opts) = @_; |
110
|
0
|
|
|
|
|
|
my %opts = (builder_config_dir => '/etc/arepa/builders', |
111
|
|
|
|
|
|
|
arch => `dpkg-architecture -qDEB_BUILD_ARCH`, |
112
|
|
|
|
|
|
|
%user_opts); |
113
|
0
|
|
|
|
|
|
chomp($opts{arch}); |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
$self->do_create($builder_dir, $mirror, $distribution, %opts); |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
$self->ui_module->print_title("Configuration for config.yml"); |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $type = $self->type; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
my $config_string = <
|
122
|
|
|
|
|
|
|
type: $type |
123
|
|
|
|
|
|
|
architecture: $opts{arch} |
124
|
|
|
|
|
|
|
# Compile "Architecture: all" packages with this builder? |
125
|
|
|
|
|
|
|
architecture_all: 0 |
126
|
|
|
|
|
|
|
# This is the distribution the packages compiled by this builder go to. For a |
127
|
|
|
|
|
|
|
# package to be compiled by this builder, it has to have the correct |
128
|
|
|
|
|
|
|
# architecture and this distribution (or an alias or similar, see below) in |
129
|
|
|
|
|
|
|
# its *.changes file. |
130
|
|
|
|
|
|
|
distribution: $distribution |
131
|
|
|
|
|
|
|
# Other names for this distribution (if the distribution name is |
132
|
|
|
|
|
|
|
# mycompany-squeeze, you might want 'squeeze' and 'testing' as aliases) |
133
|
|
|
|
|
|
|
distribution_aliases: [] |
134
|
|
|
|
|
|
|
# Recompile packages (binNMU or Binary-only Non-Maintainer Upload; see |
135
|
|
|
|
|
|
|
# http://www.debian.org/doc/developers-reference/pkgs.html#nmu-binnmu) |
136
|
|
|
|
|
|
|
# originally uploaded for other distributions in this builder. This option is |
137
|
|
|
|
|
|
|
# an easy way to get "for free" packages compiled for several distributions. |
138
|
|
|
|
|
|
|
# Typical values for this list would be 'unstable' or 'lenny' |
139
|
|
|
|
|
|
|
bin_nmu_for: [] |
140
|
|
|
|
|
|
|
EOD |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
my $builder_name = basename($builder_dir); |
143
|
0
|
|
|
|
|
|
my $path = File::Spec->catfile($opts{builder_config_dir}, |
144
|
|
|
|
|
|
|
"$builder_name.yml"); |
145
|
0
|
0
|
|
|
|
|
open F, ">$path" or croak "Can't write builder configuration in $path"; |
146
|
0
|
|
|
|
|
|
print F $config_string; |
147
|
0
|
|
|
|
|
|
close F; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
my $sources_list_path = File::Spec->catfile($builder_dir, "etc", "apt", |
150
|
|
|
|
|
|
|
"sources.list"); |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
$self->ui_module->print_title("Done"); |
153
|
0
|
|
|
|
|
|
print <
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Next steps |
156
|
|
|
|
|
|
|
---------- |
157
|
|
|
|
|
|
|
* Tweak the builder configuration in $path |
158
|
|
|
|
|
|
|
* Review $sources_list_path |
159
|
|
|
|
|
|
|
* Add all relevant repository keys to the builder (eg. "apt-key add ...") |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
EOM |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
__END__ |