config/sysinv/cgts-client/centos/cgts-client.spec
Rafael Jordão Jardim bc34618d83 Python 2 to Python 3 compatibility
The changes of https://review.opendev.org/c/starlingx/config/+/782575
was used to test the cgts-client, so it is need to be merged first.
Removing python-neutronclient because this dependency is unnecessary,
it was removed by copying a few very small utility functions from
python-neutronclient into the cgtsclient.

Development: When I was trying to find things to modify I followed the
approach of build the client, get the tar file, I set up 2 environments
one based on python2 and another python3, I installed the tar client
in both environments and i exported the env vars that the client expect
to get to request the controller, and doing that I could switch between
the two python and indentifying what I should modify.

Test: After all the modification I built an ISO and I installed that
to run some commands and check if my changes got any side effects. After
that followed the procedure to update the remote CLI docker image and
insert the updated client there and I test this new image in the
remote CLI.

Story: 2007106
Task: 42268

Depends-On: I5086832605752bdb00a40a24596494c8fd987692
Signed-off-by: Rafael Jardim <rafaeljordao.jardim@windriver.com>
Change-Id: Ibf919260693f1cbe99993d1de01ecf785d604839
2021-04-16 07:09:21 -04:00

84 lines
2.0 KiB
RPMSpec

Summary: System Client and CLI
Name: cgts-client
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
BuildRequires: git
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: python2-pip
BuildRequires: python2-wheel
Requires: python-httplib2
Requires: python-prettytable
Requires: bash-completion
Requires: python-dateutil
Requires: python-keystoneclient
Requires: python2-oslo-i18n
Requires: python2-oslo-serialization
Requires: python2-oslo-utils
Requires: requests-toolbelt
# Needed for python2 and python3 compatible
Requires: python-six
%description
System Client and CLI
%define local_bindir /usr/bin/
%define local_etc_bash_completiond /etc/bash_completion.d/
%define pythonroot /usr/lib64/python2.7/site-packages
%define debug_package %{nil}
%prep
%autosetup -n %{name}-%{version} -S git
# Remove bundled egg-info
rm -rf *.egg-info
%build
export PBR_VERSION=%{version}
%{__python} setup.py build
%py2_build_wheel
%install
export PBR_VERSION=%{version}
%{__python} setup.py install --root=$RPM_BUILD_ROOT \
--install-lib=%{pythonroot} \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
mkdir -p $RPM_BUILD_ROOT/wheels
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
install -d -m 755 %{buildroot}%{local_etc_bash_completiond}
install -p -D -m 664 tools/system.bash_completion %{buildroot}%{local_etc_bash_completiond}/system.bash_completion
%clean
rm -rf $RPM_BUILD_ROOT
# Note: Package name is cgts-client but the import name is cgtsclient so
# can't use '%{name}'.
%files
%defattr(-,root,root,-)
%doc LICENSE
%{local_bindir}/*
%{local_etc_bash_completiond}/*
%{pythonroot}/cgtsclient
%{pythonroot}/cgtsclient-%{version}*.egg-info
%package wheels
Summary: %{name} wheels
%description wheels
Contains python wheels for %{name}
%files wheels
/wheels/*