blob: 889bfabd1804d2525cd5570f83b6549ea4593ccc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
package urpm::xml_info_pkg;
use strict;
=head1 NAME
urpm::xml_info_pkg - XML Package data retrieving related routines for urpmi
=head1 SYNOPSIS
=head1 DESCRIPTION
=over
=item new($class, $hash, $pkg)
Returns a proxy object
It enable to get the XML info if available, otherwise redirects to URPM::Package
=cut
sub new {
my ($class, $hash, $pkg) = @_;
$pkg and $hash->{pkg} = $pkg;
bless $hash, $class;
}
=item id($pkg)
=item group($pkg)
=item size($pkg)
=item epoch($pkg)
=item buildhost($pkg)
=item packager($pkg)
=item summary($pkg)
Only available in synthesis/hdlist
=cut
sub id { $_[0]{pkg}->id }
sub group { $_[0]{pkg}->group }
sub size { $_[0]{pkg}->size }
sub epoch { $_[0]{pkg}->epoch }
sub buildhost { $_[0]{pkg}->buildhost }
sub packager { $_[0]{pkg}->packager }
sub summary { $_[0]{pkg}->summary }
=item url($pkg)
=item license($pkg)
=item sourcerpm($pkg)
=item description($pkg)
=item changelogs($pkg)
=item files($pkg)
Can be directly available in xml_info
=cut
sub url { exists $_[0]{url} ? $_[0]{url} : $_[0]{pkg}->url }
sub license { exists $_[0]{license} ? $_[0]{license} : $_[0]{pkg}->license }
sub sourcerpm { exists $_[0]{sourcerpm} ? $_[0]{sourcerpm} : $_[0]{pkg}->sourcerpm }
sub description { exists $_[0]{description} ? $_[0]{description} : $_[0]{pkg}->description }
sub changelogs { exists $_[0]{changelogs} ? @{$_[0]{changelogs}} : $_[0]{pkg}->changelogs }
sub files { exists $_[0]{files} ? split("\n", $_[0]{files}) : $_[0]{pkg}->files }
my $fullname_re = qr/^(.*)-([^\-]*)-([^\-]*)\.([^\.\-]*)$/;
=item name($pkg)
=item version($pkg)
=item release($pkg)
=item arch($pkg)
=item fullname($pkg)
=item filename($pkg)
Available in both {pkg} and {fn}
=cut
sub name { exists $_[0]{pkg} ? $_[0]{pkg}->name : $_[0]{fn} =~ $fullname_re && $1 }
sub version { exists $_[0]{pkg} ? $_[0]{pkg}->version : $_[0]{fn} =~ $fullname_re && $2 }
sub release { exists $_[0]{pkg} ? $_[0]{pkg}->release : $_[0]{fn} =~ $fullname_re && $3 }
sub arch { exists $_[0]{pkg} ? $_[0]{pkg}->arch : $_[0]{fn} =~ $fullname_re && $4 }
sub fullname { wantarray() ? $_[0]{pkg}->fullname : $_[0]{fn} }
sub filename { $_[0]{fn} . '.rpm' }
1;
=back
=head1 COPYRIGHT
Copyright (C) 2005 MandrakeSoft SA
Copyright (C) 2005-2010 Mandriva SA
=cut
|