lib/Rex/Pkg/VoidLinux.pm

filter: Statementstmt 45.8% 22 / 48 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 3 totaltotal 40.2% 29 / 72 CC 6 SCAR 21.2
CC
6
Cov
39%
get_installed
20.0
new
12.0
bulk_install
2.0
CRAP 8.3
« lib/Rex/Group/Entry/Server.pm ↑ Summary lib/Rex/Service/SunOS.pm »
1 #
2 # (c) 2019 Leah Neukirchen <leah@vuxu.org>
3 # based on Rex::Pkg::Arch
4 # (c) Harm Müller <harm _DOT_ mueller _AT_ g m a i l _Dot_ com>
5 #
6  
7 package Rex::Pkg::VoidLinux;
8  
9 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $VERSION = '1.16.1'; # VERSION
13  
14 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Rex::Commands::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Rex::Commands::Fs;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Rex::Pkg::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use base qw(Rex::Pkg::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
22 0 my $that = shift;
23 0 ▶ my $proto = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
24 0 my $self = $proto->SUPER::new(@_);
25  
26 0 bless( $self, $proto );
27  
28 0 ▶ if ( Rex::has_feature_version('1.5') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (Rex::has_feature_version('1.5')) { } 0 0 0
29 $self->{commands} = {
30 0 install => 'xbps-install -y %s',
31 install_version => 'xbps-install -y %s', # makes no sense to specify the package version
32 update_system => 'xbps-install -yu',
33 dist_update_system => 'xbps-install -yu',
34 remove => 'xbps-remove -Ry %s',
35 update_package_db => 'xbps-install -S',
36 };
37 }
38 else {
39 $self->{commands} = {
40 0 install => 'xbps-install -y %s',
41 install_version => 'xbps-install -y %s', # makes no sense to specify the package version
42 update_system => 'xbps-install -Syu',
43 dist_update_system => 'xbps-install -Syu',
44 remove => 'xbps-remove -Ry %s',
45 update_package_db => 'xbps-install -S',
46 };
47 }
48  
49 0 return $self;
50 }
51  
52 0 ▶sub bulk_install {
Subroutine bulk_install: not called CC=1 SCAR=6.9
Pod undocumented
53 0 my ( $self, $packages_aref, $option ) = @_;
54  
55 0 delete $option->{version}; # makes no sense to specify the same version for several packages
56  
57 0 $self->update( "@{$packages_aref}", $option );
58  
59 0 return 1;
60 }
61  
62 0 ▶sub get_installed {
Subroutine get_installed: not called CC=4 SCAR=30.0
Pod undocumented
63 0 my ( $self, $pkg ) = @_;
64 0 my ( @pkgs, $name, $version, $release, $arch );
65 0 my $pkg_query = 'xbps-query --search=';
66 0 ▶ if ( defined($pkg) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pkg) 0 0 0
67 0 $pkg_query .= $pkg;
68 }
69 0 my @installed_packages = i_run $pkg_query;
70 0 for my $line (@installed_packages) {
71 0 ▶ if ( $line =~ /^\[\*\] ([^ ]*)-([^- ]*)_(\d+)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\[\*\] ([^ ]*)-([^- ]*)_(\d+)/u) 0 0 0
72 0 $name = $1;
73 0 $version = $2;
74 0 $release = $3;
75 0 push(
76 @pkgs,
77 {
78 name => $name,
79 version => $version,
80 release => $release,
81 }
82 );
83 }
84 }
85  
86 0 return @pkgs;
87 }
88  
89 1 1;
« lib/Rex/Group/Entry/Server.pm ↑ Summary lib/Rex/Service/SunOS.pm »