line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MDV::Distribconf::MediaCFG; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
22
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
87
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
77
|
|
5
|
3
|
|
|
3
|
|
536
|
use MDV::Distribconf; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
2168
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = (qq$Revision$ =~ /(\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
|
|
|
|
|
|
|
=head2 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This version support xml files as replacement of hdlist/synthesis. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VALUE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $value = {}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 GLOBAL VALUES |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This value can only be set into 'media_info' section. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$value->{mediacfg_version} = { |
67
|
|
|
|
|
|
|
validation => sub { |
68
|
|
|
|
|
|
|
my ($val) = @_; |
69
|
|
|
|
|
|
|
if ($val !~ /^(\d|.)+$/) { |
70
|
|
|
|
|
|
|
return ("should be a number"); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
return (); |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
}; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head3 mediacfg_version |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The version of the media_cfg |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
See L |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$value->{version} = { section => 'media_info' }; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head3 version |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
The version of distrib |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$value->{arch} = { section => 'media_info' }; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head3 arch |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The arcitecture of the distribution |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$value->{suppl} = { section => 'media_info' }; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head3 suppl |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This tag is used to change installer behavior, when set, user should be allow |
105
|
|
|
|
|
|
|
to add media not provided by this distribution. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$value->{askmedia} = { section => 'media_info' }; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head3 askmedia |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This tag is used to change installer behavior, when set, user should be prompt |
114
|
|
|
|
|
|
|
before adding each media. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$value->{branch} = { section => 'media_info' }; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head3 branch |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The branch of the distribution. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
$value->{product} = { section => 'media_info' }; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head3 product |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The name of the product, 'Download' by default |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$value->{minor} = { section => 'media_info' }; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head3 minor |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
No documentation |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$value->{subversion} = { section => 'media_info' }; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head3 subversion |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
No documentation |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
$value->{cdmode} = { section => 'media_info' }; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head3 cdmode |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
If set, indexes located into global directory should be used |
155
|
|
|
|
|
|
|
instead of per media ones. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
$value->{'synthesis-filter'} = { section => 'media_info' }; |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head3 synthesis-filter |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Compression filter used for synthesis |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
$value->{'xml-info'} = { section => 'media_info' }; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head3 xml-info |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
The distribution handle xml format |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
$value->{'xml-info-filter'} = { section => 'media_info' }; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head3 xml-info-filter |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Compression filter used for xml-info |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 MEDIA VALUES |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
foreach (qw(hdlist name synthesis pubkey media_info)) { |
188
|
|
|
|
|
|
|
$value->{$_} = { }; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head3 name |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The name of the media. If unset, the section is the name. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head3 hdlist |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
The hdlist file holding rpm infos for the media |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head3 synthesis |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
The synthesis file holding rpm infos for the media |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head3 pubkey |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The file holding public gpg key used to sign rpms in this media. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head3 media_type |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Contains a comma-separated list of tags meant to help tools to better |
212
|
|
|
|
|
|
|
describe the media |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=cut |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
$value->{srpms} = { deny => 'rpms', cross => 'rpms', ismedialist => 1 }; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head3 srpms |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
If the media hold binaries rpms, this parameter contains |
221
|
|
|
|
|
|
|
the list of medias holding corresponding sources rpms. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
$value->{rpms} = { deny => 'srpms', cross => 'srpms', ismedialist => 1 }; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head3 rpms |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
If the media hold sources rpms, this parameter contains |
230
|
|
|
|
|
|
|
the list of media holding binaries rpms build by srpms from this media. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=cut |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
$value->{updates_for} = { ismedialist => 1 }; |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head3 updates_for |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
If the media contain updates, it contain the list of media for which |
239
|
|
|
|
|
|
|
rpms are updates. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
$value->{debug_for} = { ismedialist => 1 }; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head3 debug_for |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
If the media contain debug rpms, it contain the list of media for which |
248
|
|
|
|
|
|
|
rpms are debug rpms. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
$value->{noauto} = {}; |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head3 noauto |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This value is used by tools to assume if the media should automatically |
257
|
|
|
|
|
|
|
added to the config (urpmi). |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=cut |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
$value->{size} = { |
262
|
|
|
|
|
|
|
validation => sub { |
263
|
|
|
|
|
|
|
my ($v) = @_; |
264
|
|
|
|
|
|
|
if ($v =~ /^(\d+)(\w)?$/) { |
265
|
|
|
|
|
|
|
if ($2) { |
266
|
|
|
|
|
|
|
if (! grep { lc($2) eq $_ } qw(k m g t p)) { |
267
|
|
|
|
|
|
|
return("wrong unit"); |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
return; |
271
|
|
|
|
|
|
|
} else { |
272
|
|
|
|
|
|
|
return ("malformed value"); |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
}, |
275
|
|
|
|
|
|
|
}; |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head3 size |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
The size of the media. The value is suffixed by the unit. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=cut |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
# valid_param($media, $var, $val) |
284
|
|
|
|
|
|
|
# |
285
|
|
|
|
|
|
|
# Return a list of errors (if any) about having such value in the config |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub _valid_param { |
288
|
5
|
|
|
5
|
|
826
|
my ($media, $var, $val) = @_[-3..-1]; |
289
|
5
|
50
|
|
|
|
20
|
if (!exists($value->{$var})) { |
290
|
0
|
|
|
|
|
0
|
return ("unknown var"); |
291
|
|
|
|
|
|
|
} |
292
|
5
|
|
50
|
|
|
11
|
$media ||= 'media_info'; # assume default |
293
|
5
|
|
|
|
|
9
|
my @errors; |
294
|
5
|
50
|
33
|
|
|
18
|
if ($value->{$var}{section} && $value->{$var}{section} ne $media) { |
295
|
0
|
|
|
|
|
0
|
push(@errors, "wrong section: should be in $value->{$var}{section}"); |
296
|
|
|
|
|
|
|
} |
297
|
5
|
100
|
|
|
|
12
|
if ($value->{$var}{validation}) { |
298
|
4
|
|
|
|
|
11
|
push(@errors, $value->{$var}{validation}->($val)); |
299
|
|
|
|
|
|
|
} |
300
|
5
|
|
|
|
|
24
|
return @errors; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
# Retun a hash containing information about $var |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
sub _value_info { |
306
|
3
|
|
|
3
|
|
7
|
my ($var) = $_[-1]; |
307
|
3
|
100
|
|
|
|
10
|
if (exists($value->{$var})) { |
308
|
1
|
|
|
|
|
16
|
return $value->{$var} |
309
|
|
|
|
|
|
|
} |
310
|
2
|
|
|
|
|
4
|
return; |
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
1; |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
__END__ |