Accepting request 651221 from home:okurz:branches:Cloud:Tools

Add multibuild package self-test

OBS-URL: https://build.opensuse.org/request/show/651221
OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/azure-cli?expand=0&rev=13
This commit is contained in:
John Paul Adrian Glaubitz 2018-11-23 10:16:54 +00:00 committed by Git OBS Bridge
parent 7b21614207
commit 6ed9fbc572
3 changed files with 45 additions and 1 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Nov 21 16:15:57 UTC 2018 - okurz@suse.com
- Add multibuild package self-test
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Nov 14 14:22:55 UTC 2018 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> Wed Nov 14 14:22:55 UTC 2018 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@ -12,11 +12,26 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
# Define just "test" as a package in _multibuild file to distinguish test
# instructions here
%if "@BUILD_FLAVOR@" == ""
%define _test 0
%define name_ext %nil
%else
%define _test 1
%define name_ext -test
%endif
%if !%{?_test}
Name: azure-cli Name: azure-cli
%else
Name: azure-cli%{?name_ext}
%endif
%define short_name azure-cli
Version: 2.0.45 Version: 2.0.45
Release: 0 Release: 0
Summary: Microsoft Azure CLI 2.0 Summary: Microsoft Azure CLI 2.0
@ -26,6 +41,9 @@ Url: https://github.com/Azure/azure-cli
Source: https://files.pythonhosted.org/packages/source/a/azure-cli/azure-cli-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/a/azure-cli/azure-cli-%{version}.tar.gz
Source1: LICENSE.txt Source1: LICENSE.txt
Patch1: ac_use-python3-by-default.patch Patch1: ac_use-python3-by-default.patch
%if 0%{?_test}
BuildRequires: %{short_name} = %{version}
%else
BuildRequires: azure-cli-nspkg BuildRequires: azure-cli-nspkg
BuildRequires: python3-azure-nspkg BuildRequires: python3-azure-nspkg
BuildRequires: python3-devel BuildRequires: python3-devel
@ -83,27 +101,44 @@ Requires: python3-azure-nspkg
Conflicts: azure-cli < 2.0.0 Conflicts: azure-cli < 2.0.0
BuildArch: noarch BuildArch: noarch
%endif
%description %description
Microsoft Azure CLI 2.0 Command Line Utilities Microsoft Azure CLI 2.0 Command Line Utilities
%prep %prep
%if 0%{?_test}
# workaround to prevent post/install failing assuming this file for whatever
# reason
touch %{_sourcedir}/%{short_name}
%else
%setup -q -n azure-cli-%{version} %setup -q -n azure-cli-%{version}
%patch1 -p1 %patch1 -p1
%endif
%build %build
%if 0%{?_test}
az --help
%else
install -m 644 %{SOURCE1} %{_builddir}/azure-cli-%{version} install -m 644 %{SOURCE1} %{_builddir}/azure-cli-%{version}
python3 setup.py build python3 setup.py build
%endif
%install %install
%if 0%{?_test}
# disable debug packages in package test to prevent error about missing files
%define debug_package %{nil}
%else
python3 setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-lib=%{python3_sitelib} python3 setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-lib=%{python3_sitelib}
install -DTm644 %{buildroot}%{_bindir}/az.completion.sh %{buildroot}/etc/bash_completion.d/az.completion.sh install -DTm644 %{buildroot}%{_bindir}/az.completion.sh %{buildroot}/etc/bash_completion.d/az.completion.sh
rm -rf %{buildroot}%{python3_sitelib}/azure/cli/__init__.* rm -rf %{buildroot}%{python3_sitelib}/azure/cli/__init__.*
rm -rf %{buildroot}%{python3_sitelib}/azure/cli/__pycache__ rm -rf %{buildroot}%{python3_sitelib}/azure/cli/__pycache__
rm -rf %{buildroot}%{python3_sitelib}/azure/__init__.* rm -rf %{buildroot}%{python3_sitelib}/azure/__init__.*
rm -rf %{buildroot}%{python3_sitelib}/azure/__pycache__ rm -rf %{buildroot}%{python3_sitelib}/azure/__pycache__
%endif
%files %files
%if !%{?_test}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc HISTORY.rst README.rst %doc HISTORY.rst README.rst
%license LICENSE.txt %license LICENSE.txt
@ -113,5 +148,6 @@ rm -rf %{buildroot}%{python3_sitelib}/azure/__pycache__
%exclude /usr/bin/az.completion.sh %exclude /usr/bin/az.completion.sh
%{python3_sitelib}/azure/cli %{python3_sitelib}/azure/cli
%{python3_sitelib}/azure_cli-*.egg-info %{python3_sitelib}/azure_cli-*.egg-info
%endif
%changelog %changelog