diff --git a/_service b/_service
index 2e389d3..a560ba9 100644
--- a/_service
+++ b/_service
@@ -4,8 +4,8 @@
https://github.com/open-iscsi/targetcli-fb.git
targetcli-fb
- 2.1.fb46
- v2.1.fb46
+ 2.1.fb47
+ v2.1.fb47
enable
diff --git a/_servicedata b/_servicedata
index 112ad81..4d65eb3 100644
--- a/_servicedata
+++ b/_servicedata
@@ -1,4 +1,4 @@
- https://github.com/open-iscsi/targetcli-fb.git
- f632f38264edc5a620ed5cd0f506d8dc205efce3
\ No newline at end of file
+ https://github.com/open-iscsi/targetcli-fb.git
+ ee32a2493eaccd9352cc596b9e3387960cca48fc
\ No newline at end of file
diff --git a/targetcli-fb-2.1.fb47.tar.gz b/targetcli-fb-2.1.fb47.tar.gz
deleted file mode 100644
index 823255f..0000000
--- a/targetcli-fb-2.1.fb47.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0a88c06e7a00e716fdcb980f9c6ccad159b98b6655b267a7075a57bd01c861e4
-size 33059
diff --git a/targetcli-fb-2.1.fb47.tar.xz b/targetcli-fb-2.1.fb47.tar.xz
new file mode 100644
index 0000000..f877fce
--- /dev/null
+++ b/targetcli-fb-2.1.fb47.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:006c501dfcf464bcde89a548e46c56ee8d897ba560c8659098a791911531737e
+size 28956
diff --git a/targetcli-fb.changes b/targetcli-fb.changes
index bc759ae..8540ece 100644
--- a/targetcli-fb.changes
+++ b/targetcli-fb.changes
@@ -1,3 +1,32 @@
+-------------------------------------------------------------------
+Thu Jan 4 22:14:36 UTC 2018 - lduncan@suse.com
+
+- Added dependency on dbus package to SPEC file (bsc#1073913)
+
+-------------------------------------------------------------------
+Thu Jan 4 21:54:00 UTC 2018 - lduncan@suse.com
+
+- Converted RPM SPEC file to singlepsec format (bsc#1045332),
+ updating SPEC file only. This breaks this package into two
+ packages. The new base package is called targetcli-fb-common,
+ and does not depend on the python version. The other package
+ is python-version dependent, and is called either
+ python2-targetcli-fb or python3-targetcli-fb, dpending on
+ which version of Python you wish to use.
+
+-------------------------------------------------------------------
+Fri Dec 15 22:03:58 UTC 2017 - lduncan@suse.com
+
+- Ran "spec-cleaner" over the SPEC file, to clean it up, before
+ support for Python3 is added.
+
+-------------------------------------------------------------------
+Fri Dec 15 21:43:06 UTC 2017 - lduncan@suse.com
+
+- Moved targetcli-fb-2.1.fb47.tar.gz to targetcli-fb-2.1.fb47.tar.xz,
+ after appropriate decompression/compression, to match SPEC and
+ _service file. Updated _servicedata to match.
+
-------------------------------------------------------------------
Thu Aug 17 09:34:08 UTC 2017 - lszhu@suse.com
diff --git a/targetcli-fb.spec b/targetcli-fb.spec
index 71a5674..e6b8a97 100644
--- a/targetcli-fb.spec
+++ b/targetcli-fb.spec
@@ -1,7 +1,7 @@
#
# spec file for package targetcli-fb
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# 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
@@ -18,30 +18,41 @@
%define oname targetcli-fb
%define realver 2.1.fb47
-
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: %{oname}
Version: 2.1.47
Release: 0
-Url: http://github.com/agrover/%{oname}
Summary: A command shell for managing the Linux LIO kernel target
License: Apache-2.0
Group: System/Management
-Source: %{oname}-%{realver}.tar.gz
+Url: http://github.com/agrover/%{oname}
+Source: %{oname}-%{realver}.tar.xz
Source1: %{oname}.service
-Conflicts: targetcli
+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: 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-fb = %{version}
+%endif
+Obsoletes: targetcli-fb < %{version}
+Conflicts: targetcli
BuildArch: noarch
-BuildRequires: fdupes
-BuildRequires: python-configshell-fb
-BuildRequires: python-devel
-BuildRequires: python-pyparsing
-BuildRequires: python-rtslib-fb
-BuildRequires: python-setuptools
-BuildRequires: systemd
%{?systemd_requires}
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%python_subpackages
%description
targetcli-fb is a command-line interface for configuring the LIO generic
@@ -53,43 +64,65 @@ 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 -n %{oname}-%{realver}%{?extraver}
%build
-python setup.py build
+%python_build
%install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+%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}
-%fdupes %{buildroot}%{python_sitelib}
install -D -m644 targetcli.8 %{buildroot}%{_mandir}/man8/targetcli.8
-install -D -m644 %{S:1} %{buildroot}%{_unitdir}/targetcli.service
+install -D -m644 %{SOURCE1} %{buildroot}%{_unitdir}/targetcli.service
+%fdupes %{buildroot}
ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctargetcli
%post
-%{service_add_post targetcli.service}
+%python_install_alternative targetcli
%postun
-%{service_del_postun targetcli.service}
+%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
-%defattr(-,root,root)
+%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
-%{_bindir}/targetcli
-%{python_sitelib}/*
-%doc %{_mandir}/man8/targetcli.8.gz
+%doc %{_mandir}/man8/targetcli.8%{ext_man}
%{_unitdir}/targetcli.service
%{_sbindir}/rctargetcli