[fusioninventory-agent] update to 2.2.0

Remi Collet remi at fedoraproject.org
Thu May 10 17:23:25 UTC 2012


commit 2314fa190bf6214a31253cec7e665b884bb06972
Author: remi <fedora at famillecollet.com>
Date:   Thu May 10 19:23:17 2012 +0200

    update to 2.2.0

 .gitignore                       |    1 +
 fusioninventory-agent-arch.patch |   12 +++
 fusioninventory-agent.service    |   11 +++
 fusioninventory-agent.spec       |  152 ++++++++++++++++++++++++--------------
 sources                          |    2 +-
 5 files changed, 120 insertions(+), 58 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9e21164..90b9c7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 /FusionInventory-Agent-2.1.9.tar.gz
 /FusionInventory-Agent-2.1.12.tar.gz
 /FusionInventory-Agent-2.1.14.tar.gz
+/FusionInventory-Agent-2.2.0.tar.gz
diff --git a/fusioninventory-agent-arch.patch b/fusioninventory-agent-arch.patch
new file mode 100644
index 0000000..a882db6
--- /dev/null
+++ b/fusioninventory-agent-arch.patch
@@ -0,0 +1,12 @@
+diff -up FusionInventory-Agent-2.2.0/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/RPM.pm.orig FusionInventory-Agent-2.2.0/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/RPM.pm
+--- FusionInventory-Agent-2.2.0/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/RPM.pm.orig	2012-04-16 09:33:21.000000000 +0200
++++ FusionInventory-Agent-2.2.0/lib/FusionInventory/Agent/Task/Inventory/Input/Generic/Softwares/RPM.pm	2012-04-16 09:33:32.000000000 +0200
+@@ -17,7 +17,7 @@ sub doInventory {
+ 
+     my $command =
+         'rpm -qa --queryformat \'' .
+-        '%{NAME}\t' .
++        '%{NAME}.%{ARCH}\t' .
+         '%{VERSION}-%{RELEASE}\t' .
+         '%{INSTALLTIME:date}\t' .
+         '%{SIZE}\t' .
diff --git a/fusioninventory-agent.service b/fusioninventory-agent.service
new file mode 100644
index 0000000..76b60c7
--- /dev/null
+++ b/fusioninventory-agent.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=FusionInventory agent
+After=syslog.target network.target
+
+[Service]
+EnvironmentFile=/etc/sysconfig/fusioninventory-agent
+ExecStart=/usr/bin/fusioninventory-agent $FUSINVOPT --logfile=/var/log/fusioninventory-agent/service.log --daemon-no-fork
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/fusioninventory-agent.spec b/fusioninventory-agent.spec
index 3b5deec..f39f07d 100644
--- a/fusioninventory-agent.spec
+++ b/fusioninventory-agent.spec
@@ -1,5 +1,8 @@
-#global gitver 9bd1238
-#global prever _beta1
+%if 0%{?fedora} >= 18
+%global  with_systemd  1
+%else
+%global  with_systemd  0
+%endif
 
 Name:        fusioninventory-agent
 Summary:     FusionInventory agent
@@ -8,19 +11,18 @@ Group:       Applications/System
 License:     GPLv2+
 URL:         http://fusioninventory.org/
 
-Version:     2.1.14
-
-%if 0%{?gitver:1}
-Release:   0.2.git%{gitver}%{?dist}
-# From http://github.com/fusinv/fusioninventory-agent/tarball/master
-Source0:   fusinv-fusioninventory-agent-2.1.8-95-g9bd1238.tar.gz
-%else
-Release:   2%{?dist}
-Source0:   http://search.cpan.org/CPAN/authors/id/F/FU/FUSINV/FusionInventory-Agent-%{version}%{?prever}.tar.gz
-%endif
+Version:     2.2.0
+Release:     1%{?dist}
+Source0:     http://search.cpan.org/CPAN/authors/id/F/FU/FUSINV/FusionInventory-Agent-%{version}%{?prever}.tar.gz
 
 Source1:   %{name}.cron
 Source2:   %{name}.init
+Source3:   %{name}.service
+
+# See http://forge.fusioninventory.org/issues/1581
+# Upstream desagree on this patch, but it will avoid behavior change
+# until managed properly, as part of the XML file
+Patch0:    %{name}-arch.patch
 
 
 BuildArch: noarch
@@ -28,8 +30,10 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: perl(Module::Install)
 # For tests 
-BuildRequires: perl(Time::HiRes) perl(XML::Simple) perl(UNIVERSAL::require) perl(Test::More)
+BuildRequires: perl(Time::HiRes) perl(UNIVERSAL::require) perl(Test::More)
 BuildRequires: perl(Class::Accessor::Fast) perl(Class::Data::Inheritable) perl(Test::Exception)
+BuildRequires: perl(File::Which) perl(IPC::Run) perl(Test::MockModule) perl(Text::Template)
+BuildRequires: perl(IO::Capture::Stderr) perl(Net::IP) perl(YAML)
 %if 0%{?fedora} >= 14
 BuildRequires: perl(LWP::Protocol::https) perl(IO::Socket::SSL)
 BuildRequires: perl(HTTP::Server::Simple::Authen) perl(CGI)
@@ -41,19 +45,30 @@ BuildRequires: perl(XML::TreePP)
 BuildRequires: perl(JSON)
 %endif
 %if 0%{?fedora} >= 11
-BuildRequires: perl(Test::Compile)
+BuildRequires: perl(Test::Compile) perl(HTTP::Proxy)
+%endif
+%if %{with_systemd}
+BuildRequires: systemd-units
 %endif
 
 Requires:  perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
-Requires:  perl(LWP) perl(Net::IP) perl(HTTP::Status) perl(Net::SSLeay) perl(Crypt::SSLeay)
+Requires:  perl(LWP) perl(Net::IP) perl(HTTP::Status) perl(Net::SSLeay)
 Requires:  perl(Proc::Daemon) perl(Proc::PID::File)
 %if 0%{?fedora} >= 6 || 0%{?rhel} >= 5
-Requires:  perl(Archive::Extract)
 Requires:  perl(Net::CUPS)
 %endif
+%if %{with_systemd}
+# We require this to be present for /etc/tmpfiles.d
+Requires: systemd-units
+# Make sure it's there when scriptlets run, too
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%else
 Requires(post): /sbin/chkconfig
 Requires(preun): /sbin/chkconfig, /sbin/service
 Requires(postun): /sbin/service
+%endif
 
 
 # RPM 4.8
@@ -73,12 +88,12 @@ or GLPI server with the FusionInventory for GLPI plugin.
 
 You can add additional packages for optional tasks:
 
-* perl-FusionInventory-Agent-Task-OcsDeploy
-    OCS Inventory Software deployment support
 * perl-FusionInventory-Agent-Task-NetDiscovery
     Network Discovery support
-* perl-FusionInventory-Agent-Task-SNMPQuery
-    SNMP Query support
+* perl-FusionInventory-Agent-Task-NetInventory
+    Network Inventory support
+* perl-FusionInventory-Agent-Task-Deploy
+    Software deployment support
 * perl-FusionInventory-Agent-Task-ESX
     vCenter/ESX/ESXi remote inventory
 
@@ -94,12 +109,12 @@ OCS Inventory NG ou à un serveur GLPI disposant de l'extension FusionInventory.
 
 Vous pouvez ajouter les paquets additionnels pour les tâches optionnelles :
 
-* perl-FusionInventory-Agent-Task-OcsDeploy
-    Gestion du déploiement logiciel OCS Inventory
 * perl-FusionInventory-Agent-Task-NetDiscovery
     Gestion de la découverte réseau
-* perl-FusionInventory-Agent-Task-SNMPQuery
-    Gestion de l'interrogation SNMP
+* perl-FusionInventory-Agent-Task-NetInventory
+    Gestion de l'inventaire réseau
+* perl-FusionInventory-Agent-Task-Deploy
+    Gestion de déploiement de logiciels
 * perl-FusionInventory-Agent-Task-ESX
     Inventaire à distance des vCenter/ESX/ESXi
 
@@ -128,11 +143,9 @@ inventaire à la fin de l'exécution de yum.
 Le service doit être actif et lancé avec l'option --rpc-trust-localhost.
 
 %prep
-%if 0%{?gitver:1}
-%setup -q -n fusinv-fusioninventory-agent-%{gitver}
-%else
 %setup -q -n FusionInventory-Agent-%{version}%{?prever}
-%endif
+
+%patch0 -p1 -b .rpmarch
 
 # This work only on older version, and is ignored on recent
 cat <<EOF | tee %{name}-req
@@ -141,11 +154,7 @@ cat <<EOF | tee %{name}-req
 sed -e '/perl(Win32/d'
 EOF
 
-%if 0%{?gitver:1}
-%global __perl_requires %{_builddir}/fusinv-fusioninventory-agent-%{gitver}/%{name}-req
-%else
 %global __perl_requires %{_builddir}/FusionInventory-Agent-%{version}%{?prever}/%{name}-req
-%endif
 chmod +x %{__perl_requires}
 
 cat <<EOF | tee logrotate
@@ -168,12 +177,15 @@ cat <<EOF | tee %{name}.conf
 # Add tools directory if needed (tw_cli, hpacucli, ipssend, ...)
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 # Global options (debug for verbose log, rpc-trust-localhost for yum-plugin)
-FUSINVOPT='--debug --rpc-trust-localhost'
+FUSINVOPT="--debug --rpc-trust-localhost"
 # Mode, change to "cron" or "daemon" to activate
 # - none (default on install) no activity
 # - cron (inventory only) use the cron.hourly
+%if %{with_systemd}
+# NB systemd service launcher only use FUSINVOPT and agent.cfg
+%else
 # - daemon (recommanded) use the service
-#   DON'T FORGET to enable the service
+%endif
 OCSMODE[0]=none
 # OCS Inventory or FusionInventory server URI
 # OCSSERVER[0]=your.ocsserver.name
@@ -187,38 +199,35 @@ OCSPAUSE[0]=120
 OCSTAG[0]=
 EOF
 
-cat <<EOF | tee agent.cfg
-# This file provides global and command line settings
-# For CRON or DAEMON configuration, see %{_sysconfdir}/sysconfig/%{name}
-share-dir=%{perl_vendorlib}/auto/share/dist/FusionInventory-Agent
-basevardir=%{_localstatedir}/lib/%{name}
-logger=Stderr
-server=""
-EOF
-
 
 %build
-%{__perl} Makefile.PL INSTALLDIRS=vendor
+perl Makefile.PL \
+     PREFIX=%{_prefix} \
+     SYSCONFDIR=%{_sysconfdir}/fusioninventory \
+     LOCALSTATEDIR=%{_localstatedir}/lib/%{name}
+
 make %{?_smp_mflags}
 
 
 %install
 rm -rf %{buildroot}
 
-make pure_install DESTDIR=%{buildroot}
+make install DESTDIR=%{buildroot}
 find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
 find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';'
 
 %{_fixperms} %{buildroot}/*
 
-
 mkdir -p %{buildroot}%{_localstatedir}/{log,lib}/%{name}
 
-install -m 644 -D  logrotate    %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
-install -m 644 -D  %{name}.conf %{buildroot}%{_sysconfdir}/sysconfig/%{name}
-install -m 644 -D  agent.cfg    %{buildroot}%{_sysconfdir}/fusioninventory/agent.cfg
-install -m 755 -Dp %{SOURCE1}   %{buildroot}%{_sysconfdir}/cron.hourly/%{name}
-install -m 755 -Dp %{SOURCE2}   %{buildroot}%{_initrddir}/%{name}
+install -m 644 -D  logrotate     %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+install -m 644 -D  %{name}.conf  %{buildroot}%{_sysconfdir}/sysconfig/%{name}
+install -m 755 -Dp %{SOURCE1}    %{buildroot}%{_sysconfdir}/cron.hourly/%{name}
+%if %{with_systemd}
+install -m 644 -Dp %{SOURCE3}    %{buildroot}%{_unitdir}/%{name}.service
+%else
+install -m 755 -Dp %{SOURCE2}    %{buildroot}%{_initrddir}/%{name}
+%endif
 
 # Yum plugin installation
 install -m 644 -D contrib/yum-plugin/%{name}.py   %{buildroot}%{_prefix}/lib/yum-plugins/%{name}.py
@@ -234,38 +243,61 @@ rm -rf %{buildroot} %{buildroot}%{_datarootdir}
 
 
 %post
-/sbin/chkconfig --add %{name}
-
+%if %{with_systemd}
+/sbin/chkconfig --del %{name} &>/dev/null || :
+/bin/systemctl daemon-reload &>/dev/null || :
+%else
+if [ $1 = 1 ]; then
+    # Initial installation
+    /sbin/chkconfig --add %{name} || :
+fi
+%endif
+exit 0
 
 %preun
 if [ $1 -eq 0 ] ; then
+%if %{with_systemd}
+    /bin/systemctl --no-reload disable %{name}.service &>/dev/null
+    /bin/systemctl stop %{name}.service &>/dev/null
+%else
     /sbin/service %{name} stop &>/dev/null
     /sbin/chkconfig --del %{name}
+%endif
 fi
 exit 0
 
 
 %postun
+%if %{with_systemd}
+/bin/systemctl daemon-reload &>/dev/null
+if [ $1 -ge 1 ]; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart %{name}.service &>/dev/null
+fi
+%else
 if [ $1 -ge 1 ]; then
     /sbin/service %{name} condrestart &>/dev/null
 fi
+%endif
 exit 0
 
 
 %files
 %defattr(-, root, root, -)
-%doc AUTHORS Changes LICENSE THANKS
+%doc Changes LICENSE THANKS
 %dir %{_sysconfdir}/fusioninventory
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
 %config(noreplace) %{_sysconfdir}/fusioninventory/agent.cfg
 %{_sysconfdir}/cron.hourly/%{name}
+%if %{with_systemd}
+%{_unitdir}/%{name}.service
+%else
 %{_initrddir}/%{name}
-%{perl_vendorlib}/FusionInventory
-%{perl_vendorlib}/auto
+%endif
+%{_datadir}/fusioninventory
 %{_bindir}/fusioninventory-agent
 %{_bindir}/fusioninventory-injector
-%exclude %{_bindir}/%{name}-config
 %{_mandir}/man1/fusioninventory-agent*
 %{_mandir}/man1/fusioninventory-injector*
 %{_mandir}/man3/Fusion*
@@ -279,6 +311,12 @@ exit 0
 
 
 %changelog
+* Thu May 10 2012 Remi Collet <remi at fedoraproject.org> - 2.2.0-1
+- update to 2.2.0
+  http://search.cpan.org/src/FUSINV/FusionInventory-Agent-2.2.0/Changes
+- revert change in 2.2.0: don't loose arch information
+  see http://forge.fusioninventory.org/issues/1581
+
 * Sun Feb 26 2012 Remi Collet <remi at fedoraproject.org> - 2.1.14-1
 - update to 2.1.14
   http://cpansearch.perl.org/src/FUSINV/FusionInventory-Agent-2.1.14/Changes
diff --git a/sources b/sources
index f0c3c0f..4cf67d6 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-4f8b8f59e028f21e6d04aa469ce4c676  FusionInventory-Agent-2.1.14.tar.gz
+2fe514a3717653d98339cbd67ca94adf  FusionInventory-Agent-2.2.0.tar.gz


More information about the scm-commits mailing list