File rhn-virtualization.spec of Package rhn-virtualization.4854
#
# spec file for package rhn-virtualization
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# package renaming fun :(
%define rhn_client_tools spacewalk-client-tools
%define rhn_setup spacewalk-client-setup
%define rhn_check spacewalk-check
%define rhnsd spacewalksd
#
%define rhn_dir %{_datadir}/rhn
%define rhn_conf_dir %{_sysconfdir}/sysconfig/rhn
%define cron_dir %{_sysconfdir}/cron.d
Name: rhn-virtualization
Summary: Spacewalk action support for virualization
License: GPL-2.0
Group: System Environment/Base
Url: https://github.com/spacewalkproject/spacewalk
Source0: rhn-virtualization-git-0.2d88fb3.tar.gz
Source1: %{name}-rpmlintrc
Version: 5.4.57.1
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: python
%if 0%{?suse_version}
# make chkconfig work in OBS
BuildRequires: sysconfig
BuildRequires: syslog
%endif
%description
rhn-virtualization provides various Spacewalk actions for manipulation
virtual machine guest images.
%package common
Summary: Files needed by rhn-virtualization-host
Group: System Environment/Base
%if 0%{?fedora} >= 23
Requires: python3-spacewalk-usix
%else
Requires: spacewalk-usix
%endif
Requires: %{rhn_client_tools}
%if 0%{?suse_version}
# aaa_base provide chkconfig
Requires: aaa_base
# provide directories for filelist check in obs
BuildRequires: rhn-check
BuildRequires: rhn-client-tools
%else
Requires: chkconfig
%endif
%description common
This package contains files that are needed by the rhn-virtualization-host
package.
%package host
Summary: Spacewalk Virtualization support specific to the Host system
Group: System Environment/Base
Requires: libvirt-python
Requires: rhn-virtualization-common = %{version}-%{release}
%if 0%{?suse_version}
Requires: cron
Requires: python-curl
PreReq: %fillup_prereq %insserv_prereq
%else
Requires: /usr/sbin/crond
Requires: python-pycurl
%endif
%if 0%{?rhel} && 0%{?rhel} < 6
# in RHEL5 we need libvirt, but in RHEV@RHEL5 there should not be libvirt
# as there is vdsm and bunch of other packages, but we have no clue how to
# distinguish those two scenarios
%else
Requires: libvirt
%endif
%description host
This package contains code for Spacewalk's Virtualization support
that is specific to the Host system (a.k.a. Dom0).
%prep
%setup -q -n rhn-virtualization-git-0.2d88fb3
%if 0%{?suse_version}
cp scripts/rhn-virtualization-host.SUSE scripts/rhn-virtualization-host
%endif
%build
make -f Makefile.rhn-virtualization
%install
rm -rf $RPM_BUILD_ROOT
make -f Makefile.rhn-virtualization DESTDIR=$RPM_BUILD_ROOT PKGDIR0=%{_initrddir} install
%if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} > 5)
find $RPM_BUILD_ROOT -name "localvdsm*" -exec rm -f '{}' ';'
%endif
# add rclink
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
ln -sf ../../etc/init.d/rhn-virtualization-host $RPM_BUILD_ROOT/%{_sbindir}/rcrhn-virtualization-host
%clean
rm -rf $RPM_BUILD_ROOT
%if 0%{?suse_version}
%post host
%{fillup_only -n rhn-virtualization-host}
if [ -d /proc/xen ]; then
# xen kernel is running
# change the default template to the xen version
sed -i 's@^IMAGE_CFG_TEMPLATE=/etc/sysconfig/rhn/studio-kvm-template.xml@IMAGE_CFG_TEMPLATE=/etc/sysconfig/rhn/studio-xen-template.xml@' /etc/sysconfig/rhn/image.cfg
fi
%preun host
%{stop_on_removal rhn-virtualization-host}
%postun host
%{insserv_cleanup}
%else
%post host
/sbin/chkconfig --add rhn-virtualization-host
%if 0%{?suse_version}
/sbin/service cron try-restart ||:
%else
/sbin/service crond condrestart
%endif
if [ -d /proc/xen ]; then
# xen kernel is running
# change the default template to the xen version
sed -i 's@^IMAGE_CFG_TEMPLATE=/etc/sysconfig/rhn/studio-kvm-template.xml@IMAGE_CFG_TEMPLATE=/etc/sysconfig/rhn/studio-xen-template.xml@' /etc/sysconfig/rhn/image.cfg
fi
%preun host
if [ $1 = 0 ]; then
/sbin/chkconfig --del rhn-virtualization-host
fi
%postun host
%if 0%{?suse_version}
/sbin/service cron try-restart ||:
%else
/sbin/service crond condrestart
%endif
%endif
%files common
%defattr(-,root,root,-)
%dir %{rhn_dir}/
%dir %{rhn_dir}/actions
%dir %{rhn_dir}/virtualization
%if 0%{?suse_version}
%dir %{rhn_conf_dir}
%endif
%{rhn_dir}/virtualization/__init__.py*
%{rhn_dir}/virtualization/batching_log_notifier.py*
%{rhn_dir}/virtualization/constants.py*
%{rhn_dir}/virtualization/errors.py*
%{rhn_dir}/virtualization/notification.py*
%{rhn_dir}/virtualization/util.py*
%doc LICENSE
%files host
%defattr(-,root,root,-)
%if 0%{?suse_version}
%dir %{rhn_conf_dir}
%endif
%dir %{rhn_conf_dir}/virt
%dir %{rhn_conf_dir}/virt/auto
%{_initrddir}/rhn-virtualization-host
%{_sbindir}/rcrhn-virtualization-host
%config(noreplace) %attr(644,root,root) %{cron_dir}/rhn-virtualization.cron
%{rhn_dir}/virtualization/domain_config.py*
%{rhn_dir}/virtualization/domain_control.py*
%{rhn_dir}/virtualization/domain_directory.py*
%{rhn_dir}/virtualization/get_config_value.py*
%{rhn_dir}/virtualization/init_action.py*
%{rhn_dir}/virtualization/poller.py*
%{rhn_dir}/virtualization/schedule_poller.py*
%{rhn_dir}/virtualization/poller_state_cache.py*
%{rhn_dir}/virtualization/start_domain.py*
%{rhn_dir}/virtualization/state.py*
%{rhn_dir}/virtualization/support.py*
%{rhn_dir}/actions/virt.py*
%{rhn_dir}/actions/image.py*
%if 0%{?suse_version} || (0%{?rhel} && 0%{?rhel} < 6)
%{rhn_dir}/virtualization/localvdsm.py*
%endif
%{rhn_conf_dir}/studio-*-template.xml
%config(noreplace) %{rhn_conf_dir}/image.cfg
%doc LICENSE
%changelog