line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MDV::Distribconf::MediaCFG; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
84
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
57
|
|
5
|
3
|
|
|
3
|
|
645
|
use MDV::Distribconf; |
|
3
|
|
|
|
|
55
|
|
|
3
|
|
|
|
|
1803
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = (qq$Revision: 224942 $ =~ /(\d+)/)[0]; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
MDV::Distribconf::MediaCFG |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This module provides documenation of known values in F. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 MEDIACFG VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
The media.cfg version is given by the 'mediacfg_version' in 'media_info'. |
20
|
|
|
|
|
|
|
This value should be set is you want to use new features that can change the |
21
|
|
|
|
|
|
|
behavior of this module. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 1 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This is the default and the first version of media.cfg format. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 2 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Since this version, all media paths are relative to the media_info path. |
30
|
|
|
|
|
|
|
Previously, media paths were relative to media_info except when beginning with |
31
|
|
|
|
|
|
|
F>, which were relative to the root of the distrib. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 3 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This version allows to include in values variables that refer to |
36
|
|
|
|
|
|
|
other values defined in the configuration file: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over 4 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item ${...} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
refers to a global value (distribution version, arch...) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item %{...} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
refers to a value specific to the media (name, ...) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=back |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VALUE |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $value = {}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 GLOBAL VALUES |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This value can only be set into 'media_info' section. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$value->{mediacfg_version} = { |
63
|
|
|
|
|
|
|
validation => sub { |
64
|
|
|
|
|
|
|
my ($val) = @_; |
65
|
|
|
|
|
|
|
if ($val !~ /^(\d|.)+$/) { |
66
|
|
|
|
|
|
|
return ("should be a number"); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
return (); |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
}; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head3 mediacfg_version |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The version of the media_cfg |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
See L |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$value->{version} = { section => 'media_info' }; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head3 version |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The version of distrib |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$value->{arch} = { section => 'media_info' }; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head3 arch |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The arcitecture of the distribution |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$value->{suppl} = { section => 'media_info' }; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head3 suppl |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This tag is used to change installer behavior, when set, user should be allow |
101
|
|
|
|
|
|
|
to add media not provided by this distribution. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
$value->{askmedia} = { section => 'media_info' }; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head3 askmedia |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This tag is used to change installer behavior, when set, user should be prompt |
110
|
|
|
|
|
|
|
before adding each media. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
$value->{branch} = { section => 'media_info' }; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head3 branch |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The branch of the distribution. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
$value->{product} = { section => 'media_info' }; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head3 product |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The name of the product, 'Download' by default |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$value->{minor} = { section => 'media_info' }; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head3 minor |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
No documentation |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$value->{subversion} = { section => 'media_info' }; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head3 subversion |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
No documentation |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 MEDIA VALUES |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
foreach (qw(hdlist name synthesis pubkey)) { |
151
|
|
|
|
|
|
|
$value->{$_} = { }; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head3 name |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
The name of the media. If unset, the section is the name. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head3 hdlist |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
The hdlist file holding rpm infos for the media |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head3 synthesis |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
The synthesis file holding rpm infos for the media |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head3 pubkey |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
The file holding public gpg key used to sign rpms in this media. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
$value->{srpms} = { deny => 'rpms', cross => 'rpms', ismedialist => 1 }; |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head3 srpms |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
If the media hold binaries rpms, this parameter contains |
177
|
|
|
|
|
|
|
the list of medias holding corresponding sources rpms. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
$value->{rpms} = { deny => 'srpms', cross => 'srpms', ismedialist => 1 }; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head3 rpms |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
If the media hold sources rpms, this parameter contains |
186
|
|
|
|
|
|
|
the list of media holding binaries rpms build by srpms from this media. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
$value->{updates_for} = { ismedialist => 1 }; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head3 updates_for |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
If the media contain updates, it contain the list of media for which |
195
|
|
|
|
|
|
|
rpms are updates. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
$value->{debug_for} = { ismedialist => 1 }; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head3 debug_for |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
If the media contain debug rpms, it contain the list of media for which |
204
|
|
|
|
|
|
|
rpms are debug rpms. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
$value->{noauto} = {}; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head3 noauto |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
This value is used by tools to assume if the media should automatically |
213
|
|
|
|
|
|
|
added to the config (urpmi). |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=cut |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
$value->{size} = { |
218
|
|
|
|
|
|
|
validation => sub { |
219
|
|
|
|
|
|
|
my ($v) = @_; |
220
|
|
|
|
|
|
|
if ($v =~ /^(\d+)(\w)?$/) { |
221
|
|
|
|
|
|
|
if ($2) { |
222
|
|
|
|
|
|
|
if (! grep { lc($2) eq $_ } qw(k m g t p)) { |
223
|
|
|
|
|
|
|
return("wrong unit"); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
return; |
227
|
|
|
|
|
|
|
} else { |
228
|
|
|
|
|
|
|
return ("malformed value"); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
}, |
231
|
|
|
|
|
|
|
}; |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head3 size |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
The size of the media. The value is suffixed by the unit. |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=cut |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# valid_param($media, $var, $val) |
240
|
|
|
|
|
|
|
# |
241
|
|
|
|
|
|
|
# Return a list of errors (if any) about having such value in the config |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub _valid_param { |
244
|
5
|
|
|
5
|
|
859
|
my ($media, $var, $val) = @_[-3..-1]; |
245
|
5
|
50
|
|
|
|
18
|
if (!exists($value->{$var})) { |
246
|
0
|
|
|
|
|
0
|
return ("unknow var"); |
247
|
|
|
|
|
|
|
} |
248
|
5
|
|
50
|
|
|
11
|
$media ||= 'media_info'; # assume default |
249
|
5
|
|
|
|
|
6
|
my @errors; |
250
|
5
|
50
|
33
|
|
|
19
|
if ($value->{$var}{section} && $value->{$var}{section} ne $media) { |
251
|
0
|
|
|
|
|
0
|
push(@errors, "wrong section: should be in $value->{$var}{section}"); |
252
|
|
|
|
|
|
|
} |
253
|
5
|
100
|
|
|
|
17
|
if ($value->{$var}{validation}) { |
254
|
4
|
|
|
|
|
12
|
push(@errors, $value->{$var}{validation}->($val)); |
255
|
|
|
|
|
|
|
} |
256
|
5
|
|
|
|
|
24
|
return @errors; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
# Retun a hash containing information about $var |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub _value_info { |
262
|
3
|
|
|
3
|
|
4
|
my ($var) = $_[-1]; |
263
|
3
|
100
|
|
|
|
12
|
if (exists($value->{$var})) { |
264
|
1
|
|
|
|
|
4
|
return $value->{$var} |
265
|
|
|
|
|
|
|
} |
266
|
2
|
|
|
|
|
5
|
return; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
1; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
__END__ |