line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Harm Müller |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Pkg::Arch; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
13
|
use v5.12.5; |
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.3'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
50
|
|
13
|
1
|
|
|
1
|
|
5
|
use Rex::Commands::File; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
14
|
1
|
|
|
1
|
|
17
|
use Rex::Commands::Fs; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
8
|
use Rex::Pkg::Base; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
17
|
1
|
|
|
1
|
|
22
|
use base qw(Rex::Pkg::Base); |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
630
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
0
|
|
|
0
|
0
|
|
my $that = shift; |
21
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
22
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if ( Rex::has_feature_version('1.5') ) { |
27
|
|
|
|
|
|
|
$self->{commands} = { |
28
|
0
|
|
|
|
|
|
install => 'pacman --noprogressbar --noconfirm --needed -S %s', |
29
|
|
|
|
|
|
|
install_version => 'pacman --noprogressbar --noconfirm --needed -S %s', # makes no sense to specify the package version |
30
|
|
|
|
|
|
|
update_system => 'pacman --noprogressbar --noconfirm -Su', |
31
|
|
|
|
|
|
|
dist_update_system => 'pacman --noprogressbar --noconfirm -Su', |
32
|
|
|
|
|
|
|
remove => 'pacman --noprogressbar --noconfirm -Rs %s', |
33
|
|
|
|
|
|
|
update_package_db => 'pacman --noprogressbar -Sy', |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
|
|
|
|
|
|
$self->{commands} = { |
38
|
0
|
|
|
|
|
|
install => 'pacman --noprogressbar --noconfirm --needed -S %s', |
39
|
|
|
|
|
|
|
install_version => 'pacman --noprogressbar --noconfirm --needed -S %s', # makes no sense to specify the package version |
40
|
|
|
|
|
|
|
update_system => 'pacman --noprogressbar --noconfirm -Syu', |
41
|
|
|
|
|
|
|
dist_update_system => 'pacman --noprogressbar --noconfirm -Syu', |
42
|
|
|
|
|
|
|
remove => 'pacman --noprogressbar --noconfirm -Rs %s', |
43
|
|
|
|
|
|
|
update_package_db => 'pacman --noprogressbar -Sy', |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub bulk_install { |
51
|
0
|
|
|
0
|
0
|
|
my ( $self, $packages_aref, $option ) = @_; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
delete $option->{version}; # makes no sense to specify the same version for several packages |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->update( "@{$packages_aref}", $option ); |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return 1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub get_installed { |
61
|
0
|
|
|
0
|
0
|
|
my ( $self, $pkg ) = @_; |
62
|
0
|
|
|
|
|
|
my ( @pkgs, $name, $version, $release, $arch ); |
63
|
0
|
|
|
|
|
|
my $pkg_query = 'pacman -Qi | egrep "^Name|^Version|^Architecture"'; |
64
|
0
|
0
|
|
|
|
|
if ( defined($pkg) ) { |
65
|
0
|
|
|
|
|
|
$pkg_query .= " " . $pkg; |
66
|
|
|
|
|
|
|
} |
67
|
0
|
|
|
|
|
|
my @installed_packages = i_run $pkg_query; |
68
|
0
|
|
|
|
|
|
for my $line (@installed_packages) { |
69
|
0
|
0
|
|
|
|
|
if ( $line =~ m/^Name\s+:\s+([\S]+)$/ ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$name = $1; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
elsif ( $line =~ m/^Version\s+:\s+([\S]+)-([\S]+)$/ ) { |
73
|
0
|
|
|
|
|
|
$version = $1; |
74
|
0
|
|
|
|
|
|
$release = $2; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
elsif ( $line =~ m/^Architecture\s+:\s+([\S]+)$/ ) { |
77
|
0
|
|
|
|
|
|
$arch = $1; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
0
|
0
|
|
|
|
if ( defined($name) |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
80
|
|
|
|
|
|
|
&& defined($version) |
81
|
|
|
|
|
|
|
&& defined($release) |
82
|
|
|
|
|
|
|
&& defined($arch) ) |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
push( |
85
|
|
|
|
|
|
|
@pkgs, |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
name => $name, |
88
|
|
|
|
|
|
|
version => $version, |
89
|
|
|
|
|
|
|
release => $release, |
90
|
|
|
|
|
|
|
arch => $arch, |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
); |
93
|
0
|
|
|
|
|
|
$name = $version = $release = $arch = undef; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return @pkgs; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub add_repository { |
101
|
0
|
|
|
0
|
0
|
|
Rex::Logger::info( |
102
|
|
|
|
|
|
|
"no suitable repo management use template/file for pacman.conf"); |
103
|
0
|
|
|
|
|
|
return 1; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub rm_repository { |
107
|
0
|
|
|
0
|
0
|
|
Rex::Logger::info( |
108
|
|
|
|
|
|
|
"no suitable repo management use template/file for pacman.conf"); |
109
|
0
|
|
|
|
|
|
return 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |