blib/lib/auto/share/dist/Alien-Alien/lib/perl5/Alien/Package/Lsb.pm

filter: Statementstmt 16.2% 7 / 43 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 25.0% 2 / 8 Podpod 100% 6 / 6 totaltotal 22.0% 15 / 68 CC 7 SCAR 22.7
CC
7
Cov
13%
build
20.0
checkfile
12.0
prep
6.0
CRAP 9.6
« blib/lib/auto/share/dist/Alien-Alien/lib/perl5/Alien/Package/Slp.pm ↑ Summary blib/lib/auto/share/dist/Alien-Alien/bin/alien »
1 #!/usr/bin/perl -w
2  
3 =head1 NAME
4  
5 Alien::Package::Lsb - an object that represents a lsb package
6  
7 =cut
8  
9 package Alien::Package::Lsb;
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use base qw(Alien::Package::Rpm);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 DESCRIPTION
14  
15 This is an object class that represents a lsb package. It is derived from
16 Alien::Package::Rpm.
17  
18 =head1 METHODS
19  
20 =over 4
21  
22 =item checkfile
23  
24 Lsb files are rpm's with a lsb- prefix, that depend on a package called 'lsb'
25 and nothing else.
26  
27 =cut
28  
29 0 ▶sub checkfile {
Subroutine checkfile: not called CC=3 SCAR=24.8
Pod documented
30 0 my $this=shift;
31 0 my $file=shift;
32 0 ▶ return unless $file =~ m/^lsb-.*\.rpm$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $file =~ /^lsb-.*\.rpm$/ 0 0 0
33 0 my @deps=$this->runpipe(1, "LANG=C rpm -qp -R '$file'");
34 0 ▶ return 1 if grep { s/\s+//g; $_ eq 'lsb' } @deps;
Branch: 1 branch
BranchTrueFalseTotal
if grep {s/\s+//g; $_ eq "lsb";} @deps 0 0 0
35 0 return;
36 }
37  
38 =item scan
39  
40 Uses the parent scan method to read the file. lsb is added to the depends.
41  
42 =cut
43  
44 0 ▶sub scan {
Subroutine scan: not called CC=1 SCAR=6.9
Pod documented
45 0 my $this=shift;
46 0 $this->SUPER::scan(@_);
47  
48 0 $this->distribution("Linux Standard Base");
49 0 $this->origformat("lsb");
50 0 $this->depends("lsb");
51 # Converting from lsb, so the scripts should be portable and safe.
52 # Haha.
53 0 $this->usescripts(1);
54  
55 0 return 1;
56 }
57  
58 =item prep
59  
60 The parent's prep method is used to generate the spec file. First though,
61 the package's name is munged to make it lsb compliant (sorta) and lsb is added
62 to its dependencies.
63  
64 =cut
65  
66 0 ▶sub prep {
Subroutine prep: not called CC=2 SCAR=17.9
Pod documented
67 0 my $this=shift;
68
69 0 $this->_orig_name($this->name);
70 0 ▶ if ($this->name !~ /^lsb-/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($this->name =~ /^lsb-/) 0 0 0
71 0 $this->name("lsb-".$this->name);
72 }
73 0 $this->_orig_depends($this->depends);
74 0 $this->depends("lsb");
75 # Always include scripts when generating lsb package.
76 0 $this->_orig_usescripts($this->usescripts);
77 0 $this->usescripts(1);
78
79 0 $this->SUPER::prep(@_);
80 }
81  
82 =item revert
83  
84 Undo the changes made by prep.
85  
86 =cut
87  
88 0 ▶sub revert {
Subroutine revert: not called CC=1 SCAR=6.9
Pod documented
89 0 my $this=shift;
90 0 $this->name($this->_orig_name);
91 0 $this->depends($this->_orig_depends);
92 0 $this->usescripts($this->_orig_usescripts);
93 0 $this->SUPER::revert(@_);
94 }
95  
96  
97 =item build
98  
99 Uses the parent's build method. If a lsb-rpmbuild is available, uses it to
100 build the package.
101  
102 =cut
103  
104 0 ▶sub build {
Subroutine build: not called CC=4 SCAR=30.0
Pod documented
105 0 my $this=shift;
106 0 ▶ my $buildcmd=shift || 'rpmbuild';
Condition0%0/2
shift() || 'rpmbuild'
l!l
00
MC/DC0%0/1
shift() || 'rpmbuild'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
107 0 foreach (split(/:/,$ENV{PATH})) {
108 0 ▶ if (-x "$_/lsb-rpmbuild") {
Branch: 1 branch
BranchTrueFalseTotal
if (-x "$_/lsb-rpmbuild") 0 0 0
109 0 $buildcmd='lsb-rpmbuild';
110 0 last;
111 }
112 }
113 0 $this->SUPER::build($buildcmd);
114 }
115  
116 =item incrementrelease
117  
118 LSB package versions are not changed.
119  
120 =cut
121  
122 0 ▶sub incrementrelease {}
Subroutine incrementrelease: not called CC=1 SCAR=0.0
Pod documented
123  
124 =back
125  
126 =head1 AUTHOR
127  
128 Joey Hess <joey@kitenet.net>
129  
130 =cut
131  
132 1 1
« blib/lib/auto/share/dist/Alien-Alien/lib/perl5/Alien/Package/Slp.pm ↑ Summary blib/lib/auto/share/dist/Alien-Alien/bin/alien »