targetcli-fb/targetcli-fb.spec
Lee Duncan f8c3097b3b Accepting request 596386 from home:dmdiss:bsc1079329_krbd
- Merge RBD support from non-fb version (bsc#1079329)
  + Split-out-blockdev-readonly-state-detection-helper.patch
  + rbd-support.patch (SLE/Leap only, due to LIO kernel dependency)
  + Add explicit Provides for "python-rtslib-rbd"
- Detect write-protected block devices (bsc#1070815)
  + Auto-detect-readonly-state-for-iblock-devices.patch
  + Use-signed-char-instead-of-char.patch

- Automatically generate version string from upstream tag
  + Retain current fb-removed version format used
  + Rename targetcli-fb-2.1.fb47.tar.xz to targetcli-fb-2.1.47.tar.xzar.xz
    and cleanup hardcoded duplicate name/version values in spec

OBS-URL: https://build.opensuse.org/request/show/596386
OBS-URL: https://build.opensuse.org/package/show/Base:System/targetcli-fb?expand=0&rev=18
2018-04-16 20:19:01 +00:00

144 lines
4.4 KiB
RPMSpec

#
# spec file for package targetcli-fb
#
# Copyright (c) 2018 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/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: targetcli-fb
Version: 2.1.47
Release: 0
Summary: A command shell for managing the Linux LIO kernel target
License: Apache-2.0
Group: System/Management
Url: http://github.com/agrover/%{name}
Source: %{name}-%{version}.tar.xz
Source1: %{name}.service
BuildRequires: %{python_module configshell-fb}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pyparsing}
BuildRequires: %{python_module rtslib-fb}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: systemd
Requires: python-configshell-fb
Requires: python-dbus-python
Requires: python-rtslib-fb
Requires: python-six
Requires: targetcli-fb-common
Requires(post): update-alternatives
Requires(postun): update-alternatives
%ifpython3
Provides: targetcli = %{version}-%{release}
Provides: targetcli-fb = %{version}-%{release}
%endif
Obsoletes: targetcli
Obsoletes: targetcli-fb
BuildArch: noarch
%if 0%{?sle_version} == 150000
# explicit Provides advertising RBD support
Provides: targetcli-rbd = %{version}
Obsoletes: targetcli-rbd < %{version}
%endif
%{?systemd_requires}
Patch1: Auto-detect-readonly-state-for-iblock-devices.patch
Patch2: Use-signed-char-instead-of-char.patch
Patch3: Split-out-blockdev-readonly-state-detection-helper.patch
Patch4: rbd-support.patch
%python_subpackages
%description
targetcli-fb is a command-line interface for configuring the LIO generic
SCSI target, present in 3.x Linux kernel versions.
targetcli-fb is a fork of the "targetcli" code written by RisingTide Systems.
The "-fb" differentiates between the original and this version. Please ensure
to use either all "fb" versions of the targetcli components -- targetcli,
rtslib, and configshell, or stick with all non-fb versions, since they are
no longer strictly compatible.
%package -n %{name}-common
Summary: Common targetcli-fb subpackage for either flavor of Python
Group: System/Management
Provides: %{python_module targetcli-fb-common}
%description -n %{name}-common
targetcli-fb-common is the invariant base package needed by both
python2-targetcli-fb and python3-targetcli-fb.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%if 0%{?sle_version} == 150000
# RBD support is dependent on LIO changes present in the SLE/Leap kernel
%patch4 -p1
%endif
%build
%python_build
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/targetcli
install -d -m755 %{buildroot}%{_sysconfdir}/target
install -d -m755 %{buildroot}%{_sysconfdir}/target/backup
install -d -m755 %{buildroot}%{_sbindir}
install -D -m644 targetcli.8 %{buildroot}%{_mandir}/man8/targetcli.8
install -D -m644 %{SOURCE1} %{buildroot}%{_unitdir}/targetcli.service
%fdupes %{buildroot}
ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctargetcli
%post
%python_install_alternative targetcli
%postun
%python_uninstall_alternative targetcli
%pre
%{service_add_pre targetcli.service}
%preun
%{stop_on_removal targetcli}
%post -n %{name}-common
%{service_add_post targetcli.service}
%postun -n %{name}-common
%{service_del_postun targetcli.service}
%pre -n %{name}-common
%{service_add_pre targetcli.service}
%preun -n %{name}-common
%{service_del_preun targetcli.service}
%files %{python_files}
%python_alternative %{_bindir}/targetcli
%{python_sitelib}/*
%files -n %{name}-common
%doc COPYING README.md THANKS
%dir %{_sysconfdir}/target
%dir %{_sysconfdir}/target/backup
%doc %{_mandir}/man8/targetcli.8%{ext_man}
%{_unitdir}/targetcli.service
%{_sbindir}/rctargetcli
%changelog