subunit/subunit.spec

314 lines
11 KiB
RPMSpec
Raw Permalink Normal View History

2021-09-07 10:09:36 +08:00
%define _unpackaged_files_terminate_build 0
Name: subunit
Version: 1.4.0
Release: 3
2021-09-07 10:09:36 +08:00
Summary: C bindings for subunit
License: ASL 2.0 or BSD
URL: https://launchpad.net/subunit
2021-09-11 10:08:18 +08:00
Source0: https://github.com/testing-cabal/subunit/archive/%{version}/%{name}-%{version}.tar.gz
2021-09-07 10:09:36 +08:00
Patch0: %{name}-unbundle-iso8601.patch
Patch1: %{name}-decode-binary-to-unicode.patch
Patch2: 0001-port-to-python-iso8601-0.1.14.patch
Patch3: fix-subunit-notify-command-warning.patch
2021-09-07 10:09:36 +08:00
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators make
BuildRequires: perl(ExtUtils::MakeMaker) pkgconfig
2021-09-11 10:08:18 +08:00
BuildRequires: python2-devel python2-hypothesis python2-docutils python2-extras python2-fixtures
BuildRequires: python2-iso8601 python2-setuptools python2-testscenarios python2-testtools >= 1.8.0
2021-09-07 10:09:36 +08:00
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios
BuildRequires: python3-testtools >= 1.8.0
2019-12-09 19:58:38 +08:00
%description
2021-09-07 10:09:36 +08:00
Subunit C bindings. See the python-subunit package for test processing
2019-12-09 19:58:38 +08:00
functionality.
%package devel
2021-09-07 10:09:36 +08:00
Summary: Header files for developing C applications that use subunit
Requires: %{name}%{?_isa} = %{version}-%{release}
2019-12-09 19:58:38 +08:00
%description devel
2021-09-07 10:09:36 +08:00
Header files and libraries for developing C applications that use subunit.
%package cppunit
Summary: Subunit integration into cppunit
Requires: %{name}%{?_isa} = %{version}-%{release}
%description cppunit
Subunit integration into cppunit.
%package cppunit-devel
Summary: Header files for applications that use cppunit and subunit
Requires: %{name}-cppunit%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release} cppunit-devel%{?_isa}
%description cppunit-devel
Header files and libraries for developing applications that use cppunit
and subunit.
2019-12-09 19:58:38 +08:00
%package perl
2021-09-07 10:09:36 +08:00
Summary: Perl bindings for subunit
BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%{perl_version})
2019-12-09 19:58:38 +08:00
%description perl
2021-09-07 10:09:36 +08:00
Subunit perl bindings. See the python-subunit package for test
processing functionality.
2019-12-09 19:58:38 +08:00
%package shell
2021-09-07 10:09:36 +08:00
Summary: Shell bindings for subunit
BuildArch: noarch
2019-12-09 19:58:38 +08:00
%description shell
2021-09-07 10:09:36 +08:00
Subunit shell bindings. See the python-subunit package for test
processing functionality.
2019-12-09 19:58:38 +08:00
2021-09-11 10:08:18 +08:00
%package -n python2-%{name}
Summary: Streaming protocol and Command line filters
BuildArch: noarch
Requires: python2-extras python2-iso8601 python2-testtools >= 1.8.0
Requires: pygtk2 python2-junitxml
Provides: subunit-filters = %{version}-%{release}
Obsoletes: subunit-filters < %{version}-%{release}
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
Subunit is a streaming protocol for test results. The package provides two functions,
one function is that streaming protocol for test results, another is that command line
filters for processing subunit streams. Log in to the relevant website for details.
2019-12-09 19:58:38 +08:00
%package -n python3-%{name}
2021-09-07 10:09:36 +08:00
Summary: Streaming protocol for test results
BuildArch: noarch
Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
2019-12-09 19:58:38 +08:00
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
Subunit is a streaming protocol for test results. The protocol is a
2021-09-07 10:09:36 +08:00
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.
%package -n python3-%{name}-test
Summary: Test code for the python 3 subunit bindings
BuildArch: noarch
2021-09-11 10:08:18 +08:00
Requires: python3-%{name} = %{version}-%{release}
2021-09-07 10:09:36 +08:00
%{?python_provide:%python_provide python3-%{name}-test}
Obsoletes: python3-%{name}-test < 1.3.0-9
Provides: python3-%{name}-test = %{version}-%{release}
%description -n python3-%{name}-test
%{summary}.
%package filters
Summary: Command line filters for processing subunit streams
BuildArch: noarch
2021-09-11 10:08:18 +08:00
Requires: python2-%{name} = %{version}-%{release} pygtk2 python2-junitxml
2021-09-07 10:09:36 +08:00
%description filters
Command line filters for processing subunit streams.
%package static
Summary: Static C library for subunit
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
Subunit C bindings in a static library, for building statically linked
test cases.
2019-12-09 19:58:38 +08:00
%prep
2021-09-07 10:09:36 +08:00
%autosetup -n %{name}-%{version} -S git
2021-09-11 10:08:18 +08:00
2021-09-07 10:09:36 +08:00
fixtimestamp() {
touch -r $1.orig $1
rm $1.orig
}
2021-09-11 10:08:18 +08:00
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
-i Makefile.am
2019-12-09 19:58:38 +08:00
for filt in filters/*; do
2021-09-07 10:09:36 +08:00
sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new
sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new
chmod 0755 ${filt}.new
touch -r $filt ${filt}.new
mv -f ${filt}.new $filt
2019-12-09 19:58:38 +08:00
done
2021-09-11 10:08:18 +08:00
2021-09-07 10:09:36 +08:00
for fil in $(grep -Frl "%{_bindir}/env python"); do
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
fixtimestamp $fil
2019-12-09 19:58:38 +08:00
done
2021-09-11 10:08:18 +08:00
ln -fs %{python2_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
2019-12-09 19:58:38 +08:00
autoreconf -fi
2021-09-11 10:08:18 +08:00
2019-12-09 19:58:38 +08:00
cp -a ../%{name}-%{version} ../python3
mv ../python3 .
2021-09-07 10:09:36 +08:00
pushd python3
for fil in $(grep -Frl "%{_bindir}/python2"); do
sed -i.orig 's,\(%{_bindir}/python\)2,\13,' $fil
fixtimestamp $fil
2019-12-09 19:58:38 +08:00
done
2021-09-11 10:08:18 +08:00
ln -fs %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
2021-09-07 10:09:36 +08:00
popd
2019-12-09 19:58:38 +08:00
%build
export INSTALLDIRS=perl
2021-09-11 10:08:18 +08:00
export PYTHON=%{_bindir}/python2
2021-09-07 10:09:36 +08:00
%configure --enable-shared --enable-static
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|CC=.g..|& -Wl,--as-needed|' \
-i libtool
2021-09-11 10:08:18 +08:00
%make_build
%py2_build
2021-09-07 10:09:36 +08:00
pushd python3
2019-12-09 19:58:38 +08:00
export INSTALLDIRS=perl
export PYTHON=%{_bindir}/python3
2021-09-07 10:09:36 +08:00
%configure --enable-shared --enable-static
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|CC=.g..|& -Wl,--as-needed|' \
-i libtool
make %{?_smp_mflags}
2019-12-09 19:58:38 +08:00
%py3_build
2021-09-07 10:09:36 +08:00
popd
2019-12-09 19:58:38 +08:00
%install
2021-09-07 10:09:36 +08:00
pushd python3
2019-12-09 19:58:38 +08:00
%py3_install
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
2021-09-07 10:09:36 +08:00
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
2019-12-09 19:58:38 +08:00
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
2021-09-07 10:09:36 +08:00
for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
ln -f -s %{python3_sitelib}/iso8601/__pycache__/$fil \
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil
2019-12-09 19:58:38 +08:00
done
2021-09-07 10:09:36 +08:00
popd
2021-09-11 10:08:18 +08:00
2021-09-07 10:09:36 +08:00
%make_install INSTALL="%{_bindir}/install -p"
2021-09-11 10:08:18 +08:00
%py2_install
for file in iso8601.py iso8601.pyc iso8601.pyo; do
ln -fs %{python2_sitelib}/iso8601/$file %{buildroot}%{python2_sitelib}/subunit/$file
done
install -d %{buildroot}%{_sysconfdir}/profile.d
2019-12-09 19:58:38 +08:00
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
2021-09-11 10:08:18 +08:00
%delete_la
2021-09-07 10:09:36 +08:00
mkdir -p %{buildroot}%{perl_vendorlib}
2019-12-09 19:58:38 +08:00
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
2021-09-07 10:09:36 +08:00
rm -fr %{buildroot}%{perl_archlib}
2021-09-11 10:08:18 +08:00
chmod 0755 %{buildroot}%{python2_sitelib}/%{name}/run.py
2021-09-07 10:09:36 +08:00
chmod 0755 %{buildroot}%{_bindir}/subunit-diff
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
2021-09-11 10:08:18 +08:00
2021-09-07 10:09:36 +08:00
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
for fil in filters/*; do
touch -r $fil %{buildroot}%{_bindir}/$(basename $fil)
done
2019-12-09 19:58:38 +08:00
%check
2021-09-11 10:08:18 +08:00
export LD_LIBRARY_PATH=$PWD/.libs
export PYTHONPATH=$PWD/python/subunit:$PWD/python/subunit/tests
make check
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -c "import subunit.iso8601"
2021-09-07 10:09:36 +08:00
pushd python3
2019-12-09 19:58:38 +08:00
export PYTHON=%{__python3}
make check
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
2021-09-07 10:09:36 +08:00
popd
%ldconfig_scriptlets
%ldconfig_scriptlets cppunit
2019-12-09 19:58:38 +08:00
%files
%doc NEWS README.rst
%license Apache-2.0 BSD COPYING
%{_libdir}/lib%{name}.so.*
%files devel
2021-09-07 10:09:36 +08:00
%doc c/README
2019-12-09 19:58:38 +08:00
%dir %{_includedir}/%{name}/
%{_includedir}/%{name}/child.h
2021-09-07 10:09:36 +08:00
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/lib%{name}.pc
%files cppunit
%{_libdir}/libcppunit_%{name}.so.*
%files cppunit-devel
%doc c++/README
2019-12-09 19:58:38 +08:00
%{_includedir}/%{name}/SubunitTestProgressListener.h
2021-09-07 10:09:36 +08:00
%{_libdir}/libcppunit_%{name}.so
%{_libdir}/pkgconfig/libcppunit_%{name}.pc
2019-12-09 19:58:38 +08:00
%files perl
%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
2021-09-11 10:08:18 +08:00
%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/
2019-12-09 19:58:38 +08:00
%files -n python3-%{name}
%license Apache-2.0 BSD COPYING
%{python3_sitelib}/%{name}/
%{python3_sitelib}/python_%{name}-%{version}-*.egg-info
2021-09-07 10:09:36 +08:00
%exclude %{python3_sitelib}/%{name}/tests/
%files -n python3-%{name}-test
%{python3_sitelib}/%{name}/tests/
%files static
%{_libdir}/*.a
%files filters
%{_bindir}/*
%exclude %{_bindir}/%{name}-diff
2019-12-09 19:58:38 +08:00
%changelog
* Sat Oct 9 2021 huanghaitao <huanghaitao8@huawei.com> - 1.4.0-3
- Add Requires: python2-gobject-base libnotify >= 0.7.7
- fix command subunit-notify subunit2gtk --help error
- fix command subunit-notify warning
2021-09-11 10:08:18 +08:00
* Sat Sep 11 2021 baizhonggui <baizhonggui@huawei.com> - 1.4.0-2
- New add sub python2 package
2021-09-07 10:09:36 +08:00
* Tue Sep 7 2021 baizhonggui <baizhonggui@huawei.com> - 1.4.0-1
- Upgrade to 1.4.0
* Fri Dec 4 2020 Ge Wang <wangge20@huawei.com> - 1.3.0-4
- Fix test case to solve check failure
2019-12-09 19:58:38 +08:00
* Thu Dec 5 2019 wanjiankang <wanjiankang@huawei.com> - 1.3.0-3
- Initial RPM