| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Debian::Releases; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$Debian::Releases::VERSION = '0.14'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
# ABSTRACT: Mapping and comparing Debian release codenames and versions |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
26412
|
use 5.010_000; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
41
|
|
|
8
|
1
|
|
|
1
|
|
1601
|
use mro 'c3'; |
|
|
1
|
|
|
|
|
2093
|
|
|
|
1
|
|
|
|
|
7
|
|
|
9
|
1
|
|
|
1
|
|
133
|
use feature ':5.10'; |
|
|
1
|
|
|
|
|
10
|
|
|
|
1
|
|
|
|
|
112
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1651
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use namespace::autoclean; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Version::Compare; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'releases' => ( |
|
18
|
|
|
|
|
|
|
'is' => 'ro', |
|
19
|
|
|
|
|
|
|
'isa' => 'HashRef[Str]', |
|
20
|
|
|
|
|
|
|
'lazy' => 1, |
|
21
|
|
|
|
|
|
|
'builder' => '_init_releases', |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'codenames' => ( |
|
25
|
|
|
|
|
|
|
'is' => 'ro', |
|
26
|
|
|
|
|
|
|
'isa' => 'HashRef[Str]', |
|
27
|
|
|
|
|
|
|
'lazy' => 1, |
|
28
|
|
|
|
|
|
|
'builder' => '_init_codenames', |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _init_releases { |
|
32
|
|
|
|
|
|
|
my $self = shift; |
|
33
|
|
|
|
|
|
|
my $rels = { |
|
34
|
|
|
|
|
|
|
'1.1' => 'buzz', |
|
35
|
|
|
|
|
|
|
'1.2' => 'rex', |
|
36
|
|
|
|
|
|
|
'1.3' => 'bo', |
|
37
|
|
|
|
|
|
|
'2.0' => 'hamm', |
|
38
|
|
|
|
|
|
|
'2.1' => 'slink', |
|
39
|
|
|
|
|
|
|
'2.2' => 'potato', |
|
40
|
|
|
|
|
|
|
'3.0' => 'woody', |
|
41
|
|
|
|
|
|
|
'3.1' => 'sarge', |
|
42
|
|
|
|
|
|
|
'4.0' => 'etch', |
|
43
|
|
|
|
|
|
|
'5.0' => 'lenny', |
|
44
|
|
|
|
|
|
|
'6.0' => 'squeeze', |
|
45
|
|
|
|
|
|
|
'7.0' => 'wheezy', |
|
46
|
|
|
|
|
|
|
'8.0' => 'jessie', |
|
47
|
|
|
|
|
|
|
'9999.9999' => 'sid', |
|
48
|
|
|
|
|
|
|
}; |
|
49
|
|
|
|
|
|
|
return $rels; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _init_codenames { |
|
53
|
|
|
|
|
|
|
my $self = shift; |
|
54
|
|
|
|
|
|
|
my $rels = $self->releases(); |
|
55
|
|
|
|
|
|
|
my $codes = {}; |
|
56
|
|
|
|
|
|
|
foreach my $version ( keys %{$rels} ) { |
|
57
|
|
|
|
|
|
|
my $codename = $rels->{$version}; |
|
58
|
|
|
|
|
|
|
$codes->{$codename} = $version; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
return $codes; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
## no critic (ProhibitAmbiguousNames) |
|
65
|
|
|
|
|
|
|
sub version_compare { |
|
66
|
|
|
|
|
|
|
my $self = shift; |
|
67
|
|
|
|
|
|
|
my $left = shift; |
|
68
|
|
|
|
|
|
|
my $right = shift; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$left =~ s/^\s+//; |
|
71
|
|
|
|
|
|
|
$left =~ s/\s+$//; |
|
72
|
|
|
|
|
|
|
$right =~ s/^\s+//; |
|
73
|
|
|
|
|
|
|
$right =~ s/\s+$//; |
|
74
|
|
|
|
|
|
|
$left =~ s/\s*Debian\s*//g; |
|
75
|
|
|
|
|
|
|
$right =~ s/\s*Debian\s*//g; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
if ( $left =~ m/^(\d+\.\d)/ ) { |
|
78
|
|
|
|
|
|
|
$left = $1; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
elsif ( my $ver = $self->codenames()->{$left} ) { |
|
81
|
|
|
|
|
|
|
$left = $ver; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
else { |
|
84
|
|
|
|
|
|
|
$left = '0.0'; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
if ( $right =~ m/^(\d+\.\d)/ ) { |
|
87
|
|
|
|
|
|
|
$right = $1; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
elsif ( my $ver = $self->codenames()->{$right} ) { |
|
90
|
|
|
|
|
|
|
$right = $ver; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
else { |
|
93
|
|
|
|
|
|
|
$right = '0.0'; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
return Version::Compare::version_compare( $left, $right ); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
## use critic |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
no Moose; |
|
101
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; # End of Debian::Releases |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=pod |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 NAME |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Debian::Releases - Mapping and comparing Debian release codenames and versions |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 VERSION |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
version 0.14 |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use Debian::Releases; |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
if(Debian::Releases::version_compare('6.0','squeeze')) { |
|
123
|
|
|
|
|
|
|
print "This is squeeze\n"; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 NAME |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Debian::Releases - Comparing debian releases |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 version_compare |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Compare two debian releases in numerical or codename form. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Dominik Schulz, C<< <dominik.schulz at gauner.org> >> |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 BUGS |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-debian-releases at rt.cpan.org>, or through |
|
143
|
|
|
|
|
|
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Debian-Releases>. I will be notified, and then you'll |
|
144
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SUPPORT |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
perldoc Debian::Releases |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You can also look for information at: |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=over 4 |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Debian-Releases> |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Debian-Releases> |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Debian-Releases> |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * Search CPAN |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Debian-Releases/> |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=back |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Copyright 2012 Dominik Schulz |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
179
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
180
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 AUTHOR |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Dominik Schulz <dominik.schulz@gauner.org> |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Dominik Schulz. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
193
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=cut |