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