wok-current rev 3680
Fix: ocsinventory-agent, remove escape chars from tazpkg list output.
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Mon Jul 13 10:52:36 2009 +0200 (2009-07-13) |
parents | db6394fb176f |
children | 38a300aed37e |
files | ocsinventory-agent/stuff/Tazpkg.pm |
line diff
1.1 --- a/ocsinventory-agent/stuff/Tazpkg.pm Sun Jul 12 23:18:03 2009 +0200 1.2 +++ b/ocsinventory-agent/stuff/Tazpkg.pm Mon Jul 13 10:52:36 2009 +0200 1.3 @@ -6,18 +6,22 @@ 1.4 sub check { can_run("tazpkg") } 1.5 1.6 sub run { 1.7 - my $params = shift; 1.8 - my $inventory = $params->{inventory}; 1.9 + my $params = shift; 1.10 + my $inventory = $params->{inventory}; 1.11 1.12 -# use dpkg-query -W -f='${Package}|||${Version}\n' 1.13 - foreach (`tazpkg list `){ 1.14 - if (/^(\S+)\s+([0-9]+.*)\s+(.*)/) { 1.15 - $inventory->addSoftwares({ 1.16 - 'NAME' => $1, 1.17 - 'VERSION' => $2, 1.18 - }); 1.19 - } 1.20 - } 1.21 + # use tazpkg list\n' 1.22 + foreach (`tazpkg list `){ 1.23 + next if (/List of/); 1.24 + next if (/packages installed/); 1.25 + 1.26 + if (/^(\S+)\[24G\s+(\S+)\[42G\s+(\S+)/) { 1.27 + $inventory->addSoftwares({ 1.28 + 'NAME' => $1, 1.29 + 'VERSION' => $2, 1.30 + 'COMMENTS' => $3 1.31 + }); 1.32 + } 1.33 + } 1.34 1.35 } 1.36