line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Package.pm 2420 2017-10-28 11:00:24Z guillomovitch $ |
2
|
|
|
|
|
|
|
package Youri::Package; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Youri::Package - Abstract package class |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 DESCRIPTION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This abstract class defines Youri::Package interface. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
15
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
16
|
1
|
|
|
1
|
|
226
|
use version; our $VERSION = qv('0.2.5'); |
|
1
|
|
|
|
|
1313
|
|
|
1
|
|
|
|
|
6
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
71
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
299
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 CLASS METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 new(%args) |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Creates and returns a new Youri::Package object. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Warning: do not call directly, call subclass constructor instead. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new { |
31
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
32
|
0
|
0
|
|
|
|
|
croak "Abstract class" if $class eq __PACKAGE__; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my %options = ( |
35
|
|
|
|
|
|
|
@_ |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $self = bless { |
39
|
|
|
|
|
|
|
}, $class; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$self->_init(%options); |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
0
|
|
|
sub _init { |
47
|
|
|
|
|
|
|
# do nothing |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 get_pattern($name, $version, $release, $arch) |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns a pattern matching a file for a package, using available informations. |
53
|
|
|
|
|
|
|
All meta characters in arguments are quoted. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 get_unquoted_pattern($name, $version, $release, $arch) |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns a pattern matching a file for a package, using available informations. |
58
|
|
|
|
|
|
|
Meta characters in arguments are not quoted. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 compare_revisions($revision1, $revision2) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Compares two revision tokens, and returns a numeric value: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item positive if first revision is higher |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item null if both revisions are equal |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item negative if first revision is lower |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 check_ranges_compatibility($range1, $range2) |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns a true value if given revision ranges are compatible. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 INSTANCE METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 as_file() |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns the file corresponding to this package. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 as_string() |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns a string representation of this package. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 as_formated_string(I) |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Returns a string representation of this package, formated according to |
91
|
|
|
|
|
|
|
I. Format is a string, where each %{foo} token will get replaced by |
92
|
|
|
|
|
|
|
equivalent tag value. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 get_name() |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns the name of this package. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 get_version() |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Returns the version of this package. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 get_release() |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns the release of this package. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 get_revision() |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns the revision of this package. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 get_arch() |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Returns the architecture of this package. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 get_file_name() |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns the file name of this package (name-version-release.arch.extension). |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 is_source() |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns true if this package is a source package. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 is_binary() |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns true if this package is a binary package. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 is_debug() |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns true if this package is a debug package. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 get_type() |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Returns the type (binary/source) of this package. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 get_age() |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns the age of this package |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 get_url() |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Returns the URL of this package |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 get_summary() |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Returns the summary of this package |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 get_description() |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Returns the description of this package |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 get_packager() |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Returns the packager of this package. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 get_source_package() |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Returns the name of the source package of this package. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 get_tag($tag) |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Returns the value of tag $tag of this package. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 get_canonical_name() |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Returns the canonical name of this package, shared by its multiple components, |
165
|
|
|
|
|
|
|
usually the one from the source package. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 get_canonical_revision() |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Returns the canonical revision of this package, shared by its multiple components, |
170
|
|
|
|
|
|
|
usually the one from the source package. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 get_requires() |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Returns the list of dependencies required by this package, as an array of |
175
|
|
|
|
|
|
|
L objects. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 get_provides() |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Returns the list of dependencies provided by this package, as an array of |
180
|
|
|
|
|
|
|
L objects. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 get_obsoletes() |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Returns the list of other packages obsoleted by this one, as an array of |
185
|
|
|
|
|
|
|
L objects. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 get_conflicts() |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Returns the list of other packages conflicting with this one, as an array of |
190
|
|
|
|
|
|
|
L objects. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 get_files() |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Returns the list of files contained in this package, as an array of |
195
|
|
|
|
|
|
|
L objects. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 get_gpg_key() |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Returns the gpg key id of package signature. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head2 get_information() |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Returns formated informations about the package. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 get_changes() |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Returns the list of changes for this package, as an array of |
208
|
|
|
|
|
|
|
L objects. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 get_last_change() |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Returns the last change for this package, as as structure described before. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 compare($package) |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Compares ordering with other package, according to their corresponding revision |
217
|
|
|
|
|
|
|
tokens, and returns a numeric value: |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=over |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item positive if this package is newer |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=item null if both have same revision |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=item negative if this package is older |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=back |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 satisfy_range($range) |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Returns a true value if this package revision satisfies given revision range. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 sign($name, $path, $passphrase) |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Signs the package with given name, keyring path and passphrase. |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 extract() |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Extract package content in local directory. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head1 SUBCLASSING |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
All instances methods have to be implemented. |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Copyright (C) 2002-2006, YOURI project |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 get_file() |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Deprecated in favor of as_file(). |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=cut |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub get_file { |
258
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
259
|
0
|
|
|
|
|
|
carp "Deprecated method, use as_file() now"; |
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
return $self->as_file(); |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head2 get_full_name() |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
Deprecated in favor of as_string(). |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=cut |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub get_full_name { |
271
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
272
|
0
|
|
|
|
|
|
carp "Deprecated method, use as_string now"; |
273
|
|
|
|
|
|
|
|
274
|
0
|
|
|
|
|
|
return $self->as_string(); |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head2 compare_versions($version1, $version2) |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
Deprecated in favor of compare_revisions(). |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=cut |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub compare_versions { |
284
|
0
|
|
|
0
|
1
|
|
my ($self, $version1, $version2) = @_; |
285
|
0
|
|
|
|
|
|
carp "Deprecated method, use compare_revisions now"; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
return $self->compare_revisions($version1, $version2); |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head2 compare_ranges($version1, $version2) |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Deprecated in favor of check_ranges_compatibility(). |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=cut |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
sub compare_ranges { |
297
|
0
|
|
|
0
|
1
|
|
my ($self, $range1, $range2) = @_; |
298
|
0
|
|
|
|
|
|
carp "Deprecated method, use check_ranges_compatibility now"; |
299
|
|
|
|
|
|
|
|
300
|
0
|
|
|
|
|
|
return $self->check_ranges_compatibility($range1, $range2); |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head2 get_revision_name() |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Deprecated in favor of as_formated_string() with proper format string. |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=cut |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub get_revision_name { |
310
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
311
|
0
|
|
|
|
|
|
carp "Deprecated method, use as_formated_string('%{name}-%{version}-%{release}') now"; |
312
|
|
|
|
|
|
|
|
313
|
0
|
|
|
|
|
|
return $self->as_formated_string('%{name}-%{version}-%{release}'); |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head2 get_information() |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Deprecated in favor of as_formated_string() with proper pattern. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=cut |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub get_information { |
323
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
324
|
0
|
|
|
|
|
|
carp "Deprecated method, use as_formated_string() with proper format string now"; |
325
|
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
|
return $self->as_formated_string(<
|
327
|
|
|
|
|
|
|
Name : %-27{NAME} Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocatable)}| |
328
|
|
|
|
|
|
|
Version : %-27{VERSION} Vendor: %{VENDOR} |
329
|
|
|
|
|
|
|
Release : %-27{RELEASE} Build Date: %{BUILDTIME:date} |
330
|
|
|
|
|
|
|
Install Date: %|INSTALLTIME?{%-27{INSTALLTIME:date}}:{(not installed) }| Build Host: %{BUILDHOST} |
331
|
|
|
|
|
|
|
Group : %-27{GROUP} Source RPM: %{SOURCERPM} |
332
|
|
|
|
|
|
|
Size : %-27{SIZE}%|LICENSE?{ License: %{LICENSE}}| |
333
|
|
|
|
|
|
|
Signature : %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}| |
334
|
|
|
|
|
|
|
%|PACKAGER?{Packager : %{PACKAGER}\n}|%|URL?{URL : %{URL}\n}|Summary : %{SUMMARY} |
335
|
|
|
|
|
|
|
Description :\n%{DESCRIPTION} |
336
|
|
|
|
|
|
|
EOF |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
1; |