| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Pkg::SuSE; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use v5.12.5; |
|
|
1
|
|
|
|
|
3
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use Rex::Helper::Run; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
68
|
|
|
13
|
1
|
|
|
1
|
|
8
|
use Rex::Pkg::Base; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
14
|
1
|
|
|
1
|
|
24
|
use base qw(Rex::Pkg::Base); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
622
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
0
|
|
|
0
|
0
|
|
my $that = shift; |
|
18
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
|
19
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ( Rex::has_feature_version('1.5') ) { |
|
24
|
|
|
|
|
|
|
$self->{commands} = { |
|
25
|
0
|
|
|
|
|
|
install => 'zypper -n install %s', |
|
26
|
|
|
|
|
|
|
install_version => 'zypper -n install $pkg-%s', |
|
27
|
|
|
|
|
|
|
update_system => 'zypper -n --no-refresh up', |
|
28
|
|
|
|
|
|
|
dist_update_system => 'zypper -n --no-refresh up', |
|
29
|
|
|
|
|
|
|
remove => 'zypper -n remove %s', |
|
30
|
|
|
|
|
|
|
update_package_db => 'zypper -n ref -fd', |
|
31
|
|
|
|
|
|
|
}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
else { |
|
34
|
|
|
|
|
|
|
$self->{commands} = { |
|
35
|
0
|
|
|
|
|
|
install => 'zypper -n install %s', |
|
36
|
|
|
|
|
|
|
install_version => 'zypper -n install $pkg-%s', |
|
37
|
|
|
|
|
|
|
update_system => 'zypper -n up', |
|
38
|
|
|
|
|
|
|
dist_update_system => 'zypper -n up', |
|
39
|
|
|
|
|
|
|
remove => 'zypper -n remove %s', |
|
40
|
|
|
|
|
|
|
update_package_db => 'zypper --no-gpg-checks -n ref -fd', |
|
41
|
|
|
|
|
|
|
}; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub bulk_install { |
|
48
|
0
|
|
|
0
|
0
|
|
my ( $self, $packages_aref, $option ) = @_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
delete $option->{version}; # makes no sense to specify the same version for several packages |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$self->update( "@{$packages_aref}", $option ); |
|
|
0
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return 1; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub get_installed { |
|
58
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my @lines = i_run |
|
61
|
|
|
|
|
|
|
'rpm -qa --nosignature --nodigest --qf "%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n"'; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my @pkg; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
for my $line (@lines) { |
|
66
|
0
|
0
|
|
|
|
|
if ( $line =~ m/^([^\s]+)\s([^\s]+)\s([^\s]+)\s([^\s]+)\s(.*)$/ ) { |
|
67
|
0
|
|
|
|
|
|
push( |
|
68
|
|
|
|
|
|
|
@pkg, |
|
69
|
|
|
|
|
|
|
{ |
|
70
|
|
|
|
|
|
|
name => $1, |
|
71
|
|
|
|
|
|
|
epoch => $2, |
|
72
|
|
|
|
|
|
|
version => $3, |
|
73
|
|
|
|
|
|
|
release => $4, |
|
74
|
|
|
|
|
|
|
arch => $5, |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return @pkg; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub add_repository { |
|
84
|
0
|
|
|
0
|
0
|
|
my ( $self, %data ) = @_; |
|
85
|
|
|
|
|
|
|
i_run "zypper addrepo -f -n " |
|
86
|
|
|
|
|
|
|
. $data{"name"} . " " |
|
87
|
|
|
|
|
|
|
. $data{"url"} . " " |
|
88
|
0
|
|
|
|
|
|
. $data{"name"}, fail_ok => 1; |
|
89
|
0
|
0
|
|
|
|
|
if ( $? == 4 ) { |
|
90
|
0
|
0
|
|
|
|
|
if ( Rex::Config->get_do_reporting ) { |
|
91
|
0
|
|
|
|
|
|
return { changed => 0 }; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
} |
|
94
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
|
95
|
0
|
|
|
|
|
|
die( "Error adding repository " . $data{name} ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub rm_repository { |
|
100
|
0
|
|
|
0
|
0
|
|
my ( $self, $name ) = @_; |
|
101
|
0
|
|
|
|
|
|
i_run "zypper removerepo $name", fail_ok => 1; |
|
102
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
|
103
|
0
|
|
|
|
|
|
die("Error removing repository $name"); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
if ( Rex::Config->get_do_reporting ) { |
|
107
|
0
|
|
|
|
|
|
return { changed => 1 }; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |