[rt3] Rename rpmbuild option with_tests into with_runtests.

corsepiu corsepiu at fedoraproject.org
Tue Jan 31 04:05:12 UTC 2012


commit 3917e42e74ddf6902dc3bbad3e7437a1b89917e3
Author: Ralf Corsépius <corsepiu at fedoraproject.org>
Date:   Tue Jan 31 05:05:01 2012 +0100

    Rename rpmbuild option with_tests into with_runtests.
    
    - Add rt3-tests subpackage.
    - Add README.tests.
    - Remove removal of ${RT3_LIBDIR}/t (Fixed by upstream).
    - Rework R:/BR:.
    - Use %{__rm} instead of /bin/rm.
    - Misc minor spec file cleanup.

 README.tests |   11 +++++++++
 rt3.spec     |   69 ++++++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 62 insertions(+), 18 deletions(-)
---
diff --git a/README.tests b/README.tests
new file mode 100644
index 0000000..78b6c76
--- /dev/null
+++ b/README.tests
@@ -0,0 +1,11 @@
+Run these tests with a command similar to this:
+
+RT_DBA_USER=root RT_DBA_PASSWORD=<mysql-passwd> /usr/bin/prove t/*.t t/*/*.t
+
+Notes:
+- Most (all?) tests require to be run as "root".
+- Some of these tests were not designed to work outside of rt3's source
+  tree and do not work when being used as a separate test package.
+- Some of these tests are quite "chatty".
+- Failing tests my leave stray files on the filesystem, which will not be
+  automatically deinstalled upon package deinstallation.
diff --git a/rt3.spec b/rt3.spec
index 1a87e6b..d1ca3de 100644
--- a/rt3.spec
+++ b/rt3.spec
@@ -26,10 +26,10 @@
 #	Default: --without
 %bcond_with gpg
 
-# --with tests
+# --with runtests
 #	run testsuite when building the rpm
 #	Default: without (doesn't work in chroots.)
-%bcond_with tests
+%bcond_with runtests
 
 %global RT3_BINDIR		%{_sbindir}
 %global RT3_LIBDIR		%{perl_vendorlib}
@@ -41,13 +41,14 @@
 
 Name:		rt3
 Version:	3.8.11
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	Request tracker 3
 
 Group:		Applications/Internet
 License:	GPLv2+
 URL:		http://www.bestpractical.com/rt
 Source0:	http://www.bestpractical.com/pub/rt/release/rt-%{version}.tar.gz
+Source1:        README.tests
 Source3:	rt3.conf.in
 Source4:	README.fedora.in
 Source5:	rt3.logrotate.in
@@ -149,9 +150,12 @@ BuildRequires: perl(UNIVERSAL::require)
 BuildRequires: perl(XML::RSS) >= 1.05
 %{?with_devel_mode:BuildRequires: perl(XML::Simple)}
 
-%{?with_tests:BuildRequires: perl(DBD::SQLite)}
-%{?with_tests:BuildRequires: perl(DBD::mysql)}
-%{?with_tests:BuildRequires: perl(DBD::Pg)}
+%{?with_runtests:BuildRequires: perl(DBD::SQLite)}
+%{?with_runtests:BuildRequires: perl(DBD::mysql)}
+%{?with_runtests:BuildRequires: perl(DBD::Pg)}
+%{?with_runtests:BuildRequires: perl(Log::Dispatch::Perl)}
+%{?with_runtests:BuildRequires: perl(Test::WWW::Mechanize)}
+%{?with_runtests:BuildRequires: perl(Test::Expect)}
 
 BuildRequires:	/usr/bin/pod2man
 BuildRequires:	/usr/sbin/apachectl
@@ -165,16 +169,19 @@ BuildRequires:  /usr/share/fonts/google-droid/DroidSans.ttf
 
 Requires:  perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
 
-Requires(postun): /bin/rm
+Requires(postun): %{__rm}
 
 # rpm doesn't catch these:
 Requires: perl(Apache::Session)
 Requires: perl(Calendar::Simple)
 Requires: perl(Data::ICal)
 Requires: perl(Data::ICal::Entry::Event)
+Requires: perl(Email::Address)
+Requires: perl(File::Find)
 %{?with_gd:Requires: perl(GD::Text)}
 %{?with_gd:Requires: perl(GD::Graph::bars)}
 %{?with_gd:Requires: perl(GD::Graph::pie)}
+%{?with_gpg: Requires: perl(GnuPG::Interface)}
 Requires: perl(I18N::LangTags::List)
 Requires: perl(Locale::Maketext::Fuzzy)
 Requires: perl(LWP::MediaTypes)
@@ -182,7 +189,6 @@ Requires: perl(mod_perl2)
 Requires: perl(Module::Versions::Report)
 Requires: perl(Text::Quoted)
 Requires: perl(Text::WikiFormat)
-Requires: perl(Tree::Simple)
 Requires: perl(URI::URL)
 Requires: perl(XML::RSS)
 
@@ -210,6 +216,20 @@ Requires: rt3-mailgate
 %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(HTML::Mason
 %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(IO::Handle::CRLF\\)$
 
+%tests_req perl(HTML::Mason::Compiler)
+%tests_req perl(HTML::Mason::Compiler::ToObject)
+%tests_req perl(RT::Test)
+%tests_req perl(Test::HTTP::Server::Simple::StashWarnings)
+%tests_req perl(DBD::SQLite)
+%tests_req perl(Test::Deep)
+# Required by the testsuite, but test doesn't work outside of source-tree: %%tests_req perl(Test::Pod) >= 1.14
+%tests_req perl(Test::Expect)
+%tests_req perl(Test::MockTime)
+%tests_req perl(Test::Warn)
+%tests_req perl(GnuPG::Interface) perl(PerlIO::eol)
+
+%{?perl_subpackage_tests:%perl_subpackage_tests t/ README.tests}
+
 %description
 RT is an enterprise-grade ticketing system which enables a group of people
 to intelligently and efficiently manage tasks, issues, and requests submitted
@@ -228,10 +248,11 @@ Requires:	perl(HTML::FormatText)
 
 %if %{with devel_mode}
 %package -n perl-RT-Test
-Summary: rt3's test utility.
+Summary: rt3's test utility module
 Group:   Applications/Internet
 Requires:	rt3 = %{version}-%{release}
 Requires:	perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Requires:       perl(Log::Dispatch::Perl)
 
 %description -n perl-RT-Test
 %{summary}
@@ -249,10 +270,10 @@ sed -e 's, at RT3_LOGDIR@,%{RT3_LOGDIR},' %{SOURCE5} \
 find \( -type f -a -executable \) -exec chmod a-x {} \;
 chmod +x configure install-sh
 
-# Upstream tarball contains temporary autotools-files.
+# Upstream tarball contains temporary autotools-files
 rm -rf autom4te.cache config.log config.status
 
-# Fixup the tarball containing generated files
+# Upstream tarball contains configure-time generated files
 find bin sbin etc -name '*.in' | while read a; do d=$(echo "$a" | sed 's,\.in$,,'); rm "$d"; done
 
 %patch0 -p1
@@ -292,6 +313,9 @@ sed -i \
 	-e 's,-o $(BIN_OWNER) -g $(RTGROUP),,g' \
 Makefile.in
 
+# Copy README.tests into '.', such that %%perl_subpackage_tests picks it up.
+cp %{SOURCE1} .
+
 %build
 %configure \
 --with-apachectl=/usr/sbin/apachectl \
@@ -325,9 +349,6 @@ rm -f ${RPM_BUILD_ROOT}%{RT3_BINDIR}/mason_handler.svc
 # We don't want CPAN
 rm -f ${RPM_BUILD_ROOT}%{_sbindir}/rt-test-dependencies
 
-# An installed testsuite without infrastructure
-rm -rf ${RPM_BUILD_ROOT}%{RT3_LIBDIR}/t
-
 # Bogus
 rm -f ${RPM_BUILD_ROOT}%{RT3_LIBDIR}/RT.pm.in
 
@@ -380,14 +401,17 @@ find ${RPM_BUILD_ROOT}%{RT3_WWWDIR} \
 # The tests don't work:
 # - Require to be run as root
 # - Require an operational rt3 system
-# - Require packages which are n/a in Fedora
-%{?with_tests:make test}
+%{?with_runtests:make test}
 
 %postun
 if [ $1 -eq 0 ]; then
-  /bin/rm -rf %{RT3_CACHEDIR}
+  %{__rm} -rf %{RT3_CACHEDIR}
 fi
 
+%postun tests
+if [ $1 -eq 0 ]; then
+  %{__rm} -rf %{perl_testdir}/%{cpan_dist_name}
+fi
 
 %files
 %defattr(-,root,root,-)
@@ -441,6 +465,15 @@ fi
 %endif
 
 %changelog
+* Mon Jan 30 2012 Ralf Corsépius <corsepiu at fedoraproject.org> - 3.8.11-4
+- Rename rpmbuild option with_tests into with_runtests.
+- Add rt3-tests subpackage.
+- Add README.tests.
+- Remove removal of ${RT3_LIBDIR}/t (Fixed by upstream).
+- Rework R:/BR:.
+- Use %%{__rm} instead of /bin/rm.
+- Misc minor spec file cleanup.
+
 * Wed Jan 18 2012 Ralf Corsépius <corsepiu at fedoraproject.org> - 3.8.11-3
 - Fix typo in filter rules.
 - Add lexdir, manualdir, RT3_LEXDIR.
@@ -489,7 +522,7 @@ fi
 
 * Fri May 07 2010 Ralf Corsépius <corsepiu at fedoraproject.org> - 3.8.8-1
 - Upstream update.
-- Add %{_datadir}/rt3/fonts
+- Add %%{_datadir}/rt3/fonts
 - Use system-wide google-droid-fonts instead of bundled 
   Droid fonts.
 - Add rt-3.8.8-Makefile.diff.



More information about the perl-devel mailing list