blob: 1f7283097c8b55f460e071050d91587662832936 (
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
|
# $Id: /local/youri/soft/trunk/lib/Youri/Package/URPM.pm 2257 2006-07-05T09:22:47.088572Z guillaume $
package Youri::Package::RPM;
=head1 NAME
Youri::Package::RPM - Base class for all RPM-based package implementation
=head1 DESCRIPTION
This bases class factorize code between various RPM-based package
implementation.
=cut
use strict;
use warnings;
use base 'Youri::Package';
use Carp;
sub get_pattern {
my ($class, $name, $version, $release, $arch) = @_;
return
($name ? quotemeta($name) : '[\w-]+' ).
'-' .
($version ? quotemeta($version) : '[^-]+' ).
'-' .
($release ? quotemeta($release) : '[^-]+' ).
'\.' .
($arch ? quotemeta($arch) : '\w+' ).
'\.rpm';
}
sub as_file {
my ($self) = @_;
croak "Not a class method" unless ref $self;
return $self->{_file};
}
sub is_debug {
my ($self) = @_;
croak "Not a class method" unless ref $self;
my $name = $self->get_name();
my $group = $self->get_tag('group');
# debug packages' names must end in -debug, except kernel
if ($group =~ m,^Development/Debug$, &&
($name =~ /-debug$/o || $name =~ /^kernel-.*-debug/o)) {
return 1;
}
else {
return 0;
}
}
1;
|