git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #32135 from phile314/fusion-inventory

Fusion inventory: 2.3.18 -> 2.3.21, misc. fixes

commit99bab78abd28d176ae4935b03b4fe3b1fd247c22 authorOrivej Desh <orivej@gmx.fr> dateWed 29 Nov 2017, 14:59 (9 years ago) parentdf5600d59a737a
3 files changed+53−17
nixos/modules/services/monitoring/fusion-inventory.nix−3 pkgs/servers/monitoring/fusion-inventory/default.nix+35−9 pkgs/servers/monitoring/fusion-inventory/remove_software_test.patch+18−5
nixos/modules/services/monitoring/fusion-inventory.nix−3
@@ -55,9 +55,6 @@ in {
5555 description = "Fusion Inventory Agent";
5656 wantedBy = [ "multi-user.target" ];
5757
58− environment = {
59− OPTIONS = "--no-category=software";
60− };
6158 serviceConfig = {
6259 ExecStart = "${pkgs.fusionInventory}/bin/fusioninventory-agent --conf-file=${configFile} --daemon --no-fork";
6360 };
pkgs/servers/monitoring/fusion-inventory/default.nix+35−9
@@ -1,22 +1,44 @@
1−{ stdenv, fetchurl, buildPerlPackage, perlPackages
1+{ stdenv, lib, fetchurl, buildPerlPackage, perlPackages, gnused, nix, dmidecode, pciutils, usbutils, iproute, nettools
2+, fetchFromGitHub, makeWrapper
23}:
34
45buildPerlPackage rec {
5− version = "2.3.18";
66 name = "FusionInventory-Agent-${version}";
7− src = fetchurl {
8− url = "mirror://cpan/authors/id/G/GR/GROUSSE/${name}.tar.gz";
9− sha256 = "543d96fa61b8f2a2bc599fe9f694f19d1f2094dc5506bc514d00b8a445bc5401";
7+ version = "2.3.21";
8+
9+ src = fetchFromGitHub {
10+ owner = "fusioninventory";
11+ repo = "fusioninventory-agent";
12+ rev = version;
13+ sha256 = "034clffcn0agx85macjgml4lyhvvck7idn94pqd2c77pk6crvw2y";
1014 };
1115
12− patches = [ ./remove_software_test.patch ];
16+ patches = [
17+ ./remove_software_test.patch
18+ # support for os-release file
19+ (fetchurl {
20+ url = https://github.com/fusioninventory/fusioninventory-agent/pull/396.diff;
21+ sha256 = "0bxrjmff80ab01n23xggci32ajsah6zvcmz5x4hj6ayy6dzwi6jb";
22+ })
23+ # support for Nix software inventory
24+ (fetchurl {
25+ url = https://github.com/fusioninventory/fusioninventory-agent/pull/397.diff;
26+ sha256 = "0pyf7mp0zsb3zcqb6yysr1zfp54p9ciwjn1pzayw6s9flmcgrmbw";
27+ })
28+ ];
1329
1430 postPatch = ''
31+
1532 patchShebangs bin
33+
34+ substituteInPlace "lib/FusionInventory/Agent/Tools/Linux.pm" \
35+ --replace /sbin/ip ${iproute}/sbin/ip
36+ substituteInPlace "lib/FusionInventory/Agent/Task/Inventory/Linux/Networks.pm" \
37+ --replace /sbin/ip ${iproute}/sbin/ip
1638 '';
1739
1840 buildTools = [];
19− buildInputs = with perlPackages; [
41+ buildInputs = [ makeWrapper ] ++ (with perlPackages; [
2042 CGI
2143 DataStructureUtil
2244 FileCopyRecursive
@@ -28,6 +50,7 @@ buildPerlPackage rec {
2850 IPCRun
2951 JSON
3052 LWPProtocolhttps
53+ ModuleInstall
3154 NetSNMP
3255 TestCompile
3356 TestDeep
@@ -35,7 +58,7 @@ buildPerlPackage rec {
3558 TestMockModule
3659 TestMockObject
3760 TestNoWarnings
38− ];
61+ ]);
3962 propagatedBuildInputs = with perlPackages; [
4063 FileWhich
4164 LWP
@@ -52,7 +75,10 @@ buildPerlPackage rec {
5275 cp -r lib $out
5376
5477 for cur in $out/bin/*; do
55− sed -e "s|./lib|$out/lib|" -i "$cur"
78+ if [ -x "$cur" ]; then
79+ sed -e "s|./lib|$out/lib|" -i "$cur"
80+ wrapProgram "$cur" --prefix PATH : ${lib.makeBinPath [nix dmidecode pciutils usbutils nettools iproute]}
81+ fi
5682 done
5783 '';
5884
pkgs/servers/monitoring/fusion-inventory/remove_software_test.patch+18−5
@@ -28,7 +28,7 @@ index 8ee7ff02c..bd5551ab3 100755
2828 skip 'live SNMP test disabled', 6 unless $ENV{TEST_LIVE_SNMP};
2929
3030diff --git a/t/apps/agent.t b/t/apps/agent.t
31−index f417b4106..12207f192 100755
31+index c0f6fc52f..c83837d70 100755
3232--- a/t/apps/agent.t
3333+++ b/t/apps/agent.t
3434@@ -12,7 +12,7 @@ use XML::TreePP;
@@ -40,15 +40,28 @@ index f417b4106..12207f192 100755
4040
4141 my ($content, $out, $err, $rc);
4242
43−@@ -73,11 +73,6 @@ subtest "first inventory execution and content" => sub {
43+@@ -71,11 +71,6 @@ subtest "first inventory execution and content" => sub {
44+ check_content_ok($out);
4445 };
4546
46− ok(
47+-ok(
4748- exists $content->{REQUEST}->{CONTENT}->{SOFTWARES},
4849- 'inventory has software'
4950-);
5051-
51−-ok(
52+ ok(
5253 exists $content->{REQUEST}->{CONTENT}->{ENVS},
5354 'inventory has environment variables'
54− );
55+diff --git a/t/tasks/inventory/linux/softwares.t b/t/tasks/inventory/linux/softwares.t
56+index 72a0e578c..13944f34f 100755
57+--- a/t/tasks/inventory/linux/softwares.t
58++++ b/t/tasks/inventory/linux/softwares.t
59+@@ -89,7 +89,7 @@ my $rpm_packages = [
60+ PUBLISHER => 'Mageia.Org',
61+ NAME => 'xfsprogs',
62+ COMMENTS => 'Utilities for managing the XFS filesystem',
63+- INSTALLDATE => '25/03/2012',
64++ INSTALLDATE => '24/03/2012',
65+ FILESIZE => '3628382',
66+ FROM => 'rpm',
67+ ARCH => 'x86_64',