Remove python2-subunit subpackage

This commit is contained in:
lyn1001 2020-08-11 16:22:47 +08:00
parent 5fd0e5a245
commit 5b5e0d1f1f

View File

@ -1,60 +1,19 @@
%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%else
%bcond_with python3
%endif
Name: subunit Name: subunit
Version: 1.3.0 Version: 1.3.0
Release: 12 Release: 13
Summary: C bindings for subunit Summary: C bindings for subunit
%global majver %(cut -d. -f-2 <<< %{version})
License: ASL 2.0 or BSD License: ASL 2.0 or BSD
URL: https://launchpad.net/%{name} URL: https://launchpad.net/subunit
Source0: https://launchpad.net/%{name}/trunk/%{majver}/+download/%{name}-%{version}.tar.gz Source0: https://launchpad.net/subunit/trunk/1.3/+download/subunit-%{version}.tar.gz
# Fedora-specific patch: remove the bundled copy of python-iso8601.
Patch0: %{name}-unbundle-iso8601.patch Patch0: %{name}-unbundle-iso8601.patch
# Merged upsteam: https://github.com/testing-cabal/subunit/pull/10
Patch1: %{name}-decode-binary-to-unicode.patch Patch1: %{name}-decode-binary-to-unicode.patch
# Migrate Gtk interface to GObject introspection
# Upstream PR: https://github.com/testing-cabal/subunit/pull/34
Patch2: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch Patch2: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch
# Fix python3
# Upstream PR: https://github.com/testing-cabal/subunit/pull/36
Patch3: 0002-Fix-file-open-for-python3.patch Patch3: 0002-Fix-file-open-for-python3.patch
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators
BuildRequires: perl(ExtUtils::MakeMaker) pkgconfig
BuildRequires: check-devel BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
BuildRequires: cppunit-devel BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: perl-generators
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: pkgconfig
BuildRequires: python2-devel
BuildRequires: python2-hypothesis
BuildRequires: python2-docutils
BuildRequires: python2-extras
BuildRequires: python2-fixtures
BuildRequires: python2-iso8601
BuildRequires: python2-setuptools
BuildRequires: python2-testscenarios
BuildRequires: python2-testtools >= 1.8.0
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: python3-extras
BuildRequires: python3-fixtures
BuildRequires: python3-iso8601
BuildRequires: python3-hypothesis
BuildRequires: python3-setuptools
BuildRequires: python3-testscenarios
BuildRequires: python3-testtools >= 1.8.0 BuildRequires: python3-testtools >= 1.8.0
%endif
%description %description
Subunit C bindings. See the python-subunit package for test processing Subunit C bindings. See the python-subunit package for test processing
functionality. functionality.
@ -62,23 +21,19 @@ functionality.
%package devel %package devel
Summary: Header files for developing C applications that use subunit Summary: Header files for developing C applications that use subunit
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel %description devel
Header files and libraries for developing C applications that use subunit. Header files and libraries for developing C applications that use subunit.
%package cppunit %package cppunit
Summary: Subunit integration into cppunit Summary: Subunit integration into cppunit
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
%description cppunit %description cppunit
Subunit integration into cppunit. Subunit integration into cppunit.
%package cppunit-devel %package cppunit-devel
Summary: Header files for applications that use cppunit and subunit Summary: Header files for applications that use cppunit and subunit
Requires: %{name}-cppunit%{?_isa} = %{version}-%{release} Requires: %{name}-cppunit%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release} Requires: %{name}-devel%{?_isa} = %{version}-%{release} cppunit-devel%{?_isa}
Requires: cppunit-devel%{?_isa}
%description cppunit-devel %description cppunit-devel
Header files and libraries for developing applications that use cppunit Header files and libraries for developing applications that use cppunit
and subunit. and subunit.
@ -87,7 +42,6 @@ and subunit.
Summary: Perl bindings for subunit Summary: Perl bindings for subunit
BuildArch: noarch BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%{perl_version}) Requires: perl(:MODULE_COMPAT_%{perl_version})
%description perl %description perl
Subunit perl bindings. See the python-subunit package for test Subunit perl bindings. See the python-subunit package for test
processing functionality. processing functionality.
@ -95,62 +49,23 @@ processing functionality.
%package shell %package shell
Summary: Shell bindings for subunit Summary: Shell bindings for subunit
BuildArch: noarch BuildArch: noarch
%description shell %description shell
Subunit shell bindings. See the python-subunit package for test Subunit shell bindings. See the python-subunit package for test
processing functionality. processing functionality.
%package -n python2-%{name}
Summary: Streaming protocol for test results
BuildArch: noarch
Requires: python2-extras
Requires: python2-iso8601
Requires: python2-testtools >= 1.8.0
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
Subunit is a streaming protocol for test results. The protocol is a
binary encoding that is easily 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 are easy to
write 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.
%if %{with python3}
%package -n python3-%{name} %package -n python3-%{name}
Summary: Streaming protocol for test results Summary: Streaming protocol for test results
BuildArch: noarch BuildArch: noarch
Requires: python3-extras Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
Requires: python3-iso8601
Requires: python3-testtools >= 1.8.0
%{?python_provide:%python_provide python3-%{name}} %{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name} %description -n python3-%{name}
Subunit is a streaming protocol for test results. The protocol is a Subunit is a streaming protocol for test results. The protocol is a
binary encoding that is easily generated and parsed. By design all the binary encoding that is easily generated and parsed. By design all the
components of the protocol conceptually fit into the xUnit TestCase -> components of the protocol conceptually fit into the xUnit TestCase ->
TestResult interaction. TestResult interaction.
Subunit comes with command line filters to process a subunit stream and Subunit comes with command line filters to process a subunit stream and
language bindings for python, C, C++ and shell. Bindings are easy to language bindings for python, C, C++ and shell. Bindings are easy to
write for other languages. write for other languages.
A number of useful things can be done easily with subunit: A number of useful things can be done easily with subunit:
- Test aggregation: Tests run separately can be combined and then - Test aggregation: Tests run separately can be combined and then
reported/displayed together. For instance, tests from different reported/displayed together. For instance, tests from different
@ -166,92 +81,52 @@ A number of useful things can be done easily with subunit:
%package -n python3-%{name}-test %package -n python3-%{name}-test
Summary: Test code for the python 3 subunit bindings Summary: Test code for the python 3 subunit bindings
BuildArch: noarch BuildArch: noarch
Requires: python3-%{name} = %{version}-%{release} Requires: python3-%{name} = %{version}-%{release} %{name}-filters = %{version}-%{release}
Requires: %{name}-filters = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}-test} %{?python_provide:%python_provide python3-%{name}-test}
# This can be removed when F29 reaches EOL
Obsoletes: python2-%{name}-test < 1.3.0-9 Obsoletes: python2-%{name}-test < 1.3.0-9
Provides: python2-%{name}-test = %{version}-%{release} Provides: python2-%{name}-test = %{version}-%{release}
%description -n python3-%{name}-test %description -n python3-%{name}-test
%{summary}. %{summary}.
%endif
%package filters %package filters
Summary: Command line filters for processing subunit streams Summary: Command line filters for processing subunit streams
BuildArch: noarch BuildArch: noarch
%if %{with python3} Requires: python3-%{name} = %{version}-%{release} python3-gobject gtk3 >= 3.20
Requires: python3-%{name} = %{version}-%{release} Requires: libnotify >= 0.7.7 python3-junitxml
Requires: python3-gobject
Requires: gtk3 >= 3.20
Requires: libnotify >= 0.7.7
Requires: python3-junitxml
%else
Requires: python2-%{name} = %{version}-%{release}
Requires: pygtk2
Requires: python2-junitxml
%endif
%description filters %description filters
Command line filters for processing subunit streams. Command line filters for processing subunit streams.
%package static %package static
Summary: Static C library for subunit Summary: Static C library for subunit
Requires: %{name}-devel%{?_isa} = %{version}-%{release} Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static %description static
Subunit C bindings in a static library, for building statically linked Subunit C bindings in a static library, for building statically linked
test cases. test cases.
%prep %prep
%setup -qc %setup -qc
%patch0 %patch0
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
fixtimestamp() { fixtimestamp() {
touch -r $1.orig $1 touch -r $1.orig $1
rm $1.orig rm $1.orig
} }
# Help the dependency generator
for filt in filters/*; do for filt in filters/*; do
sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new
%if %{with python3}
# Fix filters to use python3
sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new
%endif
chmod 0755 ${filt}.new chmod 0755 ${filt}.new
touch -r $filt ${filt}.new touch -r $filt ${filt}.new
mv -f ${filt}.new $filt mv -f ${filt}.new $filt
done done
# Fix underlinked library
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \ sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
-i Makefile.am -i Makefile.am
# Depend on python2, not just python
sed -i.orig 's,%{_bindir}/python,&2,' python/subunit/run.py
fixtimestamp python/subunit/run.py
# Do not use env
for fil in $(grep -Frl "%{_bindir}/env python"); do for fil in $(grep -Frl "%{_bindir}/env python"); do
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
fixtimestamp $fil fixtimestamp $fil
done done
# Replace bundled code with a symlink
ln -f -s %{python2_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
# Generate the configure script
autoreconf -fi autoreconf -fi
%if %{with python3}
# Prepare to build for python 3
cp -a ../%{name}-%{version} ../python3 cp -a ../%{name}-%{version} ../python3
mv ../python3 . mv ../python3 .
pushd python3 pushd python3
@ -261,58 +136,35 @@ for fil in $(grep -Frl "%{_bindir}/python2"); do
done done
ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
popd popd
%endif
%build %build
# Build for everything except python3
export INSTALLDIRS=perl export INSTALLDIRS=perl
%configure --enable-shared --enable-static %configure --enable-shared --enable-static
# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
# -Wl,--as-needed after all the libraries.
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \ -e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool -i libtool
make %{?_smp_mflags} make %{?_smp_mflags}
%py2_build
# Build for python3
%if %{with python3}
pushd python3 pushd python3
export INSTALLDIRS=perl export INSTALLDIRS=perl
export PYTHON=%{_bindir}/python3 export PYTHON=%{_bindir}/python3
%configure --enable-shared --enable-static %configure --enable-shared --enable-static
# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
# -Wl,--as-needed after all the libraries.
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \ -e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool -i libtool
make %{?_smp_mflags} make %{?_smp_mflags}
%py3_build %py3_build
popd popd
%endif
%install %install
# Install for python 2 first so that the python 3 install overwrites files
%py2_install
%if %{with python3}
pushd python3 pushd python3
%py3_install %py3_install
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
# Patch the test code to look for filters in _bindir
sed -i "s|root, 'filters'|'/usr', 'bin'|" \ sed -i "s|root, 'filters'|'/usr', 'bin'|" \
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py %{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
# Replace bundled code with a symlink again
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \ ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
%{buildroot}%{python3_sitelib}/subunit/iso8601.py %{buildroot}%{python3_sitelib}/subunit/iso8601.py
for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
@ -320,40 +172,16 @@ for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil %{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil
done done
popd popd
%endif
# Patch the test code to look for filters in _bindir
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
%{buildroot}%{python2_sitelib}/%{name}/tests/test_subunit_filter.py
# We set pkgpython_PYTHON for efficiency to disable automake python compilation
%make_install pkgpython_PYTHON='' INSTALL="%{_bindir}/install -p" %make_install pkgpython_PYTHON='' INSTALL="%{_bindir}/install -p"
# Replace bundled code with a symlink again
for fil in iso8601.py iso8601.pyc iso8601.pyo; do
ln -f -s %{python2_sitelib}/iso8601/$fil \
%{buildroot}%{python2_sitelib}/subunit/$fil
done
# Install the shell interface
mkdir -p %{buildroot}%{_sysconfdir}/profile.d mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
# Remove unwanted libtool files
rm -f %{buildroot}%{_libdir}/*.la rm -f %{buildroot}%{_libdir}/*.la
# Fix perl installation
mkdir -p %{buildroot}%{perl_vendorlib} mkdir -p %{buildroot}%{perl_vendorlib}
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib} mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
rm -fr %{buildroot}%{perl_archlib} rm -fr %{buildroot}%{perl_archlib}
# Fix permissions
chmod 0755 %{buildroot}%{python2_sitelib}/%{name}/run.py
chmod 0755 %{buildroot}%{_bindir}/subunit-diff chmod 0755 %{buildroot}%{_bindir}/subunit-diff
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
# Fix timestamps
touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h
touch -r c++/SubunitTestProgressListener.h \ touch -r c++/SubunitTestProgressListener.h \
%{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h %{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h
@ -363,23 +191,11 @@ for fil in filters/*; do
done done
%check %check
# Run the tests for python2
export LD_LIBRARY_PATH=$PWD/.libs
export PYTHONPATH=$PWD/python/subunit:$PWD/python/subunit/tests
make check
# Make sure subunit.iso8601 is importable from buildroot
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -c "import subunit.iso8601"
%if %{with python3} && 0%{?!disable_tests}
# Run the tests for python3
pushd python3 pushd python3
export PYTHON=%{__python3} export PYTHON=%{__python3}
make check make check
# Make sure subunit.iso8601 is importable from buildroot
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601" PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
popd popd
%endif
%ldconfig_scriptlets %ldconfig_scriptlets
%ldconfig_scriptlets cppunit %ldconfig_scriptlets cppunit
@ -414,13 +230,6 @@ popd
%license Apache-2.0 BSD COPYING %license Apache-2.0 BSD COPYING
%config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh %config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh
%files -n python2-%{name}
%license Apache-2.0 BSD COPYING
%{python2_sitelib}/%{name}/
%{python2_sitelib}/python_%{name}-%{version}-*.egg-info
%exclude %{python2_sitelib}/%{name}/tests/
%if %{with python3}
%files -n python3-%{name} %files -n python3-%{name}
%license Apache-2.0 BSD COPYING %license Apache-2.0 BSD COPYING
%{python3_sitelib}/%{name}/ %{python3_sitelib}/%{name}/
@ -429,7 +238,6 @@ popd
%files -n python3-%{name}-test %files -n python3-%{name}-test
%{python3_sitelib}/%{name}/tests/ %{python3_sitelib}/%{name}/tests/
%endif
%files static %files static
%{_libdir}/*.a %{_libdir}/*.a
@ -439,6 +247,9 @@ popd
%exclude %{_bindir}/%{name}-diff %exclude %{_bindir}/%{name}-diff
%changelog %changelog
* Tue Aug 11 2020 yanan li <liyanan032@huawei.com> - 1.3.0-13
- Remove python2-subunit subpackage
* Wed Jun 24 2020 sunguoshuai <sunguoshuai@huawei.com> - 1.3.0-12 * Wed Jun 24 2020 sunguoshuai <sunguoshuai@huawei.com> - 1.3.0-12
- Update to 1.3.0-12 - Update to 1.3.0-12