File python-rtslib-fb.spec of Package python-rtslib-fb.9370

#
# spec file for package python-rtslib-fb
#
# 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/
#


%define oname rtslib-fb
%define realver 2.1.fb63
%define dbdir /etc/target

Name:           python-%{oname}
Version:        2.1.63
Release:        0%{?dist}
Url:            http://github.com/open-iscsi/rtslib-fb.git
Summary:        API for Linux kernel SCSI target (aka LIO)
License:        Apache-2.0
Group:          Development/Languages/Python
Source:         %{oname}-%{realver}.tar.xz
Patch1:         Switch-target-driver-DB-root-dir-to-etc-target.patch
Patch2:         correct-name-for-xen-pvscsi.patch
Patch3:         display-a-more-meaningful-error-when-targetcli-cannot-change-dbroot
Patch4:         raise-an-error-about-failing-to-change-the-dbroot-value-only-if-the-directory-does-not-exist
Conflicts:      python-rtslib
BuildRequires:  fdupes
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  python-six
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       pyudev

%description
rtslib-fb is an object-based Python library for configuring the LIO generic 
SCSI target, present in 3.x Linux kernel versions. rtslib-fb is licensed under
the Apache 2.0 license. Contributions are welcome

%package doc
Summary:        Documentatoin for Python rtslib-fb
Group:          Documentation/HTML
BuildArch:      noarch
BuildRequires:  epydoc
BuildRequires:  pyudev

%description doc
rtslib-fb is an object-based Python library for configuring the LIO generic 
SCSI target, present in 3.x Linux kernel versions. rtslib-fb is licensed under
the Apache 2.0 license. Contributions are welcome

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

%build
%__python setup.py build
%__mkdir_p doc/
epydoc --no-sourcecode --html -n %{oname} --exclude configobj rtslib_fb/*.py
%__mv html doc/

%install
[ "%{buildroot}" != "/" ] && %__rm -rf %{buildroot}
%__python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
%fdupes %{buildroot}%{python_sitelib}
%__install -d -m755 %{buildroot}%{_defaultdocdir}/python-rtslib-doc-%{version}
%__cp -r doc/* %{buildroot}%{_defaultdocdir}/python-rtslib-doc-%{version}/
%fdupes %{buildroot}%{_defaultdocdir}
%__install -d -m755 %{buildroot}%{_sysconfdir}/target
%__install -d -m755 %{buildroot}%{_mandir}/man5
%__install -m644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5
%__install -d -m755 %{buildroot}%{_mandir}/man8
%__install -m644 doc/targetctl.8 %{buildroot}%{_mandir}/man8
%__install -d -m755 %{buildroot}/%{dbdir}
%__install -d -m755 %{buildroot}/%{dbdir}/pr
%__install -d -m755 %{buildroot}/%{dbdir}/alua

%clean
[ "%{buildroot}" != "/" ] && %__rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{_bindir}/targetctl
%{python_sitelib}/*
%doc COPYING README.md
%dir %{_sysconfdir}/target
%doc %{_mandir}/man5/saveconfig.json.5.gz
%doc %{_mandir}/man8/targetctl.8.gz
%dir %{dbdir}
%dir %{dbdir}/pr
%dir %{dbdir}/alua

%files doc
%defattr(-,root,root,-)
%{_defaultdocdir}/python-rtslib-doc-%{version}

%changelog
openSUSE Build Service is sponsored by