| 1 | # | ||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Rex::Pkg::Mageia; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use v5.14.4; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 1 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 1 | ▶ | use Rex::Helper::Run; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 1 | ▶ | use Rex::Pkg::Base; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 1 | ▶ | use base qw(Rex::Pkg::Base); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 17 | 0 | my $that = shift; | |||||||||||||||||||
| 18 | 0 | ▶ | my $proto = ref($that) || $that; | ||||||||||||||||||
|
Condition0%0/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 19 | 0 | my $self = $proto->SUPER::new(@_); | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 0 | bless( $self, $proto ); | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | ▶ | if ( Rex::has_feature_version('1.5') ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | $self->{commands} = { | ||||||||||||||||||||
| 25 | 0 | install => 'urpmi --auto --quiet %s', | |||||||||||||||||||
| 26 | install_version => 'urpmi --auto --quiet %s', | ||||||||||||||||||||
| 27 | update_system => 'urpmi --auto --quiet --auto-select', | ||||||||||||||||||||
| 28 | dist_update_system => 'urpmi --auto --quiet --auto-select', | ||||||||||||||||||||
| 29 | remove => 'urpme --auto %s', | ||||||||||||||||||||
| 30 | update_package_db => 'urpmi.update -a', | ||||||||||||||||||||
| 31 | }; | ||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | else { | ||||||||||||||||||||
| 34 | $self->{commands} = { | ||||||||||||||||||||
| 35 | 0 | install => 'urpmi --auto --quiet %s', | |||||||||||||||||||
| 36 | install_version => 'urpmi --auto --quiet %s', | ||||||||||||||||||||
| 37 | update_system => 'urpmi --auto --quiet --auto-update', | ||||||||||||||||||||
| 38 | dist_update_system => 'urpmi --auto --quiet --auto-update', | ||||||||||||||||||||
| 39 | remove => 'urpme --auto %s', | ||||||||||||||||||||
| 40 | update_package_db => 'urpmi.update -a', | ||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | return $self; | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 0 | ▶ | sub get_installed { | ||||||||||||||||||
|
Subroutine
get_installed: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 48 | 0 | my ($self) = @_; | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 0 | my @lines = i_run | |||||||||||||||||||
| 51 | 'rpm -qa --nosignature --nodigest --qf "%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n"'; | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | my @pkg; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 0 | for my $line (@lines) { | |||||||||||||||||||
| 56 | 0 | ▶ | if ( $line =~ m/^([^\s]+)\s([^\s]+)\s([^\s]+)\s([^\s]+)\s(.*)$/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | 0 | push( | |||||||||||||||||||
| 58 | @pkg, | ||||||||||||||||||||
| 59 | { | ||||||||||||||||||||
| 60 | name => $1, | ||||||||||||||||||||
| 61 | epoch => $2, | ||||||||||||||||||||
| 62 | version => $3, | ||||||||||||||||||||
| 63 | release => $4, | ||||||||||||||||||||
| 64 | arch => $5, | ||||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 0 | return @pkg; | |||||||||||||||||||
| 71 | } | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 0 | ▶ | sub add_repository { | ||||||||||||||||||
|
Subroutine
add_repository: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 74 | 0 | my ( $self, %data ) = @_; | |||||||||||||||||||
| 75 | 0 | my $name = $data{"name"}; | |||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 0 | i_run "urpmi.addmedia $name " . $data{"url"}, fail_ok => 1; | |||||||||||||||||||
| 78 | 0 | ▶ | if ( $? != 0 ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 79 | 0 | die("Error adding repository $name"); | |||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | } | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 0 | ▶ | sub rm_repository { | ||||||||||||||||||
|
Subroutine
rm_repository: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 84 | 0 | my ( $self, $name ) = @_; | |||||||||||||||||||
| 85 | 0 | i_run "urpmi.removemedia $name", fail_ok => 1; | |||||||||||||||||||
| 86 | 0 | ▶ | if ( $? != 0 ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 87 | 0 | die("Error removing repository $name"); | |||||||||||||||||||
| 88 | } | ||||||||||||||||||||
| 89 | } | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 1 | 1; | |||||||||||||||||||