diff --git a/salt/salt.spec b/salt/salt.spec index fec3d16..a460200 100644 --- a/salt/salt.spec +++ b/salt/salt.spec @@ -28,7 +28,6 @@ %else %bcond_with systemd %endif -%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %if 0%{?suse_version} > 1110 %bcond_without bash_completion %bcond_without fish_completion @@ -41,6 +40,8 @@ %bcond_without docs %bcond_with builddocs +%{?sle15allpythons} +%define skip_python2 1 Name: salt%{psuffix} Version: 3006.0 Release: 0 @@ -444,7 +445,7 @@ BuildRequires: logrotate BuildRequires: fdupes %endif -Requires: python3-%{name} = %{version}-%{release} +Requires: python-%{name} = %{version}-%{release} Obsoletes: python2-%{name} Requires(pre): %{_sbindir}/groupadd @@ -506,6 +507,9 @@ BuildRequires: zsh BuildRequires: yum %endif +%define python_subpackage_only 1 +%python_subpackages + %description Salt is a distributed remote execution system used to execute commands and query data. It was developed in order to bring the best solutions found in @@ -516,7 +520,7 @@ servers, handle them quickly and through a simple and manageable interface. %if "%{flavor}" != "testsuite" -%package -n python3-salt +%package -n python-salt Summary: python3 library for salt Group: System/Management Requires: %{name} = %{version}-%{release} @@ -524,10 +528,10 @@ BuildRequires: python-rpm-macros %if 0%{?rhel} == 8 BuildRequires: platform-python %else -BuildRequires: python3 +BuildRequires: %{python_module base} %endif -BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} # requirements/base.txt %if 0%{?rhel} || 0%{?fedora} BuildRequires: python3-jinja2 @@ -536,41 +540,41 @@ BuildRequires: python3-msgpack > 0.3 BuildRequires: python3-zmq >= 2.2.0 BuildRequires: python3-m2crypto %else -BuildRequires: python3-Jinja2 -BuildRequires: python3-MarkupSafe -BuildRequires: python3-msgpack-python > 0.3 -BuildRequires: python3-pyzmq >= 2.2.0 +BuildRequires: %{python_module Jinja2} +BuildRequires: %{python_module MarkupSafe} +BuildRequires: %{python_module msgpack-python > 0.3} +BuildRequires: %{python_module pyzmq > 2.2.0} %if 0%{?suse_version} >= 1500 -BuildRequires: python3-M2Crypto +BuildRequires: %{python_module M2Crypto} %else -BuildRequires: python3-pycrypto >= 2.6.1 +BuildRequires: %{python_module pycrypto >= 2.6.1} %endif %endif -BuildRequires: python3-PyYAML -BuildRequires: python3-psutil -BuildRequires: python3-requests >= 1.0.0 -BuildRequires: python3-distro -BuildRequires: python3-looseversion -BuildRequires: python3-packaging -BuildRequires: python3-contextvars +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module psutil} +BuildRequires: %{python_module requests >= 1.0.0} +BuildRequires: %{python_module distro} +BuildRequires: %{python_module looseversion} +BuildRequires: %{python_module packaging} +BuildRequires: %{python_module contextvars} # requirements/zeromq.txt %if %{with test} -BuildRequires: python3-boto >= 2.32.1 -BuildRequires: %{python3-mock if %python-base < 3.8} -BuildRequires: python3-moto >= 0.3.6 -BuildRequires: python3-pip -BuildRequires: python3-salt-testing >= 2015.2.16 -BuildRequires: python3-unittest2 -BuildRequires: python3-xml +BuildRequires: %{python_module boto >= 2.32.1} +BuildRequires: %{python_module mock if %python-base < 3.8} +BuildRequires: %{python_module moto >= 0.3.6} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module salt-testing >= 2015.2.16} +BuildRequires: %{python_module unittest2} +BuildRequires: %{python_module xml} %endif %if %{with builddocs} -BuildRequires: python3-sphinx +BuildRequires: %{python_module sphinx} %endif %if 0%{?rhel} == 8 Requires: platform-python %else -Requires: python3 +Requires: python-base %endif # requirements/base.txt %if 0%{?rhel} || 0%{?fedora} @@ -588,42 +592,42 @@ Requires: dnf Requires: yum-plugin-security %endif %else # SUSE -Requires: python3-Jinja2 -Requires: python3-MarkupSafe -Requires: python3-msgpack-python > 0.3 +Requires: python-Jinja2 +Requires: python-MarkupSafe +Requires: python-msgpack-python > 0.3 %if 0%{?suse_version} >= 1500 -Requires: python3-M2Crypto +Requires: python-M2Crypto %else -Requires: python3-pycrypto >= 2.6.1 +Requires: python-pycrypto >= 2.6.1 %endif -Requires: python3-pyzmq >= 2.2.0 +Requires: python-pyzmq >= 2.2.0 %endif # end of RHEL / SUSE specific section -Requires: python3-jmespath -Requires: python3-PyYAML -Requires: python3-psutil -Requires: python3-requests >= 1.0.0 -Requires: python3-distro -Requires: python3-looseversion -Requires: python3-packaging -Requires: python3-contextvars +Requires: python-jmespath +Requires: python-PyYAML +Requires: python-psutil +Requires: python-requests >= 1.0.0 +Requires: python-distro +Requires: python-looseversion +Requires: python-packaging +Requires: python-contextvars %if 0%{?suse_version} # required for zypper.py -Requires: python3-rpm +Requires: python-rpm Requires(pre): libzypp(plugin:system) >= 0 -Requires: python3-zypp-plugin +Requires: python-zypp-plugin # requirements/opt.txt (not all) # Suggests: python-MySQL-python ## Disabled for now, originally Recommended -Suggests: python3-timelib -Suggests: python3-gnupg +Suggests: python-timelib +Suggests: python-gnupg # requirements/zeromq.txt %endif # %if 0%{?suse_version} # python-xml is part of python-base in all rhel versions -Requires: python3-xml -Suggests: python3-Mako -Recommends: python3-netaddr -Recommends: python3-pyinotify +Requires: python-xml +Suggests: python-Mako +Recommends: python-netaddr +Recommends: python-pyinotify %endif # Required by Salt modules @@ -632,9 +636,9 @@ Requires: sudo Requires: file Recommends: man -Provides: bundled(python3-tornado) = 4.5.3 +Provides: bundled(python-tornado) = 4.5.3 -%description -n python3-salt +%description -n python-salt Python3 specific files for salt %package api @@ -643,9 +647,9 @@ Group: System/Management Requires: %{name} = %{version}-%{release} Requires: %{name}-master = %{version}-%{release} %if 0%{?suse_version} -Requires: python3-CherryPy >= 3.2.2 +Requires: python-CherryPy >= 3.2.2 %else -Requires: python3-cherrypy >= 3.2.2 +Requires: python-cherrypy >= 3.2.2 %endif %description api @@ -656,10 +660,10 @@ Summary: Generic cloud provisioning tool for Saltstack Group: System/Management Requires: %{name} = %{version}-%{release} Requires: %{name}-master = %{version}-%{release} -Requires: python3-apache-libcloud +Requires: python-apache-libcloud %if 0%{?suse_version} -Recommends: python3-botocore -Recommends: python3-netaddr +Recommends: python-botocore +Recommends: python-netaddr %endif %description cloud @@ -682,7 +686,7 @@ Summary: The management component of Saltstack with zmq protocol supporte Group: System/Management Requires: %{name} = %{version}-%{release} %if 0%{?suse_version} -Recommends: python3-pygit2 >= 0.20.3 +Recommends: python-pygit2 >= 0.20.3 %endif %ifarch %{ix86} x86_64 %if 0%{?suse_version} @@ -870,44 +874,44 @@ list of active executors. This package add the configuration file. %if "%{flavor}" == "testsuite" -%package -n python3-salt-testsuite +%package -n python-salt-testsuite Summary: Unit and integration tests for Salt %if 0%{?rhel} == 8 BuildRequires: platform-python %else -BuildRequires: python3 +BuildRequires: %{python_module base} %endif -BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} Requires: salt = %{version} -Recommends: python3-CherryPy -Requires: python3-Genshi -Requires: python3-Mako +Recommends: python-CherryPy +Requires: python-Genshi +Requires: python-Mako %if !0%{?suse_version} > 1600 || 0%{?centos} -Requires: python3-boto +Requires: python-boto %endif -Requires: python3-boto3 -Requires: python3-docker +Requires: python-boto3 +Requires: python-docker %if 0%{?suse_version} < 1600 -Requires: python3-mock -%endif -Requires: python3-pygit2 -Requires: python3-pytest >= 7.0.1 -Requires: python3-pytest-httpserver -Requires: python3-pytest-salt-factories >= 1.0.0~rc21 -Requires: python3-pytest-subtests -Requires: python3-testinfra -Requires: python3-yamllint -Requires: python3-pip +Requires: python-mock +%endif +Requires: python-pygit2 +Requires: python-pytest >= 7.0.1 +Requires: python-pytest-httpserver +Requires: python-pytest-salt-factories >= 1.0.0~rc21 +Requires: python-pytest-subtests +Requires: python-testinfra +Requires: python-yamllint +Requires: python-pip Requires: docker Requires: openssh Requires: git Obsoletes: %{name}-tests -%description -n python3-salt-testsuite +%description -n python-salt-testsuite Collection of unit, functional, and integration tests for %{name}. %endif @@ -928,8 +932,10 @@ cp %{S:6} . %if 0%{?fedora} || 0%{?rhel} export PATH=/usr/bin:$PATH %endif -python3 setup.py --with-salt-version=%{version} --salt-transport=both build -mv build _build.python3 +%{python_expand # +$python setup.py --with-salt-version=%{version} --salt-transport=both build +mv build _build.%{$python_bin_suffix} +} %if %{with docs} && %{without builddocs} # extract docs from the tarball @@ -949,16 +955,18 @@ cd doc && make html && rm _build/html/.buildinfo && rm _build/html/_images/proxy %install %if "%{flavor}" != "testsuite" -mv _build.python3 build -python3 setup.py --salt-transport=both install --prefix=%{_prefix} --root=%{buildroot} -mv build _build.python3 +%{python_expand # +mv _build.%{$python_bin_suffix} build +$python setup.py --salt-transport=both install --prefix=%{_prefix} --root=%{buildroot} +mv build _build.%{$python_bin_suffix} -DEF_PYPATH=_build.python3/scripts-*/ +DEF_PYPATH=_build.%{$python_bin_suffix}/scripts-*/ rm -f %{buildroot}%{_bindir}/* for script in $DEF_PYPATH/*; do install -m 0755 $script %{buildroot}%{_bindir} done +} ## create missing directories install -Dd -m 0750 %{buildroot}%{_localstatedir}/cache/salt/cloud @@ -994,18 +1002,22 @@ install -Dd -m 0755 %{buildroot}%{_sbindir} 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 +%{python_expand # +install -Dpm 0644 salt/cli/support/profiles/* %{buildroot}%{$python_sitelib}/salt/cli/support/profiles +} %endif %if "%{flavor}" == "testsuite" # Install Salt tests -install -Dd %{buildroot}%{python3_sitelib}/salt-testsuite -cp -a tests %{buildroot}%{python3_sitelib}/salt-testsuite/ +%{python_expand # +install -Dd %{buildroot}%{$python_sitelib}/salt-testsuite +cp -a tests %{buildroot}%{$python_sitelib}/salt-testsuite/ # Remove runtests.py which is not used as deprecated method of running the tests -rm %{buildroot}%{python3_sitelib}/salt-testsuite/tests/runtests.py +rm %{buildroot}%{$python_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/ +cp -a conf %{buildroot}%{$python_sitelib}/salt-testsuite/ +} %endif %if "%{flavor}" != "testsuite" @@ -1116,9 +1128,16 @@ install -Dpm 0640 conf/suse/standalone-formulas-configuration.conf %{buildroot}% %if 0%{?suse_version} > 1020 %fdupes %{buildroot}%{_docdir} -%fdupes %{buildroot}%{python3_sitelib} +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif + %endif +%check +%if %{with test} +%{python_expand # +$python setup.py test --runtests-opts=-u +} %endif %if "%{flavor}" != "testsuite" @@ -1426,7 +1445,7 @@ fi %endif %endif -%posttrans -n python3-salt +%posttrans -n python-salt # force re-generate a new thin.tgz rm -f %{_localstatedir}/cache/salt/master/thin/version rm -f %{_localstatedir}/cache/salt/minion/thin/version @@ -1582,13 +1601,13 @@ rm -f %{_localstatedir}/cache/salt/minion/thin/version %endif %{_mandir}/man1/salt.1.* -%files -n python3-salt +%files %{python_files salt} %defattr(-,root,root,-) -%dir %{python3_sitelib}/salt -%dir %{python3_sitelib}/salt-*.egg-info -%{python3_sitelib}/salt/* -%{python3_sitelib}/salt-*.egg-info/* -%exclude %{python3_sitelib}/salt/cloud/deploy/*.sh +%dir %{python_sitelib}/salt +%dir %{python_sitelib}/salt-*.egg-info +%{python_sitelib}/salt/* +%{python_sitelib}/salt-*.egg-info/* +%exclude %{python_sitelib}/salt/cloud/deploy/*.sh %if %{with docs} %files doc @@ -1635,8 +1654,8 @@ rm -f %{_localstatedir}/cache/salt/minion/thin/version %endif %if "%{flavor}" == "testsuite" -%files -n python3-salt-testsuite -%{python3_sitelib}/salt-testsuite +%files %{python_files salt-testsuite} +%{python_sitelib}/salt-testsuite %endif %changelog