%global srcname avocado %global pkgname avocado # Conditional for release vs. snapshot builds. Set to 1 for release build. %if ! 0%{?rel_build:1} %global rel_build 1 %endif # Settings used for build from snapshots. %if 0%{?rel_build} %global gittar %{srcname}-%{version}.tar.gz %else %if ! 0%{?commit:1} %global commit 0ddd3c7b92f18c85157766e9e0ec810e6b3dd37e %endif %if ! 0%{?commit_date:1} %global commit_date 20180301 %endif %global shortcommit %(c=%{commit};echo ${c:0:7}) %global gitrel .%{commit_date}git%{shortcommit} %global gittar %{srcname}-%{shortcommit}.tar.gz %endif # Selftests are provided but may need to be skipped because many of # the functional tests are time and resource sensitive and can # cause race conditions and random build failures. They are # enabled by default. # However, selftests need to be disabled when libvirt is not available. %global with_tests 1 %if 0%{?rhel} && 0%{?rhel} <= 7 # libvirt is not available for all RHEL builder architectures %global with_tests 0 %endif # Python2 binary packages are being removed # See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal %if (0%{?fedora} && 0%{?fedora} <= 29) || (0%{?rhel} && 0%{?rhel} <= 7) %global with_resultsdb 1 %else %global with_resultsdb 0 %endif Name: python-%{pkgname} Version: 52.1 Release: 9%{?gitrel}%{?dist} Summary: Framework with tools and libraries for Automated Testing # Found licenses: # avocado/utils/external/gdbmi_parser.py: MIT # avocado/utils/external/spark.py: MIT # optional_plugins/html/avocado_result_html/resources/static/css/*: MIT # optional_plugins/html/avocado_result_html/resources/static/js/*: MIT # Other files: GPLv2 and GPLv2+ License: GPLv2 and MIT URL: http://avocado-framework.github.io/ %if 0%{?rel_build} Source0: https://github.com/avocado-framework/%{srcname}/archive/%{version}.tar.gz#/%{gittar} %else Source0: https://github.com/avocado-framework/%{srcname}/archive/%{commit}.tar.gz#/%{gittar} %endif Patch0: avocado-selftest-doublefree-disable.patch Patch1: avocado-selftest-fix-cmdline-check.patch BuildArch: noarch BuildRequires: python2-aexpect BuildRequires: python2-devel BuildRequires: python2-mock BuildRequires: /usr/bin/rst2man BuildRequires: grep, sed %if 0%{?fedora} > 27 || 0%{?rhel} > 7 BuildRequires: python2-flexmock BuildRequires: python2-lxml BuildRequires: python2-pystache %else BuildRequires: python-flexmock BuildRequires: python-lxml BuildRequires: pystache %endif %if 0%{?fedora} >= 29 BuildRequires: python2-fabric3 %else BuildRequires: fabric %endif %if %{with_resultsdb} BuildRequires: python2-resultsdb_api %endif %if 0%{?with_tests} BuildRequires: perl(TAP::Parser) %if 0%{?fedora} >= 27 || 0%{?rhel} > 7 BuildRequires: python2-libvirt %else BuildRequires: libvirt-python %endif %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: python-yaml %else BuildRequires: python2-yaml %endif %endif %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: python-psutil BuildRequires: python-requests BuildRequires: python-setuptools BuildRequires: python-sphinx BuildRequires: python-stevedore %else BuildRequires: python2-psutil BuildRequires: python2-requests BuildRequires: python2-setuptools %if 0%{?fedora} && 0%{?fedora} <= 30 # python2-sphinx is no longer available or needed as of F31 BuildRequires: python2-sphinx %endif BuildRequires: python2-stevedore %endif %if 0%{?el6} BuildRequires: procps BuildRequires: python-argparse BuildRequires: python-importlib BuildRequires: python-logutils BuildRequires: python-unittest2 %else BuildRequires: procps-ng %endif # For some strange reason, fabric on Fedora 24 does not require the # python-crypto package, but the fabric code always imports it. Newer # fabric versions, such from Fedora 25 do conditional imports (try: # from Crypto import Random; except: Random = None) and thus do not # need this requirement. %if 0%{?fedora} == 24 BuildRequires: python-crypto %endif %if 0%{?fedora} >= 25 || 0%{?rhel} >= 7 BuildRequires: kmod %endif %description Avocado is a set of tools and libraries (what people call these days a framework) to perform automated testing. %package -n python2-%{pkgname} Summary: %{summary} License: GPLv2 and MIT %{?python_provide:%python_provide python2-%{pkgname}} Requires: gdb Requires: gdb-gdbserver Requires: pyliblzma Requires: python2 %if 0%{?fedora} > 27 || 0%{?rhel} > 7 Requires: python2-pystache %else Requires: pystache %endif %if 0%{?fedora} >= 29 Requires: python2-fabric3 %else Requires: fabric %endif %if 0%{?rhel} && 0%{?rhel} <= 7 Requires: python-requests Requires: python-stevedore %else Requires: python2-requests Requires: python2-stevedore %endif %if 0%{?el6} Requires: procps Requires: python-argparse Requires: python-importlib Requires: python-logutils Requires: python-unittest2 %else Requires: procps-ng %endif %description -n python2-%{pkgname} Avocado is a set of tools and libraries (what people call these days a framework) to perform automated testing. %package -n python2-%{pkgname}-plugins-output-html Summary: Avocado HTML report plugin %{?python_provide:%python_provide python2-%{pkgname}-plugins-output-html} Requires: python2-%{pkgname} == %{version}-%{release} %if 0%{?fedora} > 27 || 0%{?rhel} > 7 Requires: python2-pystache %else Requires: pystache %endif %description -n python2-%{pkgname}-plugins-output-html Adds to avocado the ability to generate an HTML report at every job results directory. It also gives the user the ability to write a report on an arbitrary filesystem location. %package -n python2-%{pkgname}-plugins-runner-remote Summary: Avocado Runner for Remote Execution %{?python_provide:%python_provide python2-%{pkgname}-plugins-runner-remote} Requires: python2-%{pkgname} == %{version}-%{release} %if 0%{?fedora} == 24 Requires: python-crypto %endif %if 0%{?fedora} >= 29 Requires: python2-fabric3 %else Requires: fabric %endif %description -n python2-%{pkgname}-plugins-runner-remote Allows Avocado to run jobs on a remote machine, by means of an SSH connection. Avocado must be previously installed on the remote machine. %package -n python2-%{pkgname}-plugins-runner-vm Summary: Avocado Runner for libvirt VM Execution %{?python_provide:%python_provide python2-%{pkgname}-plugins-runner-vm} Requires: python2-%{pkgname} == %{version}-%{release} Requires: python2-%{pkgname}-plugins-runner-remote == %{version}-%{release} %if 0%{?fedora} >= 27 || 0%{?rhel} > 7 Requires: python2-libvirt %else Requires: libvirt-python %endif %description -n python2-%{pkgname}-plugins-runner-vm Allows Avocado to run jobs on a libvirt based VM, by means of interaction with a libvirt daemon and an SSH connection to the VM itself. Avocado must be previously installed on the VM. %package -n python2-%{pkgname}-plugins-runner-docker Summary: Avocado Runner for Execution on Docker Containers %{?python_provide:%python_provide python2-%{pkgname}-plugins-runner-docker} Requires: python2-%{pkgname} == %{version}-%{release} Requires: python2-%{pkgname}-plugins-runner-remote == %{version}-%{release} Requires: python2-aexpect %description -n python2-%{pkgname}-plugins-runner-docker Allows Avocado to run jobs on a Docker container by interacting with a Docker daemon and attaching to the container itself. Avocado must be previously installed on the container. %if %{with_resultsdb} %package -n python2-%{pkgname}-plugins-resultsdb Summary: Avocado plugin to propagate job results to ResultsDB %{?python_provide:%python_provide python2-%{pkgname}-plugins-resultsdb} Requires: python2-%{pkgname} == %{version}-%{release} Requires: python2-resultsdb_api %description -n python2-%{pkgname}-plugins-resultsdb Allows Avocado to send job results directly to a ResultsDB server. %endif %package -n python2-%{pkgname}-plugins-varianter-yaml-to-mux Summary: Avocado plugin to generate variants out of yaml files %{?python_provide:%python_provide python2-%{pkgname}-plugins-varianter-yaml-to-mux} Requires: python2-%{pkgname} == %{version}-%{release} %if 0%{?rhel} && 0%{?rhel} <= 7 Requires: python-yaml %else Requires: python2-yaml %endif %description -n python2-%{pkgname}-plugins-varianter-yaml-to-mux Can be used to produce multiple test variants with test parameters defined in a yaml file(s). %package -n python-%{pkgname}-examples Summary: Avocado Test Framework Example Tests License: GPLv2 # documentation does not require main package, but needs to be in lock-step if present Conflicts: python-%{pkgname} < %{version}-%{release}, python-%{pkgname} > %{version}-%{release} %description -n python-%{pkgname}-examples The set of example tests present in the upstream tree of the Avocado framework. Some of them are used as functional tests of the framework, others serve as examples of how to write tests on your own. %prep %if 0%{?rel_build} %setup -q -n %{srcname}-%{version} %else %setup -q -n %{srcname}-%{commit} %endif %patch0 -p1 %patch1 -p1 # package plugins-runner-vm requires libvirt-python, but the RPM # version of libvirt-python does not publish the egg info and this # causes that dep to be attempted to be installed by pip sed -e "s/'libvirt-python'//" -i optional_plugins/runner_vm/setup.py %if 0%{?fedora} >= 29 sed -e "s/'fabric'/'fabric3'/" -i optional_plugins/runner_remote/setup.py %endif grep -r -l '/usr/bin/env python' . | xargs sed -i 's|/usr/bin/env python|%__python2|' %build %{__python2} setup.py build pushd optional_plugins/html %{__python2} setup.py build popd pushd optional_plugins/runner_remote %{__python2} setup.py build popd pushd optional_plugins/runner_vm %{__python2} setup.py build popd pushd optional_plugins/runner_docker %{__python2} setup.py build popd %if %{with_resultsdb} pushd optional_plugins/resultsdb %{__python2} setup.py build popd %endif pushd optional_plugins/varianter_yaml_to_mux %{__python2} setup.py build popd %{__make} man %install %{__python2} setup.py install --root %{buildroot} --skip-build pushd optional_plugins/html %{__python2} setup.py install --root %{buildroot} --skip-build popd pushd optional_plugins/runner_remote %{__python2} setup.py install --root %{buildroot} --skip-build popd pushd optional_plugins/runner_vm %{__python2} setup.py install --root %{buildroot} --skip-build popd pushd optional_plugins/runner_docker %{__python2} setup.py install --root %{buildroot} --skip-build popd %if %{with_resultsdb} pushd optional_plugins/resultsdb %{__python2} setup.py install --root %{buildroot} --skip-build popd %endif pushd optional_plugins/varianter_yaml_to_mux %{__python2} setup.py install --root %{buildroot} --skip-build popd %{__mv} %{buildroot}%{_bindir}/avocado %{buildroot}%{_bindir}/avocado-%{python2_version} %{__ln_s} avocado-%{python2_version} %{buildroot}%{_bindir}/avocado-2 %{__ln_s} avocado-%{python2_version} %{buildroot}%{_bindir}/avocado %{__mv} %{buildroot}%{_bindir}/avocado-rest-client %{buildroot}%{_bindir}/avocado-rest-client-%{python2_version} %{__ln_s} avocado-rest-client-%{python2_version} %{buildroot}%{_bindir}/avocado-rest-client-2 %{__ln_s} avocado-rest-client-%{python2_version} %{buildroot}%{_bindir}/avocado-rest-client %{__mkdir_p} %{buildroot}%{_mandir}/man1 %{__install} -m 0644 man/avocado.1 %{buildroot}%{_mandir}/man1/avocado.1 %{__install} -m 0644 man/avocado-rest-client.1 %{buildroot}%{_mandir}/man1/avocado-rest-client.1 %{__install} -d -m 0755 %{buildroot}%{_sharedstatedir}/avocado/data # relocate examples to documentation directory %{__mkdir_p} %{buildroot}%{_docdir}/avocado %{__mv} %{buildroot}%{_datadir}/avocado/tests %{buildroot}%{_docdir}/avocado/tests %{__mv} %{buildroot}%{_datadir}/avocado/wrappers %{buildroot}%{_docdir}/avocado/wrappers find %{buildroot}%{_docdir}/avocado -type f -name '*.py' -exec %{__chmod} -c -x {} ';' %check %if 0%{?with_tests} %{__python2} setup.py develop --user pushd optional_plugins/html %{__python2} setup.py develop --user popd pushd optional_plugins/runner_remote %{__python2} setup.py develop --user popd pushd optional_plugins/runner_vm %{__python2} setup.py develop --user popd pushd optional_plugins/runner_docker %{__python2} setup.py develop --user popd %if %{with_resultsdb} pushd optional_plugins/resultsdb %{__python2} setup.py develop --user popd %endif pushd optional_plugins/varianter_yaml_to_mux %{__python2} setup.py develop --user popd # Package build environments have the least amount of resources # we have observed so far. Let's avoid tests that require too # much resources or are time sensitive. # Also, use of unversioned python is deprecated, so force use of python2 as per # https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build AVOCADO_CHECK_LEVEL=0 UNITTEST_AVOCADO_CMD="$HOME/.local/bin/avocado" %{__python2} selftests/run %endif %files -n python2-%{pkgname} %license LICENSE %doc README.rst %dir %{_sysconfdir}/avocado %dir %{_sysconfdir}/avocado/conf.d %dir %{_sysconfdir}/avocado/sysinfo %dir %{_sysconfdir}/avocado/scripts %dir %{_sysconfdir}/avocado/scripts/job %dir %{_sysconfdir}/avocado/scripts/job/pre.d %dir %{_sysconfdir}/avocado/scripts/job/post.d %config(noreplace) %{_sysconfdir}/avocado/avocado.conf %config(noreplace) %{_sysconfdir}/avocado/conf.d/gdb.conf %config(noreplace) %{_sysconfdir}/avocado/sysinfo/commands %config(noreplace) %{_sysconfdir}/avocado/sysinfo/files %config(noreplace) %{_sysconfdir}/avocado/sysinfo/profilers %{_sysconfdir}/avocado/conf.d/README %{_sysconfdir}/avocado/scripts/job/pre.d/README %{_sysconfdir}/avocado/scripts/job/post.d/README %{python2_sitelib}/avocado/ %{python2_sitelib}/avocado_framework-%{version}-py%{python2_version}.egg-info %{_bindir}/avocado-%{python2_version} %{_bindir}/avocado-2 %{_bindir}/avocado %{_bindir}/avocado-rest-client-%{python2_version} %{_bindir}/avocado-rest-client-2 %{_bindir}/avocado-rest-client %{_mandir}/man1/avocado.1.gz %{_mandir}/man1/avocado-rest-client.1.gz %dir %{_sharedstatedir}/avocado %dir %{_docdir}/avocado %{_docdir}/avocado/avocado.rst %{_docdir}/avocado/avocado-rest-client.rst %dir %{_libexecdir}/avocado %{_libexecdir}/avocado/avocado-bash-utils %{_libexecdir}/avocado/avocado_debug %{_libexecdir}/avocado/avocado_error %{_libexecdir}/avocado/avocado_info %{_libexecdir}/avocado/avocado_warn %files -n python2-%{pkgname}-plugins-output-html %{python2_sitelib}/avocado_result_html/ %{python2_sitelib}/avocado_framework_plugin_result_html-%{version}-py%{python2_version}.egg-info %files -n python2-%{pkgname}-plugins-runner-remote %{python2_sitelib}/avocado_runner_remote/ %{python2_sitelib}/avocado_framework_plugin_runner_remote-%{version}-py%{python2_version}.egg-info %files -n python2-%{pkgname}-plugins-runner-vm %{python2_sitelib}/avocado_runner_vm/ %{python2_sitelib}/avocado_framework_plugin_runner_vm-%{version}-py%{python2_version}.egg-info %files -n python2-%{pkgname}-plugins-runner-docker %{python2_sitelib}/avocado_runner_docker/ %{python2_sitelib}/avocado_framework_plugin_runner_docker-%{version}-py%{python2_version}.egg-info %if %{with_resultsdb} %files -n python2-%{pkgname}-plugins-resultsdb %{python2_sitelib}/avocado_resultsdb/ %{python2_sitelib}/avocado_framework_plugin_resultsdb-%{version}-py%{python2_version}.egg-info %endif %files -n python2-%{pkgname}-plugins-varianter-yaml-to-mux %{python2_sitelib}/avocado_varianter_yaml_to_mux/ %{python2_sitelib}/avocado_framework_plugin_varianter_yaml_to_mux-%{version}-py%{python2_version}.egg-info %files -n python-%{pkgname}-examples %dir %{_docdir}/avocado %{_docdir}/avocado/tests %{_docdir}/avocado/wrappers %changelog * Tue Mar 19 2019 Merlin Mathesius - 52.1-9 - python2-sphinx is no longer available or needed as of F31 * Tue Feb 05 2019 Merlin Mathesius - 52.1-8 - python2-resultsdb_api package has been removed in F30 as part of https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal so python2-avocado-plugins-resultsdb has also been disabled. * Fri Jul 13 2018 Fedora Release Engineering - 52.1-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Fri Jun 08 2018 Merlin Mathesius - 52.1-6 - Correct libvirt dependency for EPEL7/RHEL7 * Mon Jun 04 2018 Merlin Mathesius - 52.1-5 - Conditionalize python2 dependencies for cross-release compatibility of SPEC * Mon May 14 2018 Merlin Mathesius - 52.1-4 - Dependency fabric has been renamed to python2-fabric3 * Mon May 14 2018 Merlin Mathesius - 52.1-3 - correct python_provide argument typo for varianter-yaml-to-mux plugin * Mon Apr 9 2018 Cleber Rosa - 52.1-2 - Added Fedora CI tests * Tue Apr 03 2018 Merlin Mathesius - 52.1-1 - Sync with upstream release 52.1 (LTS series). - Correct deprecated use of unversioned python. * Mon Mar 26 2018 Iryna Shcherbina - 52.0-5 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) * Fri Feb 09 2018 Fedora Release Engineering - 52.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Wed Aug 09 2017 Merlin Mathesius - 52.0-3 - Fix FTBFS error by disabling selfcheck producing false failures - Update SPEC to use pkgname instead of srcname macro where appropriate * Thu Jul 27 2017 Fedora Release Engineering - 52.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Thu Jun 29 2017 Merlin Mathesius - 52.0-1 - Sync with upstream release 52.0. (BZ#1465409) * Wed Jun 14 2017 Merlin Mathesius - 51.0-1 - Sync with upstream release 51.0. (BZ#1460837) - Disable selftests when libvirt may not be available. * Wed May 17 2017 Merlin Mathesius - 50.0-1 - Sync with upstream release 50.0. (BZ#1431413) - Be explicit about selftest level run on check. * Tue Apr 25 2017 Merlin Mathesius - 49.0-1 - Sync with upstream release 49.0. (BZ#1431413) * Tue Apr 18 2017 Merlin Mathesius - 48.0-1 - Sync with upstream release 48.0. (BZ#1431413) - Allow rel_build macro to be defined outside of the SPEC file. * Mon Mar 27 2017 Merlin Mathesius - 47.0-1 - Sync with upstream release 47.0. - Enable self-tests during build. - Add example test to be run by Taskotron. * Mon Feb 27 2017 Merlin Mathesius - 46.0-2 - Incorporate upstream SPEC file changes to split plugins into subpackages. - Remove obsolete CC-BY-SA license, which went away with the halflings font. * Tue Feb 14 2017 Merlin Mathesius - 46.0-1 - Sync with upstream release 46.0. - Remove halflings license since font was removed from upstream. - SPEC updates to easily switch between release and snapshot builds. * Sat Feb 11 2017 Fedora Release Engineering - 43.0-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Tue Jan 10 2017 Merlin Mathesius - 43.0-7 - SPEC updates to build and install for EPEL. * Mon Nov 21 2016 Merlin Mathesius - 43.0-6 - Initial packaging for Fedora.