line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::Softwares::Gentoo; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
156097771
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
98
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
118
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use English qw(-no_match_vars); |
|
2
|
|
|
|
|
155
|
|
|
2
|
|
|
|
|
35
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
2206
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1020
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub isEnabled { |
11
|
0
|
|
|
0
|
0
|
0
|
return canRun('equery'); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub doInventory { |
15
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
18
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
0
|
my $command = _equeryNeedsWildcard() ? |
21
|
|
|
|
|
|
|
"equery list -i '*'" : "equery list -i"; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
my $packages = _getPackagesList( |
24
|
|
|
|
|
|
|
logger => $logger, command => $command |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
foreach my $package (@$packages) { |
28
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
29
|
|
|
|
|
|
|
section => 'SOFTWARES', |
30
|
|
|
|
|
|
|
entry => $package |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _getPackagesList { |
36
|
0
|
|
|
0
|
|
0
|
my $handle = getFileHandle(@_); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
my @packages; |
39
|
0
|
|
|
|
|
0
|
while (my $line = <$handle>) { |
40
|
0
|
|
|
|
|
0
|
chomp $line; |
41
|
0
|
0
|
|
|
|
0
|
next unless $line =~ /^(.*)-([0-9]+.*)/; |
42
|
0
|
|
|
|
|
0
|
push @packages, { |
43
|
|
|
|
|
|
|
NAME => $1, |
44
|
|
|
|
|
|
|
VERSION => $2, |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
0
|
close $handle; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
return \@packages; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# http://forge.fusioninventory.org/issues/852 |
53
|
|
|
|
|
|
|
sub _equeryNeedsWildcard { |
54
|
2
|
|
|
2
|
|
303
|
my ($major, $minor) = getFirstMatch( |
55
|
|
|
|
|
|
|
command => 'equery -V', |
56
|
|
|
|
|
|
|
pattern => qr/^equery ?\((\d+)\.(\d+)\.\d+\)/, |
57
|
|
|
|
|
|
|
@_ |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# true starting from version 0.3 |
61
|
2
|
|
|
|
|
11
|
return compareVersion($major, $minor, 0, 3); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |