upgrade to 1.3.0-12

This commit is contained in:
si-gui 2020-06-24 19:20:07 +08:00
parent bedc646e56
commit dacba0b222
4 changed files with 602 additions and 94 deletions

View File

@ -0,0 +1,239 @@
From ad3523fd57d01c9a443e2d1b07215c001d8da91d Mon Sep 17 00:00:00 2001
From: Haikel Guemar <hguemar@fedoraproject.org>
Date: Fri, 30 Nov 2018 14:30:08 +0100
Subject: [PATCH] Migrate Gtk interface to GObject introspection
Filters subunit2gtk and subunit-notify now uses GObject introspection
Both are compatible with python2 and python3
---
filters/subunit-notify | 10 +++---
filters/subunit2gtk | 80 +++++++++++++++++++++---------------------
2 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/filters/subunit-notify b/filters/subunit-notify
index bc833da..71da071 100755
--- a/filters/subunit-notify
+++ b/filters/subunit-notify
@@ -16,15 +16,15 @@
"""Notify the user of a finished test run."""
-import pygtk
-pygtk.require('2.0')
-import pynotify
+import gi
+gi.require_version('Gtk', '3.0')
+from gi.repository import Notify
from testtools import StreamToExtendedDecorator
from subunit import TestResultStats
from subunit.filters import run_filter_script
-if not pynotify.init("Subunit-notify"):
+if not Notify.init("Subunit-notify"):
sys.exit(1)
@@ -39,7 +39,7 @@ def notify_of_result(result):
result.passed_tests,
result.failed_tests,
)
- nw = pynotify.Notification(summary, body)
+ nw = Notify.Notification(summary, body)
nw.show()
diff --git a/filters/subunit2gtk b/filters/subunit2gtk
index 78b4309..5c0ebe3 100755
--- a/filters/subunit2gtk
+++ b/filters/subunit2gtk
@@ -49,9 +49,9 @@ import sys
import threading
import unittest
-import pygtk
-pygtk.require('2.0')
-import gtk, gtk.gdk, gobject
+import gi
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk, GObject
from testtools import StreamToExtendedDecorator
@@ -75,64 +75,64 @@ class GTKTestResult(unittest.TestResult):
self.not_ok_label = None
self.total_tests = None
- self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
self.window.set_resizable(True)
- self.window.connect("destroy", gtk.main_quit)
+ self.window.connect("destroy", Gtk.main_quit)
self.window.set_title("Tests...")
self.window.set_border_width(0)
- vbox = gtk.VBox(False, 5)
+ vbox = Gtk.VBox(False, 5)
vbox.set_border_width(10)
self.window.add(vbox)
vbox.show()
# Create a centering alignment object
- align = gtk.Alignment(0.5, 0.5, 0, 0)
+ align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
vbox.pack_start(align, False, False, 5)
align.show()
# Create the ProgressBar
- self.pbar = gtk.ProgressBar()
+ self.pbar = Gtk.ProgressBar()
align.add(self.pbar)
self.pbar.set_text("Running")
self.pbar.show()
self.progress_model = ProgressModel()
- separator = gtk.HSeparator()
+ separator = Gtk.HSeparator()
vbox.pack_start(separator, False, False, 0)
separator.show()
# rows, columns, homogeneous
- table = gtk.Table(2, 3, False)
+ table = Gtk.Table(2, 3, False)
vbox.pack_start(table, False, True, 0)
table.show()
# Show summary details about the run. Could use an expander.
- label = gtk.Label("Run:")
- table.attach(label, 0, 1, 1, 2, gtk.EXPAND | gtk.FILL,
- gtk.EXPAND | gtk.FILL, 5, 5)
+ label = Gtk.Label(label="Run:")
+ table.attach(label, 0, 1, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
label.show()
- self.run_label = gtk.Label("N/A")
- table.attach(self.run_label, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL,
- gtk.EXPAND | gtk.FILL, 5, 5)
+ self.run_label = Gtk.Label(label="N/A")
+ table.attach(self.run_label, 1, 2, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
self.run_label.show()
- label = gtk.Label("OK:")
- table.attach(label, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL,
- gtk.EXPAND | gtk.FILL, 5, 5)
+ label = Gtk.Label(label="OK:")
+ table.attach(label, 0, 1, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
label.show()
- self.ok_label = gtk.Label("N/A")
- table.attach(self.ok_label, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL,
- gtk.EXPAND | gtk.FILL, 5, 5)
+ self.ok_label = Gtk.Label(label="N/A")
+ table.attach(self.ok_label, 1, 2, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
self.ok_label.show()
- label = gtk.Label("Not OK:")
- table.attach(label, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL,
- gtk.EXPAND | gtk.FILL, 5, 5)
+ label = Gtk.Label(label="Not OK:")
+ table.attach(label, 0, 1, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
label.show()
- self.not_ok_label = gtk.Label("N/A")
- table.attach(self.not_ok_label, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL,
- gtk.EXPAND | gtk.FILL, 5, 5)
+ self.not_ok_label = Gtk.Label(label="N/A")
+ table.attach(self.not_ok_label, 1, 2, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
self.not_ok_label.show()
self.window.show()
@@ -142,7 +142,7 @@ class GTKTestResult(unittest.TestResult):
def stopTest(self, test):
super(GTKTestResult, self).stopTest(test)
- gobject.idle_add(self._stopTest)
+ GObject.idle_add(self._stopTest)
def _stopTest(self):
self.progress_model.advance()
@@ -159,26 +159,26 @@ class GTKTestResult(unittest.TestResult):
super(GTKTestResult, self).stopTestRun()
except AttributeError:
pass
- gobject.idle_add(self.pbar.set_text, 'Finished')
+ GObject.idle_add(self.pbar.set_text, 'Finished')
def addError(self, test, err):
super(GTKTestResult, self).addError(test, err)
- gobject.idle_add(self.update_counts)
+ GObject.idle_add(self.update_counts)
def addFailure(self, test, err):
super(GTKTestResult, self).addFailure(test, err)
- gobject.idle_add(self.update_counts)
+ GObject.idle_add(self.update_counts)
def addSuccess(self, test):
super(GTKTestResult, self).addSuccess(test)
- gobject.idle_add(self.update_counts)
+ GObject.idle_add(self.update_counts)
def addSkip(self, test, reason):
# addSkip is new in Python 2.7/3.1
addSkip = getattr(super(GTKTestResult, self), 'addSkip', None)
if callable(addSkip):
addSkip(test, reason)
- gobject.idle_add(self.update_counts)
+ GObject.idle_add(self.update_counts)
def addExpectedFailure(self, test, err):
# addExpectedFailure is new in Python 2.7/3.1
@@ -186,7 +186,7 @@ class GTKTestResult(unittest.TestResult):
'addExpectedFailure', None)
if callable(addExpectedFailure):
addExpectedFailure(test, err)
- gobject.idle_add(self.update_counts)
+ GObject.idle_add(self.update_counts)
def addUnexpectedSuccess(self, test):
# addUnexpectedSuccess is new in Python 2.7/3.1
@@ -194,7 +194,7 @@ class GTKTestResult(unittest.TestResult):
'addUnexpectedSuccess', None)
if callable(addUnexpectedSuccess):
addUnexpectedSuccess(test)
- gobject.idle_add(self.update_counts)
+ GObject.idle_add(self.update_counts)
def progress(self, offset, whence):
if whence == PROGRESS_PUSH:
@@ -218,12 +218,12 @@ class GTKTestResult(unittest.TestResult):
self.ok_label.set_text(str(self.testsRun - bad))
self.not_ok_label.set_text(str(bad))
-gobject.threads_init()
+GObject.threads_init()
result = StreamToExtendedDecorator(GTKTestResult())
test = ByteStreamToStreamResult(sys.stdin, non_subunit_name='stdout')
# Get setup
-while gtk.events_pending():
- gtk.main_iteration()
+while Gtk.events_pending():
+ Gtk.main_iteration()
# Start IO
def run_and_finish():
test.run(result)
@@ -232,7 +232,7 @@ t = threading.Thread(target=run_and_finish)
t.daemon = True
result.startTestRun()
t.start()
-gtk.main()
+Gtk.main()
if result.decorated.wasSuccessful():
exit_code = 0
else:
--
2.19.2

View File

@ -0,0 +1,36 @@
From 4abf704d1baddda950450ad057c5f4be87804928 Mon Sep 17 00:00:00 2001
From: Quique Llorente <ellorent@redhat.com>
Date: Wed, 26 Dec 2018 14:57:24 +0100
Subject: [PATCH] Fix file open for python3
At python3 there is no "file" the "open" function has to be use to open
a file.
---
python/subunit/filters.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/subunit/filters.py b/python/subunit/filters.py
index 0a0a185..ec7e9f3 100644
--- a/python/subunit/filters.py
+++ b/python/subunit/filters.py
@@ -5,7 +5,7 @@
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -143,7 +143,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward,
if output_path is None:
output_to = sys.stdout
else:
- output_to = file(output_path, 'wb')
+ output_to = open(output_path, 'w')
try:
result = result_factory(output_to)
--
2.19.2

View File

@ -1,5 +1,5 @@
--- a/COPYING.orig 2018-03-24 08:22:44.000000000 -0600
+++ b/COPYING 2018-07-03 15:07:50.241733503 -0600
--- COPYING.orig 2018-03-24 08:22:44.000000000 -0600
+++ COPYING 2018-07-03 15:07:50.241733503 -0600
@@ -29,8 +29,6 @@ Code that has been incorporated into Sub
naturally be under its own license, and will retain that license.
@ -9,8 +9,8 @@
* The runtests.py and python/subunit/tests/TestUtil.py module are GPL test
support modules. They are not installed by Subunit - they are only ever
used on the build machine. Copyright 2004 Canonical Limited.
--- a/Makefile.am.orig 2018-03-24 08:22:44.000000000 -0600
+++ b/Makefile.am 2018-07-03 15:08:08.386499408 -0600
--- Makefile.am.orig 2018-03-24 08:22:44.000000000 -0600
+++ Makefile.am 2018-07-03 15:08:08.386499408 -0600
@@ -16,11 +16,6 @@ EXTRA_DIST = \
perl/lib/Subunit.pm \
perl/lib/Subunit/Diff.pm \
@ -31,8 +31,8 @@
python/subunit/progress_model.py \
python/subunit/run.py \
python/subunit/v2.py \
--- a/README.rst.orig 2018-03-24 08:22:44.000000000 -0600
+++ b/README.rst 2018-07-03 15:08:21.114335195 -0600
--- README.rst.orig 2018-03-24 08:22:44.000000000 -0600
+++ README.rst 2018-07-03 15:08:21.114335195 -0600
@@ -15,9 +15,6 @@
See the COPYING file for full details on the licensing of Subunit.

View File

@ -1,36 +1,87 @@
%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%else
%bcond_with python3
%endif
Name: subunit
Version: 1.3.0
Release: 3
Summary: C and C++ bindings for subunit
Release: 12
Summary: C bindings for subunit
%global majver %(cut -d. -f-2 <<< %{version})
License: ASL 2.0 or BSD
URL: https://launchpad.net/%{name}
Source0: https://launchpad.net/%{name}/trunk/1.3/+download/%{name}-%{version}.tar.gz
Source0: https://launchpad.net/%{name}/trunk/%{majver}/+download/%{name}-%{version}.tar.gz
# Fedora-specific patch: remove the bundled copy of python-iso8601.
Patch0: %{name}-unbundle-iso8601.patch
# Merged upsteam: https://github.com/testing-cabal/subunit/pull/10
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
# Fix python3
# Upstream PR: https://github.com/testing-cabal/subunit/pull/36
Patch3: 0002-Fix-file-open-for-python3.patch
Patch0000: subunit-unbundle-iso8601.patch
Patch0001: subunit-decode-binary-to-unicode.patch
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators perl(ExtUtils::MakeMaker)
BuildRequires: pkgconfig python2-devel python2-hypothesis python2-docutils python2-extras python2-fixtures
BuildRequires: python2-iso8601 python2-setuptools python2-testscenarios python2-testtools >= 1.8.0
BuildRequires: check-devel
BuildRequires: cppunit-devel
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
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios python3-testtools >= 1.8.0
Provides: subunit-cppunit = %{version}-%{release}
Obsoletes: subunit-cppunit < %{version}-%{release}
%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
%endif
%description
Subunit C and C++ bindings. See the python-subunit package for test processing
Subunit C bindings. See the python-subunit package for test processing
functionality.
%package devel
Summary: Header files for developing C and C++ applications that use subunit
Requires: %{name} = %{version}-%{release}
Requires: cppunit-devel%{?_isa}
Provides: subunit-static = %{version}-%{release} subunit-cppunit-devel = %{version}-%{release}
Obsoletes: subunit-static < %{version}-%{release} subunit-cppunit-devel < %{version}-%{release}
Summary: Header files for developing C applications that use subunit
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Header files and libraries for developing C and C++ applications that use subunit.
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}
Requires: cppunit-devel%{?_isa}
%description cppunit-devel
Header files and libraries for developing applications that use cppunit
and subunit.
%package perl
Summary: Perl bindings for subunit
@ -38,153 +89,320 @@ BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%{perl_version})
%description perl
Perl bindings for subunit. Log in to the relevant website for details.
Subunit perl bindings. See the python-subunit package for test
processing functionality.
%package shell
Summary: Shell bindings for subunit
BuildArch: noarch
%description shell
Shell bindings for subunit. Log in to the relevant website for details.
Subunit shell bindings. See the python-subunit package for test
processing functionality.
%package -n python2-%{name}
Summary: Streaming protocol and Command line filters
Summary: Streaming protocol for test results
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}
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 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.
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}
Summary: Streaming protocol for python3 test results
Summary: Streaming protocol for test results
BuildArch: noarch
Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
Requires: python3-extras
Requires: python3-iso8601
Requires: python3-testtools >= 1.8.0
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
Subunit is a streaming protocol for test results. The protocol is a
binary encoding that is easily generated and parsed. Log in to the
relevant website for details.
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
Requires: python3-%{name} = %{version}-%{release}
Requires: %{name}-filters = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}-test}
# This can be removed when F29 reaches EOL
Obsoletes: python2-%{name}-test < 1.3.0-9
Provides: python2-%{name}-test = %{version}-%{release}
%description -n python3-%{name}-test
%{summary}.
%endif
%package filters
Summary: Command line filters for processing subunit streams
BuildArch: noarch
%if %{with python3}
Requires: python3-%{name} = %{version}-%{release}
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
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.
%prep
%autosetup -c -p1
%setup -qc
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
fixtimestamp() {
touch -r $1.orig $1
rm $1.orig
}
# Help the dependency generator
for filt in filters/*; do
sed -i 's,/usr/bin/env ,/usr/bin/,' $filt
chmod 0755 $filt
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
%endif
chmod 0755 ${filt}.new
touch -r $filt ${filt}.new
mv -f ${filt}.new $filt
done
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" -i Makefile.am
# Fix underlinked library
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
-i Makefile.am
sed -i 's,%{_bindir}/python,&2,' python/subunit/run.py
# Depend on python2, not just python
sed -i.orig 's,%{_bindir}/python,&2,' python/subunit/run.py
fixtimestamp python/subunit/run.py
for file in $(grep -Frl "%{_bindir}/env python"); do
sed -i 's,%{_bindir}/env python,%{_bindir}/python2,' $file
# Do not use env
for fil in $(grep -Frl "%{_bindir}/env python"); do
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
fixtimestamp $fil
done
ln -fs %{python2_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
# Replace bundled code with a symlink
ln -f -s %{python2_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
# Generate the configure script
autoreconf -fi
%if %{with python3}
# Prepare to build for python 3
cp -a ../%{name}-%{version} ../python3
mv ../python3 .
cd python3/
for file in $(grep -Frl "%{_bindir}/python2"); do
sed -i 's,\(%{_bindir}/python\)2,\13,' $file
pushd python3
for fil in $(grep -Frl "%{_bindir}/python2"); do
sed -i.orig 's,\(%{_bindir}/python\)2,\13,' $fil
fixtimestamp $fil
done
ln -fs %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
cd ..
ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
popd
%endif
%build
# Build for everything except python3
export INSTALLDIRS=perl
%configure
%configure --enable-shared --enable-static
sed -i 's/^hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=""/gi;
s/^runpath_var=LD_RUN_PATH/runpath_var=DIE_RPATH_DIE/g;s/CC=.g../& -Wl,--as-needed/' libtool
# 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' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool
%make_build
make %{?_smp_mflags}
%py2_build
cd python3/
# Build for python3
%if %{with python3}
pushd python3
export INSTALLDIRS=perl
export PYTHON=%{_bindir}/python3
%configure
%configure --enable-shared --enable-static
sed -i 's/^hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=""/g;
s/^runpath_var=LD_RUN_PATH/runpath_var=DIE_RPATH_DIE/g; s/CC=.g../& -Wl,--as-needed/' libtool
# 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' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool
%make_build
make %{?_smp_mflags}
%py3_build
cd ../
popd
%endif
%install
cd python3/
%py3_install
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
ln -fs %{python3_sitelib}/iso8601/iso8601.py \
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
for file in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
ln -fs %{python3_sitelib}/iso8601/__pycache__/$file \
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$file
done
cd ..
%make_install
# Install for python 2 first so that the python 3 install overwrites files
%py2_install
for file in iso8601.py iso8601.pyc iso8601.pyo; do
ln -fs %{python2_sitelib}/iso8601/$file %{buildroot}%{python2_sitelib}/subunit/$file
%if %{with python3}
pushd python3
%py3_install
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-two-script.py
# Patch the test code to look for filters in _bindir
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
# Replace bundled code with a symlink again
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
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
done
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"
# 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 -d %{buildroot}%{_sysconfdir}/profile.d
# Install the shell interface
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
%delete_la
# Remove unwanted libtool files
rm -f %{buildroot}%{_libdir}/*.la
install -d %{buildroot}%{perl_vendorlib}
# Fix perl installation
mkdir -p %{buildroot}%{perl_vendorlib}
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
rm -rf %{buildroot}%{perl_archlib}
rm -fr %{buildroot}%{perl_archlib}
chmod 0755 %{buildroot}%{python2_sitelib}/%{name}/run.py %{buildroot}%{_bindir}/subunit-diff
# Fix permissions
chmod 0755 %{buildroot}%{python2_sitelib}/%{name}/run.py
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
# 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
for fil in filters/*; do
touch -r $fil %{buildroot}%{_bindir}/$(basename $fil)
done
%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"
cd python3/
%if %{with python3} && 0%{?!disable_tests}
# Run the tests for python3
pushd python3
export PYTHON=%{__python3}
make check
# Make sure subunit.iso8601 is importable from buildroot
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
cd ../
popd
%endif
%ldconfig_scriptlets
%ldconfig_scriptlets cppunit
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc NEWS README.rst
%license Apache-2.0 BSD COPYING
%{_libdir}/lib%{name}.so.*
%{_libdir}/libcppunit_%{name}.so.*
%files devel
%doc c/README c++/README
%doc c/README
%dir %{_includedir}/%{name}/
%{_includedir}/%{name}/child.h
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/lib*.pc
%{_libdir}/*.a
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/lib%{name}.pc
%files cppunit
%{_libdir}/libcppunit_%{name}.so.*
%files cppunit-devel
%doc c++/README
%{_includedir}/%{name}/SubunitTestProgressListener.h
%{_libdir}/libcppunit_%{name}.so
%{_libdir}/pkgconfig/libcppunit_%{name}.pc
%files perl
%license Apache-2.0 BSD COPYING
@ -198,16 +416,31 @@ cd ../
%files -n python2-%{name}
%license Apache-2.0 BSD COPYING
%{_bindir}/*
%{python2_sitelib}/%{name}/
%{python2_sitelib}/python_%{name}-%{version}-*.egg-info
%exclude %{_bindir}/%{name}-diff
%exclude %{python2_sitelib}/%{name}/tests/
%if %{with python3}
%files -n python3-%{name}
%license Apache-2.0 BSD COPYING
%{python3_sitelib}/%{name}/
%{python3_sitelib}/python_%{name}-%{version}-*.egg-info
%exclude %{python3_sitelib}/%{name}/tests/
%files -n python3-%{name}-test
%{python3_sitelib}/%{name}/tests/
%endif
%files static
%{_libdir}/*.a
%files filters
%{_bindir}/*
%exclude %{_bindir}/%{name}-diff
%changelog
* Wed Jun 24 2020 sunguoshuai <sunguoshuai@huawei.com> - 1.3.0-12
- Update to 1.3.0-12
* Thu Dec 5 2019 wanjiankang <wanjiankang@huawei.com> - 1.3.0-3
- Initial RPM