From 126ad3eb0c041b03908cad78d2840d07602b84d1 Mon Sep 17 00:00:00 2001 From: Radek Novacek Date: Mon, 5 May 2014 10:02:07 +0200 Subject: spec: modularize spec file Add support for easier enabling/disabling providers on different versions of hosting operating system. Also add support for RHEL-6. --- openlmi-providers.spec | 173 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 154 insertions(+), 19 deletions(-) (limited to 'openlmi-providers.spec') diff --git a/openlmi-providers.spec b/openlmi-providers.spec index b7187d6..c76a9ad 100644 --- a/openlmi-providers.spec +++ b/openlmi-providers.spec @@ -1,7 +1,36 @@ +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + %global logfile %{_localstatedir}/log/openlmi-install.log %global required_konkret_ver 0.9.0-2 %global required_libuser_ver 0.60 +%global with_devassistant 1 +%global with_journald 1 +%global with_service 1 +%global with_service_legacy 0 +%global with_account 1 +%global with_pcp 1 +%global with_realmd 1 +%global with_fan 1 + +%if 0%{?rhel} == 6 +%global with_journald 0 +%global with_service 0 +%global with_service_legacy 1 +%global with_account 0 +%global with_pcp 0 +%global with_realmd 0 +%global with_fan 0 +%endif + +%if 0%{?rhel} +%global with_devassistant 0 +%endif + Name: openlmi-providers Version: 0.4.2 Release: 7%{?dist} @@ -46,7 +75,6 @@ Obsoletes: cura-providers < 0.0.10-1 %global nw_min_version 0.2.2 %global nw_max_version 0.3 - BuildRequires: cmake BuildRequires: konkretcmpi-devel >= %{required_konkret_ver} BuildRequires: sblim-cmpi-devel @@ -57,14 +85,19 @@ BuildRequires: libselinux-devel BuildRequires: libudev-devel BuildRequires: pkg-config %endif -# For openlmi-fan + +%if 0%{?with_fan} %if 0%{?suse_version} BuildRequires: libsensors4-devel %else BuildRequires: lm_sensors-devel %endif -# For openlmi-account +%endif + +%if 0%{?with_account} BuildRequires: libuser-devel >= %{required_libuser_ver} +%endif + %if 0%{?suse_version} BuildRequires: python %else @@ -77,13 +110,13 @@ BuildRequires: python-Sphinx %else BuildRequires: python-sphinx %endif + # For openlmi-hardware BuildRequires: pciutils-devel # For openlmi-logicalfile BuildRequires: libudev-devel BuildRequires: libselinux-devel -# For openlmi-realmd -BuildRequires: dbus-devel + # For openlmi-mof-register script %if 0%{?suse_version} BuildRequires: python @@ -91,7 +124,9 @@ BuildRequires: python Requires: python2 %endif # for openlmi-journald +%if 0%{?with_journald} BuildRequires: systemd-devel +%endif # for openlmi-realmd: %if 0%{?suse_version} >= 1110 BuildRequires: dbus-1-devel @@ -135,6 +170,7 @@ Obsoletes: cura-providers-devel < 0.0.10-1 %description devel %{summary}. +%if 0%{?with_fan} %package -n openlmi-fan Summary: CIM provider for controlling fans Requires: %{name}%{?_isa} = %{providers_version_release} @@ -151,6 +187,7 @@ BuildArch: noarch %description -n openlmi-fan-doc This package contains the documents for OpenLMI fan provider. +%endif %package -n openlmi-powermanagement Summary: Power management CIM provider @@ -174,6 +211,7 @@ BuildArch: noarch %description -n openlmi-powermanagement-doc This package contains the documents for OpenLMI power management provider. +%if 0%{?with_service} || 0%{?with_service_legacy} %package -n openlmi-service Summary: CIM provider for controlling system services Requires: %{name}%{?_isa} = %{providers_version_release} @@ -190,7 +228,9 @@ BuildArch: noarch %description -n openlmi-service-doc This package contains the documents for OpenLMI service provider. +%endif +%if 0%{?with_account} %package -n openlmi-account Summary: CIM provider for managing accounts on system Requires: %{name}%{?_isa} = %{providers_version_release} @@ -213,6 +253,7 @@ BuildArch: noarch %description -n openlmi-account-doc This package contains the documents for OpenLMI account provider. +%endif %package -n openlmi-hardware Summary: CIM provider for hardware on system @@ -328,6 +369,7 @@ BuildArch: noarch %description -n openlmi-logicalfile-doc This package contains the documents for OpenLMI logicalfile provider. +%if 0%{?with_realmd} %package -n openlmi-realmd Summary: CIM provider for Realmd Requires: %{name}%{?_isa} = %{providers_version_release} @@ -349,6 +391,7 @@ BuildArch: noarch %description -n openlmi-realmd-doc This package contains the documents for OpenLMI Realmd provider. +%endif %package -n openlmi-indicationmanager-libs Summary: Libraries for CMPI indication manager @@ -365,6 +408,7 @@ Requires: openlmi-indicationmanager-libs%{_isa} = %{providers_version_rele %description -n openlmi-indicationmanager-libs-devel %{summary}. +%if 0%{?with_pcp} %package -n openlmi-pcp Summary: pywbem providers for accessing PCP metrics Requires: %{name} = %{providers_version_release} @@ -382,6 +426,7 @@ to the CIMOM. They appear as potentially hundreds of MOF classes, e.g. class "PCP_Metric_kernel__pernode__cpu__use", with instances for each PCP metric instance, e.g. "node0". PCP metric values and metadata are transcribed into strings on demand. +%endif %package -n openlmi Summary: OpenLMI managed system software components @@ -429,6 +474,7 @@ BuildArch: noarch python-sphinx-theme-openlmi contains Sphinx theme for OpenLMI provider documentation. +%if 0%{?with_journald} %package -n openlmi-journald Summary: CIM provider for Journald Requires: %{name}%{?_isa} = %{providers_version_release} @@ -445,8 +491,9 @@ BuildArch: noarch %description -n openlmi-journald-doc This package contains the documents for OpenLMI Journald provider. +%endif -%if ! 0%{?rhel} +%if 0%{?with_devassistant} %package -n openlmi-devassistant Summary: OpenLMI provider templates for Developer Assistant BuildArch: noarch @@ -463,24 +510,43 @@ This package contains template files for Developer Assistant. %build %if 0%{?suse_version} # SUSE %%cmake creates build/ subdir -%define target_builddir %{_target_platform}/build +%global target_builddir %{_target_platform}/build +%global source_dir ../.. %else -%define target_builddir %{_target_platform} +%global target_builddir %{_target_platform} +%global source_dir .. %endif mkdir -p %{_target_platform} pushd %{_target_platform} -%if ! 0%{?rhel} -%define _cmake_da -DWITH-DEVASSISTANT=ON -%else -%define _cmake_da -DWITH-DEVASSISTANT=OFF -%endif -%if 0%{?suse_version} -%{cmake} ../.. %{_cmake_da} -%else -%{cmake} .. %{_cmake_da} +%{cmake} \ +%if ! 0%{with_devassistant} + -DWITH-DEVASSISTANT=OFF \ +%endif +%if ! 0%{with_journald} + -DWITH-JOURNALD=OFF \ +%endif +%if ! 0%{with_service} + -DWITH-SERVICE=OFF \ +%endif +%if 0%{with_service_legacy} + -DWITH-SERVICE-LEGACY=ON \ +%endif +%if ! 0%{with_account} + -DWITH-ACCOUNT=OFF \ +%endif +%if ! 0%{with_pcp} + -DWITH-PCP=OFF \ +%endif +%if ! 0%{with_realmd} + -DWITH-REALMD=OFF \ +%endif +%if ! 0%{with_fan} + -DWITH-FAN=OFF \ %endif + %{source_dir} + popd make -k %{?_smp_mflags} -C %{target_builddir} all doc @@ -492,9 +558,12 @@ popd # src/python pushd src/software %{__python} setup.py build popd # src/software + +%if 0%{with_pcp} pushd src/pcp %{__python} setup.py build popd +%endif %install make install/fast DESTDIR=$RPM_BUILD_ROOT -C %{target_builddir} @@ -528,6 +597,7 @@ popd # src/software cp mof/LMI_Software.reg $RPM_BUILD_ROOT/%{_datadir}/%{name}/ # pcp +%if 0%{with_pcp} pushd src/pcp %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd @@ -544,16 +614,37 @@ mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name} touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/%{name}/stamp +%endif # documentation install -m 755 -d $RPM_BUILD_ROOT/%{_docdir}/%{name} install -m 644 README COPYING $RPM_BUILD_ROOT/%{_docdir}/%{name} -for provider in account fan hardware journald logicalfile power realmd software; do +for provider in \ +%if 0%{?with_account} + account \ +%endif +%if 0%{?with_fan} + fan \ +%endif + hardware \ +%if 0%{?with_journald} + journald \ +%endif + logicalfile power \ +%if 0%{?with_realmd} + realmd \ +%endif + software; do + install -m 755 -d $RPM_BUILD_ROOT/%{_docdir}/%{name}/${provider}/admin_guide cp -pr %{target_builddir}/doc/admin/${provider}/html/* $RPM_BUILD_ROOT/%{_docdir}/%{name}/${provider}/admin_guide done + +%if 0%{?with_service} install -m 755 -d $RPM_BUILD_ROOT/%{_docdir}/%{name}/service/admin_guide cp -pr %{target_builddir}/doc/admin/service-dbus/html/* $RPM_BUILD_ROOT/%{_docdir}/%{name}/service/admin_guide +%endif +# TODO: service_legacy # sphinx theme install -m 755 -d $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/openlmitheme @@ -591,6 +682,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %{_datadir}/cmake/Modules/FindKonkretCMPI.cmake %{_datadir}/cmake/Modules/FindOpenLMIIndManager.cmake +%if 0%{with_fan} %files -n openlmi-fan %doc README COPYING %{_libdir}/cmpi/libcmpiLMI_Fan.so @@ -601,6 +693,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %files -n openlmi-fan-doc %{_docdir}/%{name}/fan/ +%endif %files -n openlmi-powermanagement %doc README COPYING @@ -618,12 +711,19 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %{_libdir}/cmpi/libcmpiLMI_Service.so %{_datadir}/%{name}/60_LMI_Service.mof %{_datadir}/%{name}/60_LMI_Service.reg +%if 0%{?with_service_legacy} +%{_libexecdir}/servicedisc.sh +%{_libexecdir}/serviceutil.sh +%endif %{_datadir}/%{name}/90_LMI_Service_Profile.mof %attr(755, root, root) %{_libexecdir}/pegasus/cmpiLMI_Service-cimprovagt %files -n openlmi-service-doc +%if 0%{?with_service} %{_docdir}/%{name}/service/ +%endif +%if 0%{with_account} %files -n openlmi-account %doc README COPYING %{_libdir}/cmpi/libcmpiLMI_Account.so @@ -634,6 +734,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %files -n openlmi-account-doc %{_docdir}/%{name}/account/ +%endif %files -n openlmi-hardware %doc README COPYING @@ -683,6 +784,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %files -n openlmi-software-doc %{_docdir}/%{name}/software/ +%if 0%{with_pcp} %files -n openlmi-pcp %doc README COPYING %{_datadir}/%{name}/60_LMI_PCP.mof @@ -694,6 +796,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %ghost %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.mof %ghost %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg %ghost %{_localstatedir}/lib/%{name}/stamp +%endif %files -n openlmi-logicalfile %doc README COPYING @@ -706,6 +809,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %files -n openlmi-logicalfile-doc %{_docdir}/%{name}/logicalfile/ +%if 0%{with_realmd} %files -n openlmi-realmd %doc README COPYING %{_libdir}/cmpi/libcmpiLMI_Realmd.so @@ -716,6 +820,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %files -n openlmi-realmd-doc %{_docdir}/%{name}/realmd/ +%endif %files -n openlmi-indicationmanager-libs %doc COPYING src/libs/indmanager/README @@ -734,6 +839,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %doc COPYING README %{python_sitelib}/sphinx/themes/openlmitheme/ +%if 0%{with_journald} %files -n openlmi-journald %doc README COPYING %{_libdir}/cmpi/libcmpiLMI_Journald.so @@ -744,8 +850,9 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open %files -n openlmi-journald-doc %{_docdir}/%{name}/journald/ +%endif -%if ! 0%{?rhel} +%if 0%{with_devassistant} %files -n openlmi-devassistant %dir %{_datadir}/devassistant/files/crt/python/openlmi/ %dir %{_datadir}/devassistant/files/crt/c/openlmi/ @@ -781,6 +888,7 @@ fi >> %logfile 2>&1 %post -n openlmi-indicationmanager-libs -p /sbin/ldconfig %postun -n openlmi-indicationmanager-libs -p /sbin/ldconfig +%if 0%{with_fan} %pre -n openlmi-fan # If upgrading, deregister old version if [ "$1" -gt 1 ]; then @@ -790,6 +898,7 @@ if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Fan_Profile.mof || :; fi >> %logfile 2>&1 +%endif %pre -n openlmi-powermanagement if [ "$1" -gt 1 ]; then @@ -809,6 +918,7 @@ if [ "$1" -gt 1 ]; then %{_datadir}/%{name}/90_LMI_Service_Profile.mof || :; fi >> %logfile 2>&1 +%if 0%{with_account} %pre -n openlmi-account if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ @@ -817,6 +927,7 @@ if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Account_Profile.mof || :; fi >> %logfile 2>&1 +%endif %pre -n openlmi-software if [ "$1" -gt 1 ]; then @@ -841,6 +952,7 @@ if [ "$1" -gt 1 ]; then %{_datadir}/%{name}/90_LMI_LogicalFile_Profile.mof || :; fi >> %logfile 2>&1 +%if 0%{with_realmd} %pre -n openlmi-realmd if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ @@ -849,6 +961,7 @@ if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Realmd_Profile.mof || :; fi >> %logfile 2>&1 +%endif %pre -n openlmi-hardware if [ "$1" -gt 1 ]; then @@ -860,6 +973,7 @@ if [ "$1" -gt 1 ]; then %{_datadir}/%{name}/90_LMI_Hardware_Profile_DMTF.mof || :; fi >> %logfile 2>&1 +%if 0%{with_pcp} %pre -n openlmi-pcp if [ "$1" -gt 1 ]; then # Only unregister when the provider was already registered @@ -870,7 +984,9 @@ if [ "$1" -gt 1 ]; then %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; fi fi >> %logfile 2>&1 +%endif +%if 0%{with_journald} %pre -n openlmi-journald if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ @@ -879,7 +995,9 @@ if [ "$1" -gt 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Journald_Profile.mof || :; fi >> %logfile 2>&1 +%endif +%if 0%{with_fan} %post -n openlmi-fan # Register Schema and Provider if [ "$1" -ge 1 ]; then @@ -889,6 +1007,7 @@ if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus register \ %{_datadir}/%{name}/90_LMI_Fan_Profile.mof || :; fi >> %logfile 2>&1 +%endif %post -n openlmi-powermanagement if [ "$1" -ge 1 ]; then @@ -908,6 +1027,7 @@ if [ "$1" -ge 1 ]; then %{_datadir}/%{name}/90_LMI_Service_Profile.mof || :; fi >> %logfile 2>&1 +%if 0%{with_account} %post -n openlmi-account if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} register \ @@ -916,6 +1036,7 @@ if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus register \ %{_datadir}/%{name}/90_LMI_Account_Profile.mof || :; fi >> %logfile 2>&1 +%endif %post -n openlmi-software if [ "$1" -ge 1 ]; then @@ -940,6 +1061,7 @@ if [ "$1" -ge 1 ]; then %{_datadir}/%{name}/90_LMI_LogicalFile_Profile.mof || :; fi >> %logfile 2>&1 +%if 0%{with_realmd} %post -n openlmi-realmd if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} register \ @@ -948,6 +1070,7 @@ if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus register \ %{_datadir}/%{name}/90_LMI_Realmd_Profile.mof || :; fi >> %logfile 2>&1 +%endif %post -n openlmi-hardware if [ "$1" -ge 1 ]; then @@ -959,6 +1082,7 @@ if [ "$1" -ge 1 ]; then %{_datadir}/%{name}/90_LMI_Hardware_Profile_DMTF.mof || :; fi >> %logfile 2>&1 +%if 0%{with_journald} %post -n openlmi-journald if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} register \ @@ -967,7 +1091,9 @@ if [ "$1" -ge 1 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus register \ %{_datadir}/%{name}/90_LMI_Journald_Profile.mof || :; fi >> %logfile 2>&1 +%endif +%if 0%{with_fan} %preun -n openlmi-fan # Deregister only if not upgrading if [ "$1" -eq 0 ]; then @@ -977,6 +1103,7 @@ if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Fan_Profile.mof || :; fi >> %logfile 2>&1 +%endif %preun -n openlmi-powermanagement if [ "$1" -eq 0 ]; then @@ -996,6 +1123,7 @@ if [ "$1" -eq 0 ]; then %{_datadir}/%{name}/90_LMI_Service_Profile.mof || :; fi >> %logfile 2>&1 +%if 0%{with_account} %preun -n openlmi-account if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ @@ -1004,6 +1132,7 @@ if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Account_Profile.mof || :; fi >> %logfile 2>&1 +%endif %preun -n openlmi-software if [ "$1" -eq 0 ]; then @@ -1028,6 +1157,7 @@ if [ "$1" -eq 0 ]; then %{_datadir}/%{name}/90_LMI_LogicalFile_Profile.mof || :; fi >> %logfile 2>&1 +%if 0%{with_realmd} %preun -n openlmi-realmd if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ @@ -1036,6 +1166,7 @@ if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Realmd_Profile.mof || :; fi >> %logfile 2>&1 +%endif %preun -n openlmi-hardware if [ "$1" -eq 0 ]; then @@ -1047,6 +1178,7 @@ if [ "$1" -eq 0 ]; then %{_datadir}/%{name}/90_LMI_Hardware_Profile_DMTF.mof || :; fi >> %logfile 2>&1 +%if 0%{with_pcp} %preun -n openlmi-pcp if [ "$1" -eq 0 ]; then # Only unregister when the provider was already registered @@ -1057,7 +1189,9 @@ if [ "$1" -eq 0 ]; then %{_localstatedir}/lib/%{name}/60_LMI_PCP_PMNS.reg || :; fi fi >> %logfile 2>&1 +%endif +%if 0%{with_journald} %preun -n openlmi-journald if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register -v %{providers_version} unregister \ @@ -1066,6 +1200,7 @@ if [ "$1" -eq 0 ]; then %{_bindir}/openlmi-mof-register --just-mofs -n root/interop -c tog-pegasus unregister \ %{_datadir}/%{name}/90_LMI_Journald_Profile.mof || :; fi >> %logfile 2>&1 +%endif %changelog * Tue May 6 2014 Jan Synáček - 0.4.2-7 -- cgit