Vinzenz Feenstra has uploaded a new change for review.

Change subject: Updated spec file to follow packaging guide lines (BZ#772608)
......................................................................

Updated spec file to follow packaging guide lines (BZ#772608)

Changes to spec file:
- introduced ovirt-guest-agent-service noarch package which provides
  ovirt-guest-agent and avoids duplication of the same package content
- fixed various rpmlint errors and warnings
- added AUTHORS, COPYING, NEWS and README to all subpackages
- changed conflicts to be requires, which is more accurate
- removed unnecessary build requires
- removed unnecessary call to autoreconf in setup section
- marked config files as such
- excluded unwanted files instead of deleting them

Change-Id: Iec350b4027bffff8dff73db7986020fdc48261cd
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=772608
Signed-off-by: Vinzenz Feenstra <vfeen...@redhat.com>
---
M ovirt-guest-agent.spec
1 file changed, 90 insertions(+), 55 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent refs/changes/15/8715/1

diff --git a/ovirt-guest-agent.spec b/ovirt-guest-agent.spec
index dc09f1b..561ef7b 100644
--- a/ovirt-guest-agent.spec
+++ b/ovirt-guest-agent.spec
@@ -1,58 +1,76 @@
 
-%define release_version 1
+%global release_version 2
 
-%define _moduledir /%{_lib}/security
-%define _kdmrc /etc/kde/kdm/kdmrc
+%global _moduledir /%{_lib}/security
+%global _kdmrc /etc/kde/kdm/kdmrc
 
 Name: ovirt-guest-agent
 Version: 1.0.5
 Release: %{release_version}%{?dist}
-Summary: oVirt Guest Agent
+Summary: The oVirt Guest Agent
 Group: Applications/System
 License: GPLv2+
 URL: http://gerrit.ovirt.org/p/ovirt-guest-agent.git
-Source0: http://ghammer.fedorapeople.org/ovirt-guest-agent-%{version}.tar.bz2
-ExclusiveArch: i686 x86_64
-BuildRequires: python
-BuildRequires: automake
+Source0: http://ghammer.fedorapeople.org/%{name}-%{version}.tar.bz2
 BuildRequires: libtool
 BuildRequires: pam-devel
+BuildRequires: python2-devel
+%if 0%{?fedora} >= 18
+BuildRequires: systemd
+%else
+BuildRequires: systemd-units
+%endif
+
+%package service
+Summary: The oVirt Guest Agent
+BuildArch: noarch
 Requires: dbus-python
 Requires: rpm-python
 Requires: python-ethtool >= 0.4-1
 Requires: udev >= 095-14.23
 Requires: kernel > 2.6.18-238.5.0
 Requires: usermode
+Provides: %{name} = %{version}-%{release}
 %if 0%{?fc16}
-Conflicts: selinux-policy < 3.10.0-77
+Requires: selinux-policy >= 3.10.0-77
 %endif
 %if 0%{?fedora} >= 17
-Conflicts: selinux-policy < 3.10.0-89
+Requires: selinux-policy >= 3.10.0-89
 %endif
 
 %package pam-module
-Summary: oVirt Guest Agent PAM module
-Requires: %{name}
+Summary: PAM module for the oVirt Guest Agent
+ExclusiveArch: i686 x86_64
+Requires: %{name} = %{version}-%{release}
 Requires: pam
 
 %package gdm-plugin
-Summary: GDM oVirt plug-in
+Summary: GDM plug-in for the oVirt Guest Agent
+ExclusiveArch: i686 x86_64
 BuildRequires: dbus-glib-devel
 BuildRequires: gdm-devel
 BuildRequires: gobject-introspection-devel
 BuildRequires: gtk2-devel
-Requires: %{name}
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-pam-module = %{version}-%{release}
 Requires: gdm
-Requires: %{name}-pam-module
 
 %package kdm-plugin
-Summary: KDM oVirt plug-in
+Summary: KDM plug-in for the oVirt Guest Agent
+ExclusiveArch: i686 x86_64
 BuildRequires: kdebase-workspace-devel
-Requires: %{name}
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-pam-module = %{version}-%{release}
 Requires: kdm
-Requires: %{name}-pam-module
 
 %description
+This is the oVirt management agent running inside the guest. The agent
+interfaces with the oVirt manager, supplying heart-beat info as well as
+run-time data from within the guest itself. The agent also accepts
+control commands to be run executed within the OS (like: shutdown and
+restart).
+
+%description service
 This is the oVirt management agent running inside the guest. The agent
 interfaces with the oVirt manager, supplying heart-beat info as well as
 run-time data from within the guest itself. The agent also accepts
@@ -73,7 +91,6 @@
 
 %prep
 %setup -q -n ovirt-guest-agent-%{version}
-autoreconf -i -f
 
 %build
 %configure \
@@ -84,39 +101,31 @@
 make %{?_smp_mflags}
 
 %install
-[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
-
-make install DESTDIR=$RPM_BUILD_ROOT
+make install DESTDIR=%{buildroot}
 
 # Install systemd script.
-install -Dm 0644 ovirt-guest-agent/ovirt-guest-agent.service 
$RPM_BUILD_ROOT%{_unitdir}/ovirt-guest-agent.service
-
-# Create symbolic links to commands that requires root privileges.
-ln -sf /usr/bin/consolehelper 
$RPM_BUILD_ROOT%{_datadir}/ovirt-guest-agent/ovirt-locksession
-ln -sf /usr/bin/consolehelper 
$RPM_BUILD_ROOT%{_datadir}/ovirt-guest-agent/ovirt-shutdown
-ln -sf /usr/bin/consolehelper 
$RPM_BUILD_ROOT%{_datadir}/ovirt-guest-agent/ovirt-hibernate
+install -Dm 0644 ovirt-guest-agent/ovirt-guest-agent.service 
%{buildroot}%{_unitdir}/ovirt-guest-agent.service
 
 # Update timestamps on Python files in order to avoid differences between
 # .pyc/.pyo files.
-touch -r %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/ovirt-guest-agent/*.py
+touch -r %{SOURCE0} %{buildroot}%{_datadir}/ovirt-guest-agent/*.py
 
-rm -f $RPM_BUILD_ROOT%{_libdir}/gdm/simple-greeter/extensions/libovirtcred.a
-rm -f $RPM_BUILD_ROOT%{_libdir}/gdm/simple-greeter/extensions/libovirtcred.la
+# Create needed folders
+mkdir -p %{buildroot}%{_localstatedir}/log/ovirt-guest-agent
+mkdir -p %{buildroot}%{_localstatedir}/lock/subsys/ovirt-guest-agent
 
-rm -f $RPM_BUILD_ROOT%{_moduledir}/pam_ovirt_cred.a
-rm -f $RPM_BUILD_ROOT%{_moduledir}/pam_ovirt_cred.la
+ln -sf /usr/bin/consolehelper 
%{buildroot}%{_datadir}/ovirt-guest-agent/ovirt-locksession
+ln -sf /usr/bin/consolehelper 
%{buildroot}%{_datadir}/ovirt-guest-agent/ovirt-shutdown
+ln -sf /usr/bin/consolehelper 
%{buildroot}%{_datadir}/ovirt-guest-agent/ovirt-hibernate
 
-mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/ovirt-guest-agent
-mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/ovirt-guest-agent
-
-%pre
+%pre service
 getent group ovirtagent >/dev/null || groupadd -r -g 175 ovirtagent
 getent passwd ovirtagent > /dev/null || \
     /usr/sbin/useradd -u 175 -g 175 -o -r ovirtagent \
     -c "oVirt Guest Agent" -d / -s /sbin/nologin
 exit 0
  
-%post
+%post service
 /sbin/udevadm trigger --subsystem-match="virtio-ports" \
     --attr-match="name=com.redhat.rhevm.vdsm"
 
@@ -128,7 +137,7 @@
     sed -i "s~^#PluginsLogin=winbind~PluginsLogin=ovirtcred,classic~" 
"%{_kdmrc}"
 fi
 
-%preun
+%preun service
 if [ "$1" -eq 0 ]
 then
     /bin/systemctl stop ovirt-guest-agent.service > /dev/null 2>&1
@@ -141,7 +150,7 @@
     fi
 fi
 
-%postun
+%postun service
 if [ "$1" -eq 0 ]
 then
     /bin/systemctl daemon-reload
@@ -157,20 +166,26 @@
     sed -i "s~PluginsLogin=ovirtcred,classic~#PluginsLogin=winbind~" 
"%{_kdmrc}"
 fi
 
-%files
-%defattr(-,root,root,-)
+%files service
 %dir %attr (755,ovirtagent,ovirtagent) %{_localstatedir}/log/ovirt-guest-agent
 %dir %attr (755,root,root) %{_datadir}/ovirt-guest-agent
+
 %config(noreplace) %{_sysconfdir}/ovirt-guest-agent.conf
-%{_sysconfdir}/dbus-1/system.d/org.ovirt.vdsm.Credentials.conf
-%{_sysconfdir}/security/console.apps/ovirt-locksession
-%{_sysconfdir}/security/console.apps/ovirt-shutdown
-%{_sysconfdir}/security/console.apps/ovirt-hibernate
-%{_sysconfdir}/pam.d/ovirt-locksession
-%{_sysconfdir}/pam.d/ovirt-shutdown
-%{_sysconfdir}/pam.d/ovirt-hibernate
-%attr (644,root,root) %{_sysconfdir}/udev/rules.d/55-ovirt-guest-agent.rules
+
+%config(noreplace) 
%{_sysconfdir}/dbus-1/system.d/org.ovirt.vdsm.Credentials.conf
+%config(noreplace) %{_sysconfdir}/security/console.apps/ovirt-locksession
+%config(noreplace) %{_sysconfdir}/security/console.apps/ovirt-shutdown
+%config(noreplace) %{_sysconfdir}/security/console.apps/ovirt-hibernate
+%config(noreplace) %{_sysconfdir}/pam.d/ovirt-locksession
+%config(noreplace) %{_sysconfdir}/pam.d/ovirt-shutdown
+%config(noreplace) %{_sysconfdir}/pam.d/ovirt-hibernate
+
+#This is intentionally NOT 'noreplace' it's a required udev rule. If this is
+#modified by an user this actually might break it.
+%config %attr (644,root,root) 
%{_sysconfdir}/udev/rules.d/55-ovirt-guest-agent.rules
+
 %attr (755,root,root) %{_datadir}/ovirt-guest-agent/ovirt-guest-agent.py*
+
 %{_datadir}/ovirt-guest-agent/OVirtAgentLogic.py*
 %{_datadir}/ovirt-guest-agent/VirtIoChannel.py*
 %{_datadir}/ovirt-guest-agent/CredServer.py*
@@ -178,30 +193,50 @@
 %{_datadir}/ovirt-guest-agent/ovirt-locksession
 %{_datadir}/ovirt-guest-agent/ovirt-shutdown
 %{_datadir}/ovirt-guest-agent/ovirt-hibernate
+
 %attr (755,root,root) %{_datadir}/ovirt-guest-agent/LockActiveSession.py*
 %attr (755,root,root) %{_datadir}/ovirt-guest-agent/hibernate
+
 %{_unitdir}/ovirt-guest-agent.service
+
+# Unwanted files
+%exclude %{_libdir}/gdm/simple-greeter/extensions/libovirtcred.a
+%exclude %{_libdir}/gdm/simple-greeter/extensions/libovirtcred.la
+
+%exclude %{_moduledir}/pam_ovirt_cred.a
+%exclude %{_moduledir}/pam_ovirt_cred.la
 
 %doc AUTHORS COPYING NEWS README
 
 %files pam-module
-%defattr(-,root,root,-)
 %{_moduledir}/pam_ovirt_cred.so
+%doc AUTHORS COPYING NEWS README
 
 %files gdm-plugin
-%defattr(-,root,root,-)
-%{_sysconfdir}/pam.d/gdm-ovirtcred
+%config(noreplace) %{_sysconfdir}/pam.d/gdm-ovirtcred
 %{_datadir}/icons/hicolor/*/*/*.png
 %dir %{_datadir}/gdm/simple-greeter/extensions/ovirtcred
 %{_datadir}/gdm/simple-greeter/extensions/ovirtcred/page.ui
 %{_libdir}/gdm/simple-greeter/extensions/libovirtcred.so
+%doc AUTHORS COPYING NEWS README
 
 %files kdm-plugin
-%defattr(-,root,root,-)
-%{_sysconfdir}/pam.d/kdm-ovirtcred
+%config(noreplace) %{_sysconfdir}/pam.d/kdm-ovirtcred
 %attr (755,root,root) %{_libdir}/kde4/kgreet_ovirtcred.so
+%doc AUTHORS COPYING NEWS README
 
 %changelog
+* Fri Oct 19 2012 Vinzenz Feenstra <vfeen...@redhat.com> - 1.0.5-2
+- introduced ovirt-guest-agent-service noarch package which provides 
+  ovirt-guest-agent and avoids duplication of the same package content
+- fixed various rpmlint errors and warnings
+- added AUTHORS, COPYING, NEWS and README to all subpackages
+- changed conflicts to be requires, which is more accurate
+- removed unnecessary build requires
+- removed unnecessary call to autoreconf in setup section
+- marked config files as such
+- excluded unwanted files instead of deleting them
+
 * Sun May 20 2012 Gal Hammer <gham...@redhat.com> - 1.0.5-1
 - fixed 'udevadm trigger' command line (bz#819945).
 - fixed various rpmlint errors and warnings.


--
To view, visit http://gerrit.ovirt.org/8715
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec350b4027bffff8dff73db7986020fdc48261cd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-guest-agent
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeen...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to