File targetcli.spec of Package targetcli.216

#
# spec file for package targetcli
#
# Copyright (c) 2015 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/
#


Name:           targetcli
Summary:        Generic SCSI target CLI shell
License:        Apache-2.0
Group:          Applications/System
Version:        2.1
Release:        0
%define oname targetcli
Url:            http://www.github.com/Datera/targetcli
Source:         %{oname}-%{version}.tar.bz2
Source1:        %{oname}-systemd.service
Source2:        load_targetcli_config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       lio-utils
Requires:       python
Requires:       python-configobj
Requires:       python-configshell
Requires:       python-prettytable
Requires:       python-rtslib-rbd
# explicit Provides advertising RBD support
Provides:       %{name}-rbd = %{version}
Obsoletes:      %{name}-rbd < %{version}
BuildRequires:  epydoc
BuildRequires:  python-configobj
BuildRequires:  python-configshell
BuildRequires:  python-devel
BuildRequires:  python-prettytable
BuildRequires:  python-rtslib-rbd
%if 0%{?suse_version} >= 1230
BuildRequires:  systemd
%endif
%{?systemd_requires}
Patch1:         %{oname}-git-update.patch
Patch2:         %{oname}-fix-git-version-for-suse.patch
Patch3:         %{oname}-update-man-page-examples.patch
Patch4:         %{oname}-allow-nonexistent-portal-ips.patch
Patch5:         %{oname}-fb-rbd.patch

%description
targetcli is an administration tool for managing storage targets
using the kernel LIO core target and compatible target fabric modules.
The targetcli CLI is built on top of the python configshell CLI framework.

%prep
%setup -q -n %{oname}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

%build
%{__python} setup.py build

%install
%{__python} setup.py install --skip-build --root=%{buildroot} --prefix=%{_prefix}
mkdir -p %{buildroot}%{_mandir}/man8
mv doc/targetcli.8 %{buildroot}%{_mandir}/man8/targetcli.8
gzip -9 %{buildroot}%{_mandir}/man8/targetcli.8
# install systemd service file
install -D -m 0644 %{S:1} %{buildroot}%{_unitdir}/targetcli.service
# create target config directory
install -d %{buildroot}/etc/target
# install helper script to load config from file
install -D -m 0755 %{S:2} %{buildroot}%{_bindir}

%clean
rm -rf %{buildroot}

%post
%{service_add_post targetcli.service}

%postun
%{service_del_postun targetcli.service}

%pre
%{service_add_pre targetcli.service}

%preun
%{service_del_preun targetcli.service}

%files
%defattr(-,root,root,-)
%{python_sitelib}
%{_bindir}/targetcli
%{_bindir}/targetcli-ng
%{_bindir}/load_targetcli_config
%doc COPYING README.md
%{_mandir}/man8/targetcli.8*
%{_unitdir}/targetcli.service
%dir /etc/target

%changelog
openSUSE Build Service is sponsored by