File koan.spec of Package koan

#
# spec file for package koan
#
# Copyright (c) 2017 SUSE LINUX 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/
#


%if 0%{?fedora} || 0%{?suse_version} > 1320
%global use_python3 1
%global use_python2 0
%global pythonbin %{__python3}
%global python_sitelib %{python3_sitelib}
%else
%global use_python3 0
%global use_python2 1
%if 0%{?__python2:1}
%global pythonbin %{__python2}
%else
%global pythonbin %{__python}
%endif
%endif

%{!?python_sitelib: %global python_sitelib %(%{pythonbin} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{pythonbin} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

%global debug_package %{nil}
%define _binaries_in_noarch_packages_terminate_build 1
%define _unpackaged_files_terminate_build 1

%define unmangled_version 2.9.0

Summary:        Libraries and tools to manage device registration in Zenoss
License:        GPL-2.0
Group:          Development/Libraries/Python
Name:           koan
Version:        2.9.0
Release:        1
Source0:        %{name}-%{unmangled_version}.tar.gz
Patch0:         koan_old_cobbler_compat.diff
Patch1:         koan-no-xend.dif
Patch2:         koan-detect-os_version.dif
Patch3:         koan-use-kvm-acceleration-if-available.dif
Patch4:         fix-exception.dif
Patch5:         fix-koan-missing-args-and-location.patch
Patch6:         virt-install-without-generic26.patch
Patch7:         use_grub2_on_suse.diff
Patch8:         sles15.patch
Patch9:         add-missing-Koan-default-members.diff
Patch10:        decode-subprocess_get_response-results.diff
Patch11:        fix-imports-in-qcreate.diff
Patch12:        virt-setup-suse.diff
Patch13:        support-cobbler-2.X-kickstart-profile-data.diff
Patch14:        fix-grub2-entry-paths.diff


BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Prefix:         %{_prefix}
Url:            http://github.com/cobbler/koan

%if %{?suse_version: %{suse_version} > 1110} %{!?suse_version:1}
BuildArch:      noarch
%endif

%if %{use_python3}
BuildRequires:  python3
Requires:       python3
Requires:       python3-netifaces
Requires:       python3-simplejson
%else
BuildRequires:  python >= 2.3
Requires:       python >= 2.3
Requires:       python-ethtool
Requires:       python-simplejson

%if 0%{?suse_version} == 1010
BuildRequires:  python-devel
%endif
%endif
%if 0%{?rhel_version} && 0%{?rhel_version} < 800
Requires:       virt-install
%else
Recommends:     virt-install
%endif

%description
Koan stands for kickstart-over-a-network and allows for both
network installation of new virtualized guests and reinstallation
of an existing system. For use with a boot-server configured with Cobbler.

%prep
%setup -n %{name}-%{unmangled_version}
%patch0 -p0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1

%build
%{pythonbin} setup.py build

%install
%{pythonbin} setup.py install -O1 --prefix=%{_prefix} --root=%{buildroot} --record=INSTALLED_FILES

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%{python_sitelib}/koan/
%{python_sitelib}/koan-*.egg-info
%{_bindir}/cobbler-register
%{_bindir}/koan
%doc README AUTHORS COPYING

# EOF

%changelog
openSUSE Build Service is sponsored by