From a62a33befab0e3a5c569730501406acc2a3afd81c1affa6f70b6d0c900326ffd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
 <pablo.suarezhernandez@suse.com>
Date: Thu, 8 Feb 2024 15:06:19 +0000
Subject: [PATCH] Accepting request 1145206 from
 home:ygutierrez:branches:systemsmanagement:saltstack

- Enable multibuilld and create test flavor
- Additionally we require python-mock just for older Python versions.

OBS-URL: https://build.opensuse.org/request/show/1145206
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=231
---
 _lastrevision |  2 +-
 _multibuild   |  3 +++
 salt.changes  |  6 ++++++
 salt.spec     | 11 ++++++++++-
 4 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 _multibuild

diff --git a/_lastrevision b/_lastrevision
index e724caf..24c3dc8 100644
--- a/_lastrevision
+++ b/_lastrevision
@@ -1 +1 @@
-d0c2f35ff4a0b21786b20c884cbb191ad2e63904
\ No newline at end of file
+d302875a0b75720b541027bbba6ec8561afa686d
\ No newline at end of file
diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..1736cec
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+<multibuild>
+  <flavor>testsuite_included</flavor>
+</multibuild>
diff --git a/salt.changes b/salt.changes
index 63df8cb..083045f 100644
--- a/salt.changes
+++ b/salt.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Thu Feb  8 12:17:39 UTC 2024 - Yeray Gutiérrez Cedrés <yeray.gutierrez@suse.com>
+
+- Enable multibuilld and create test flavor
+- Additionally we require python-mock just for older Python versions.
+
 -------------------------------------------------------------------
 Mon Feb  5 09:55:33 UTC 2024 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>
 
diff --git a/salt.spec b/salt.spec
index bef60e8..111ac76 100644
--- a/salt.spec
+++ b/salt.spec
@@ -15,6 +15,7 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 %global debug_package %{nil}
+%global flavor @BUILD_FLAVOR@%{nil}
 
 %if 0%{?suse_version} > 1210 || 0%{?rhel} >= 7 || 0%{?fedora} >=28
 %bcond_without systemd
@@ -464,7 +465,7 @@ BuildRequires:  python3-packaging
 # requirements/zeromq.txt
 %if %{with test}
 BuildRequires:  python3-boto >= 2.32.1
-BuildRequires:  python3-mock
+BuildRequires:  %{python3-mock if %python-base < 3.8}
 BuildRequires:  python3-moto >= 0.3.6
 BuildRequires:  python3-pip
 BuildRequires:  python3-salt-testing >= 2015.2.16
@@ -701,6 +702,7 @@ Requires(pre):  %fillup_prereq
 Salt ssh is a master running without zmq.
 it enables the management of minions over a ssh connection.
 
+%if "%{flavor}" == "testsuite_included"
 %package -n python3-salt-testsuite
 Summary:        Unit and integration tests for Salt
 Requires:       %{name} = %{version}-%{release}
@@ -712,7 +714,9 @@ Requires:       python3-boto
 %endif
 Requires:       python3-boto3
 Requires:       python3-docker
+%if 0%{?suse_version} < 1600
 Requires:       python3-mock
+%endif
 Requires:       python3-pygit2
 Requires:       python3-pytest >= 7.0.1
 Requires:       python3-pytest-httpserver
@@ -725,6 +729,7 @@ Obsoletes:      %{name}-tests
 
 %description -n python3-salt-testsuite
 Collection of unit, functional, and integration tests for %{name}.
+%endif
 
 %if %{with bash_completion}
 %package bash-completion
@@ -871,6 +876,7 @@ install -Dd -m 0755 %{buildroot}%{_sysconfdir}/logrotate.d/
 # Install salt-support profiles
 install -Dpm 0644 salt/cli/support/profiles/* %{buildroot}%{python3_sitelib}/salt/cli/support/profiles
 
+%if "%{flavor}" == "testsuite_included"
 # Install Salt tests
 install -Dd %{buildroot}%{python3_sitelib}/salt-testsuite
 cp -a tests %{buildroot}%{python3_sitelib}/salt-testsuite/
@@ -878,6 +884,7 @@ cp -a tests %{buildroot}%{python3_sitelib}/salt-testsuite/
 rm %{buildroot}%{python3_sitelib}/salt-testsuite/tests/runtests.py
 # Copy conf files to the testsuite as they are used by the tests
 cp -a conf %{buildroot}%{python3_sitelib}/salt-testsuite/
+%endif
 
 ## Install Zypper plugins only on SUSE machines
 %if 0%{?suse_version}
@@ -1466,8 +1473,10 @@ rm -f %{_localstatedir}/cache/salt/minion/thin/version
 %doc doc/_build/html
 %endif
 
+%if "%{flavor}" == "testsuite_included"
 %files -n python3-salt-testsuite
 %{python3_sitelib}/salt-testsuite
+%endif
 
 %if %{with bash_completion}
 %files bash-completion