line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Slackware::Slackget::PackageList; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1321
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1026
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Slackware::Slackget::Package; |
7
|
|
|
|
|
|
|
require Slackware::Slackget::List ; |
8
|
|
|
|
|
|
|
require Slackware::Slackget::Date ; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Slackware::Slackget::PackageList - This class is a container of Slackware::Slackget::Package object |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 1.0.0 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '1.0.0'; |
21
|
|
|
|
|
|
|
our @ISA = qw( Slackware::Slackget::List ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This class is a container of Slackware::Slackget::Package object, and allow you to perform some operations on this packages list. As the Package's list class, it is a slack-get's internal representation of data. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use Slackware::Slackget::PackageList; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $packagelist = Slackware::Slackget::PackageList->new(); |
30
|
|
|
|
|
|
|
$packagelist->add($package); |
31
|
|
|
|
|
|
|
$packagelist->get($index); |
32
|
|
|
|
|
|
|
my $package = $packagelist->Shift(); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This class constructor don't take any parameters to works properly, but you can eventually disable the root tag by using 'no-root-tag' => 1, and modify the default encoding (utf8) by passing an 'encoding' => parameter. Thoses options are only related to the export functions. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $PackageList = new Slackware::Slackget::PackageList (); |
42
|
|
|
|
|
|
|
my $PackageList = new Slackware::Slackget::PackageList ('no-root-tag' => 1); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
1
|
|
my ($class,%args) = @_ ; |
49
|
0
|
|
|
|
|
|
my $encoding = 'utf8'; |
50
|
0
|
0
|
0
|
|
|
|
if(defined($args{'encoding'}) && $args{'encoding'} !~ /^\s*$/) |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
|
|
|
$encoding = $args{'encoding'} ; |
53
|
0
|
|
|
|
|
|
delete($args{'encoding'}) ; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
my $self={list_type => 'Slackware::Slackget::Package','root-tag' => 'package-list',ENCODING => $encoding}; |
56
|
0
|
|
|
|
|
|
foreach (keys(%args)) |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
|
|
|
$self->{$_} = $args{$_}; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
bless($self,$class); |
61
|
0
|
|
|
|
|
|
return $self; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 FUNCTIONS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This class inheritate from Slackware::Slackget::List (L), so you may want read the Slackware::Slackget::List documentation for the supported methods of this class. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The present documentation present only methods that differs from the Slackware::Slackget::List class. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 fill_from_xml |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Fill the Slackware::Slackget::PackageList from the XML data passed as argument. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$packagelist->fill_from_xml( |
77
|
|
|
|
|
|
|
' |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1395 |
81
|
|
|
|
|
|
|
./slackware/d |
82
|
|
|
|
|
|
|
slackware |
83
|
|
|
|
|
|
|
3.3.4 |
84
|
|
|
|
|
|
|
gcc-objc |
85
|
|
|
|
|
|
|
3250 |
86
|
|
|
|
|
|
|
gcc-objc (Objective-C support for GCC) |
87
|
|
|
|
|
|
|
Objective-C support for the GNU Compiler Collection. |
88
|
|
|
|
|
|
|
This package contains those parts of the compiler collection needed to |
89
|
|
|
|
|
|
|
compile code written in Objective-C. Objective-C was originally |
90
|
|
|
|
|
|
|
developed to add object-oriented extensions to the C language, and is |
91
|
|
|
|
|
|
|
best known as the native language of the NeXT computer. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
565a10ce130b4287acf188a6c303a1a4 |
95
|
|
|
|
|
|
|
23bae31e3ffde5e7f44617bbdc7eb860 |
96
|
|
|
|
|
|
|
i486 |
97
|
|
|
|
|
|
|
slackware/d/ |
98
|
|
|
|
|
|
|
1 |
99
|
|
|
|
|
|
|
gcc-objc |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1589 |
105
|
|
|
|
|
|
|
slackware |
106
|
|
|
|
|
|
|
3.4.3 |
107
|
|
|
|
|
|
|
gcc-objc |
108
|
|
|
|
|
|
|
1027468ed0d63fcdd584f74d2696bf99 |
109
|
|
|
|
|
|
|
i486 |
110
|
|
|
|
|
|
|
5e659a567d944d6824f423d65e4f940f |
111
|
|
|
|
|
|
|
testing/packages/gcc-3.4.3/ |
112
|
|
|
|
|
|
|
1 |
113
|
|
|
|
|
|
|
gcc-objc |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
' |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub fill_from_xml |
121
|
|
|
|
|
|
|
{ |
122
|
0
|
|
|
0
|
1
|
|
my ($self,@xml) = @_ ; |
123
|
0
|
|
|
|
|
|
my $xml = ''; |
124
|
0
|
|
|
|
|
|
foreach (@xml) |
125
|
|
|
|
|
|
|
{ |
126
|
0
|
|
|
|
|
|
$xml .= $_ ; |
127
|
|
|
|
|
|
|
} |
128
|
0
|
|
|
|
|
|
require XML::Simple ; |
129
|
0
|
|
|
|
|
|
$XML::Simple::PREFERRED_PARSER='XML::Parser' ; |
130
|
0
|
|
|
|
|
|
my $xml_in = XML::Simple::XMLin($xml,KeyAttr => {'package' => 'id'}); |
131
|
|
|
|
|
|
|
# use Data::Dumper ; |
132
|
|
|
|
|
|
|
# print Data::Dumper::Dumper($xml_in); |
133
|
0
|
|
|
|
|
|
foreach my $pack_name (keys(%{$xml_in->{'package'}})){ |
|
0
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $package = new Slackware::Slackget::Package ($pack_name); |
135
|
0
|
|
|
|
|
|
foreach my $key (keys(%{$xml_in->{'package'}->{$pack_name}})){ |
|
0
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
if($key eq 'date') |
137
|
|
|
|
|
|
|
{ |
138
|
0
|
|
|
|
|
|
$package->setValue($key,Slackware::Slackget::Date->new(%{$xml_in->{'package'}->{$pack_name}->{$key}})); |
|
0
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
else |
141
|
|
|
|
|
|
|
{ |
142
|
0
|
|
|
|
|
|
$package->setValue($key,$xml_in->{'package'}->{$pack_name}->{$key}) ; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
} |
146
|
0
|
|
|
|
|
|
$self->add($package); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 Sort |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Apply the Perl built-in function sort() on the PackageList. This method return nothing. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
$list->Sort() ; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub Sort |
159
|
|
|
|
|
|
|
{ |
160
|
0
|
|
|
0
|
1
|
|
my $self = shift ; |
161
|
0
|
|
|
|
|
|
$self->{LIST} = [ sort {$a->{ROOT} cmp $b->{ROOT} } @{ $self->{LIST} } ] ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 index_list |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Create an index on the PackageList. This index don't take many memory but speed a lot search, especially when you already have the package id ! |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
The index is build with the Package ID. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub index_list |
173
|
|
|
|
|
|
|
{ |
174
|
0
|
|
|
0
|
1
|
|
my $self = shift ; |
175
|
0
|
|
|
|
|
|
$self->{INDEX} = {} ; |
176
|
0
|
|
|
|
|
|
foreach my $pkg (@{$self->{LIST}}) |
|
0
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
{ |
178
|
|
|
|
|
|
|
# print "[Slackware::Slackget::PackageList] indexing package: ",$pkg->get_id(),"\n"; |
179
|
0
|
|
|
|
|
|
$self->{INDEX}->{$pkg->get_id()} = $pkg ; |
180
|
|
|
|
|
|
|
} |
181
|
0
|
|
|
|
|
|
return 1; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 get_indexed |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Return a package, as well as Get() do but use the index to return it quickly. You must provide a package ID to this method. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
my $pkg = $list->get_indexed($qlistviewitem->text(5)) ; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub get_indexed |
193
|
|
|
|
|
|
|
{ |
194
|
0
|
|
|
0
|
1
|
|
my ($self, $id) = @_ ; |
195
|
0
|
|
|
|
|
|
return $self->{INDEX}->{$id} ; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 get_indexes |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Return the list of all indexes |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
my @indexes = $list->get_indexes() ; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub get_indexes |
207
|
|
|
|
|
|
|
{ |
208
|
0
|
|
|
0
|
1
|
|
my ($self, $id) = @_ ; |
209
|
0
|
|
|
|
|
|
return keys(%{$self->{INDEX}}) ; |
|
0
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub __to_string { |
213
|
0
|
|
|
0
|
|
|
my $self = shift ; |
214
|
|
|
|
|
|
|
# PACKAGES.TXT; Tue Aug 26 23:19:17 CEST 2008 |
215
|
|
|
|
|
|
|
# |
216
|
|
|
|
|
|
|
# This file provides details on the packages found on this site |
217
|
|
|
|
|
|
|
# Total size of all packages (compressed) : 4002 MB |
218
|
|
|
|
|
|
|
# Total size of all packages (uncompressed) : 10091 MB |
219
|
0
|
|
|
|
|
|
my $now_string = localtime; |
220
|
0
|
|
|
|
|
|
my $text = "PACKAGES.TXT; $now_string\n\nThis file provides details on the packages found on this site\n"; |
221
|
0
|
|
|
|
|
|
my $tsc = 0; # total size compressed |
222
|
0
|
|
|
|
|
|
my $tsu = 0; # total size uncompressed |
223
|
0
|
|
|
|
|
|
my $tmp_text = ''; |
224
|
0
|
|
|
|
|
|
foreach (@{$self->{LIST}}){ |
|
0
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
$tmp_text .= $_->to_string()."\n"; |
226
|
0
|
|
|
|
|
|
$tsc += $_->compressed_size(); |
227
|
0
|
|
|
|
|
|
$tsu += $_->uncompressed_size(); |
228
|
|
|
|
|
|
|
} |
229
|
0
|
|
|
|
|
|
$tmp_text =~ s/\n{3,}/\n\n/g; |
230
|
0
|
|
|
|
|
|
$tsc = int( $tsc / 1024 ); |
231
|
0
|
|
|
|
|
|
$tsu = int( $tsu / 1024 ); |
232
|
0
|
|
|
|
|
|
$text .= "Total size of all packages (compressed) : $tsc MB\nTotal size of all packages (uncompressed) : $tsu MB\n\n"; |
233
|
0
|
|
|
|
|
|
$text .= "$tmp_text\n"; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 AUTHOR |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
DUPUIS Arnaud, C<< >> |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 BUGS |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
243
|
|
|
|
|
|
|
C, or through the web interface at |
244
|
|
|
|
|
|
|
L. |
245
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
246
|
|
|
|
|
|
|
your bug as I make changes. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head1 BUGS |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
251
|
|
|
|
|
|
|
C, or through the web interface at |
252
|
|
|
|
|
|
|
L. |
253
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
254
|
|
|
|
|
|
|
your bug as I make changes. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 SUPPORT |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
perldoc Slackware::Slackget |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
You can also look for information at: |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=over 4 |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item * Infinity Perl website |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
L |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=item * slack-get specific website |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
L |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
L |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
L |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=item * CPAN Ratings |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
L |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=item * Search CPAN |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
L |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=back |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 SEE ALSO |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
Copyright 2005 DUPUIS Arnaud, All Rights Reserved. |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
304
|
|
|
|
|
|
|
under the same terms as Perl itself. |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=cut |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
1; # End of Slackware::Slackget::PackageList |