# # spec file for package subunit # # Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define skip_python2 1 %define python_subpackage_only 1 %bcond_with python2 %{?sle15_python_module_pythons} Name: subunit Version: 1.4.2 %global majver %(awk 'BEGIN { OFS="."; FS="[\\.\\+]+" } {print $1, $2, $3}' <<< %{version}) # %%global majver 1.4 Release: 3.12 Summary: C library for the subunit testing protocol License: Apache-2.0 OR BSD-3-Clause Group: Development/Tools/Other URL: https://github.com/testing-cabal/subunit # Source0: %%{name}-%%{version}.tar.xz Source0: https://github.com/testing-cabal/%{name}/archive/refs/tags/%{version}.tar.gz BuildRequires: %{python_module docutils} BuildRequires: %{python_module extras} BuildRequires: %{python_module fixtures} BuildRequires: %{python_module hypothesis} BuildRequires: %{python_module iso8601} BuildRequires: %{python_module pip} BuildRequires: %{python_module testscenarios} BuildRequires: %{python_module testtools >= 1.8.0} BuildRequires: %{python_module wheel} BuildRequires: check-devel BuildRequires: cppunit-devel BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: pkgconfig BuildRequires: python-rpm-macros BuildRequires: perl(ExtUtils::MakeMaker) %python_subpackages %description Subunit C bindings. See the python-subunit package for test processing functionality. %package -n libsubunit0 Summary: Binary libraries for %{name} Group: System/Libraries Requires: %{name}%{?_isa} >= %{version}-%{release} %description -n libsubunit0 Binary libraries for %{name} %package devel Summary: Header files for developing C applications that use subunit Group: Development/Libraries/C and C++ Requires: %{name}%{?_isa} = %{version}-%{release} Requires: libsubunit0 = %{version}-%{release} %description devel Header files and libraries for developing C applications that use subunit. %package -n libcppunit_subunit0 Summary: Subunit integration into cppunit Group: System/Libraries Requires: %{name}%{?_isa} >= %{version}-%{release} %description -n libcppunit_subunit0 Subunit integration into cppunit. %package -n libcppunit_subunit0-devel Summary: Header files for applications that use cppunit and subunit Group: Development/Libraries/C and C++ Requires: cppunit-devel%{?_isa} Requires: libcppunit_subunit0%{?_isa} = %{version}-%{release} Requires: subunit-devel%{?_isa} = %{version}-%{release} %description -n libcppunit_subunit0-devel Header files and libraries for developing applications that use cppunit and subunit. %package -n perl-subunit Summary: Perl bindings for subunit Group: Development/Libraries/Perl Requires: perl-base = %{perl_version} BuildArch: noarch %description -n perl-subunit Subunit Perl bindings. See the python3-python-subunit package for test processing functionality. %package shell Summary: Shell bindings for subunit Group: Development/Libraries/Other BuildArch: noarch %description shell Subunit shell bindings. See the python3-python-subunit package for test processing functionality. %if 0%{?python_subpackage_only} %package -n python-python-%{name} Summary: Streaming protocol for test results Group: Development/Libraries/Python Requires: python-extras Requires: python-testtools >= 1.8.0 BuildArch: noarch %description -n python-python-%{name} Subunit is a streaming protocol for test results. The protocol is a binary encoding that is generated and parsed. By design, all the components of the protocol conceptually fit into the xUnit TestCase -> TestResult interaction. Subunit comes with command line filters to process a subunit stream and language bindings for Python, C, C++ and Shell. Bindings can be written for other languages. A number of useful things can be done easily with subunit: - Test aggregation: Tests run separately can be combined and then reported/displayed together. For instance, tests from different languages can be shown as a seamless whole. - Test archiving: A test run may be recorded and replayed later. - Test isolation: Tests that may crash or otherwise interact badly with each other can be run separately and then aggregated, rather than interfering with each other. - Grid testing: subunit can act as the necessary serialization and deserialization to get test runs on distributed machines to be reported in real time. %else %package -n python3-python-%{name} Summary: Streaming protocol for test results Group: Development/Libraries/Python Requires: python3-extras Requires: python3-testtools >= 1.8.0 BuildArch: noarch %description -n python3-python-%{name} Subunit is a streaming protocol for test results. The protocol is a binary encoding that is generated and parsed. By design, all the components of the protocol conceptually fit into the xUnit TestCase -> TestResult interaction. Subunit comes with command line filters to process a subunit stream and language bindings for Python, C, C++ and Shell. Bindings can be written for other languages. A number of useful things can be done easily with subunit: - Test aggregation: Tests run separately can be combined and then reported/displayed together. For instance, tests from different languages can be shown as a seamless whole. - Test archiving: A test run may be recorded and replayed later. - Test isolation: Tests that may crash or otherwise interact badly with each other can be run separately and then aggregated, rather than interfering with each other. - Grid testing: subunit can act as the necessary serialization and deserialization to get test runs on distributed machines to be reported in real time. %endif %package filters Summary: Command line filters for processing subunit streams Group: Development/Tools/Other Requires: python3-junitxml Requires: python3-python-%{name} = %{version}-%{release} Requires: typelib-1_0-Gtk-3_0 BuildArch: noarch %description filters Command line filters for processing subunit streams. %prep %autosetup -p1 fixtimestamp() { touch -r $1.orig $1 rm $1.orig } # Help the dependency generator for filt in python/subunit/filter_scripts/*; do sed -i.orig '1{\@^#! */usr/bin/env python@d}' $filt touch -r $filt.orig ${filt} rm ${filt}.orig done %build # Generate the configure script autoreconf -fvi export INSTALLDIRS=perl # any python will do, this is only for the non-python part of the package PYTHON=$(find %_bindir -name 'python3*[0-9]' -print -quit) export PYTHON %configure \ --enable-shared \ --disable-static %make_build %pyproject_wheel %install %pyproject_install %{python_expand chmod 0755 %{buildroot}%{$python_sitelib}/%{name}/run.py # Eliminate duplicates rm -fr %{buildroot}%{$python_sitelib}/subunit/tests %fdupes %{buildroot}%{$python_sitelib} } # NON-PYTHON STUFF # We set pkgpython_PYTHON for efficiency to disable automake python compilation %make_install pkgpython_PYTHON='' INSTALL="%{_bindir}/install -p" # Install the shell interface mkdir -p %{buildroot}%{_sysconfdir}/profile.d cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d # Remove unwanted libtool files find %{buildroot} -type f -name "*.la" -delete -print # Fix perl installation mkdir -p %{buildroot}%{perl_vendorlib} mv %{buildroot}%{perl_sitelib}/Subunit* %{buildroot}%{perl_vendorlib} rm -fr %{buildroot}%{perl_archlib} %{buildroot}%{perl_sitearch} # Fix permissions chmod 0755 %{buildroot}%{_bindir}/subunit-diff # Fix timestamps touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h touch -r c++/SubunitTestProgressListener.h \ %{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h touch -r perl/subunit-diff %{buildroot}%{_bindir}/subunit-diff %check %if 0%{?suse_version} > 1500 %{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} PYTHON=%{$python} # https://bugs.launchpad.net/subunit/+bug/1323410 find . -name sample\*.py -exec chmod +x '{}' \; # replace hardcoded python3 with the python executable that is actually used find . -name sample\*.py -exec sed -i "1{s/python3.*$/python%{$python_version}/;}" {} + sed -i '/testtools.run/ s#$(PYTHON)#/usr/bin/python%{$python_version}#' Makefile %make_build check } %endif %post -n libsubunit0 -p /sbin/ldconfig %postun -n libsubunit0 -p /sbin/ldconfig %post -n libcppunit_subunit0 -p /sbin/ldconfig %postun -n libcppunit_subunit0 -p /sbin/ldconfig %files %doc NEWS README.rst %license Apache-2.0 BSD COPYING %files -n libsubunit0 %doc NEWS README.rst %license Apache-2.0 BSD COPYING %{_libdir}/lib%{name}.so.* %files devel %doc c/README %dir %{_includedir}/%{name}/ %{_includedir}/%{name}/child.h %{_libdir}/lib%{name}.so %{_libdir}/pkgconfig/lib%{name}.pc %files -n libcppunit_subunit0 %{_libdir}/libcppunit_%{name}.so.* %files -n libcppunit_subunit0-devel %doc c++/README %{_includedir}/%{name}/SubunitTestProgressListener.h %{_libdir}/libcppunit_%{name}.so %{_libdir}/pkgconfig/libcppunit_%{name}.pc %files -n perl-subunit %license Apache-2.0 BSD COPYING %{_bindir}/%{name}-diff %{perl_vendorlib}/* %files shell %doc shell/README %license Apache-2.0 BSD COPYING %config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh %files %{python_files python-%{name}} %license Apache-2.0 BSD COPYING %{python_sitelib}/%{name}/ %{python_sitelib}/python_%{name}-%{majver}*-info %files filters %{_bindir}/* %exclude %{_bindir}/%{name}-diff %changelog * Thu Jul 13 2023 Johannes Kastl - remove hardcoded python executable names from Makefile and test scripts - Use python_subpackage_only 1 everywhere, not only on Tumbleweed and Leap 15.5 * Mon Jul 3 2023 ecsos - Add %%{?sle15_python_module_pythons} - Use python_subpackage_only 1 from Tumbleweed for Leap 15.5 also. * Fri Mar 24 2023 Johannes Kastl - set PYTHON environment variable in %%build step, to allow builds even if /usr/bin/python3 does not exist * Mon Feb 20 2023 Matej Cepl - Upgrade to 1.4.2: - IMPROVEMENTS * Drop various compatibility wrappers for Python < 3.6. * Add support for Python 3.9 * Add support for Python 3.10 * Drop support for Python 2.7, 3.4, and 3.5 * Convert python scripts to entry_points. * Migrate CI from travis to GitHub actions. * Add options to output filter to set timestamps. * Remove dependency on unittest2. - BUGFIXES * Fix "subunit-filter --fixup-expected-failures" on Python 3. * Fix tests with testtools >= 2.5.0. * Mark rawstrings as such, fixing warnings. - Remove upstreamed patch python38-failing-tests.patch * Mon May 9 2022 mcepl@cepl.eu - Update to version 1.4.0+git.1643134405.a629de4: * Explicitly invoke python3. * Check minimum version of Python in configure.ac. * Add testing for Python 3.10 * Stop using io imports from testtools * Remove logic for Python < 3.6 * Drop support for Python 2.7, 3.5 * Sat Oct 16 2021 mcepl@cepl.eu - Update to version 1.4.0+git.1627548288.c87ffbd: * Update NEWS * Handle different SyntaxError output in testtools 2.5.0 * Sort Content-Type parameters when writing details * Import six from the right place * Pivot CI to github actions * Revert "Merge pull request #17 from mtreinish/timestamp-output" * fix trailing comma * Fix imports from testtools.compat * python: Mark rawstrings as such * run everything on focal, except pypy3.5 which only runs on xenial * add missing reference * add current pythons * drop Python 3.4 support * Unittest from testtools doesn't work, use the one from stdlib. * Acommodate review requests. * Fix timestamp test copy paste error * Add options to output filter to set timestamps * Remove dependency on unittest2 - remove remove_unittest2.patch (upstream) * Mon May 24 2021 Steve Kowalik - Run the subunit filters under python3. - Remove duplicate BuildRequires. * Thu Mar 25 2021 Ben Greiner - Can't assume non-existence of python38 macros in Leap. gh#openSUSE/python-rpm-macros#107 Test for suse_version instead. Only Tumbleweed has and needs the python_subpackage_only support. * Thu Dec 3 2020 Benjamin Greiner - Support multiple python flavors in python subpackage gh#openSUSE/python-rpm-macros#66 * Fri Jun 5 2020 Matej Cepl - Add remove_unittest2.patch to remove dependency on unittest2 * Tue Mar 31 2020 mcepl@cepl.eu - Update to version 1.4.0+git.1584197985.0e9f67b: * Release 1.4.0. * Correctly handle py3 RawIOBase read() * Wed Mar 11 2020 mcepl@cepl.eu - Update to version 1.3.0+git.1583777524.8fb3e0c: * trivial: Fix indentation * Add license to setup.py * Update setup.py * Add support for new python versions and update pkg metadata * Remove broken Python 2.6 travis CI job * Check written bytes are not None before summing them to offset * Fix file open for python3 * Stop running 3.3 on travis. - Switch off building python2 bindings. - Add python38-failing-tests.patch to skip failing tests. * Wed Mar 11 2020 Matej Cepl - Add python38-failing-tests.patch skipping failing tests * Tue Apr 16 2019 Dirk Mueller - fix dependency for subunit-filters * Wed Apr 10 2019 Dirk Mueller - fix package naming of the python subpackages to follow packaging policy * Mon Apr 8 2019 Dirk Mueller - add explicit unittest2 buildrequires * Sat Apr 6 2019 Dirk Mueller - add obsoletes * Sat Apr 6 2019 Dirk Mueller - drop subunit-unbundle-iso8601.patch: there is no room for fedora specific patches in opensuse and the iso8601 pypi module is completely incompatible with that this version, so nothing works - remove-unittest2.patch, subunit-decode-binary-to-unicode.patch needed to get it back to a working state * Sat Apr 6 2019 Dirk Mueller - fix build for older distros by adding the singlespec macros * Mon Mar 18 2019 Matej Cepl - Fix Requires * Tue Mar 12 2019 Matej Cepl - Just Obsolete, don't Conflict as well * Mon Feb 25 2019 Matej Cepl - Add Conflicts to python-* subpackages * Wed Feb 6 2019 Matej Cepl - Clean up the SPEC file and use more macros - Add remove-unittest2.patch to remove necessity to use python-unittest2 BR. - Change all URLs to the new location. * Sun Nov 11 2018 Jan Engelhardt - Fix RPM groups. Trim bias from descriptions. * Mon Oct 29 2018 mcepl@suse.com - Add subunit Python subpackages FIXME: this is without remove-unittest2.patch * Fri Sep 14 2018 Matěj Cepl - Initial effort to repackage originally Fedora package for version 1.3.0.