[trac-accountmanager-plugin] Add EL-6 compatibility and %check section

Paul Howarth pghmcfc at fedoraproject.org
Fri Jan 7 16:52:52 UTC 2011


commit 49821747c624c31695da867e516f4b44fe817af5
Author: Paul Howarth <paul at city-fan.org>
Date:   Fri Jan 7 16:50:32 2011 +0000

    Add EL-6 compatibility and %check section
    
    - Require python-genshi >= 0.6 or python-genshi06 as per trac itself
    - Go to great trouble to set %lang on translations
    - Help setup.py find Genshi 0.6, which is in an egg for EPEL-6
    - Add %check section and run test suite
    - Patch out errors in test suite
    - BR: trac for trac.test, needed for test suite

 TracAccountManager-0.3dev-r9591-genshi06.patch |   23 ++++++++
 TracAccountManager-0.3dev-r9591-tests.patch    |   26 +++++++++
 trac-accountmanager-plugin.spec                |   65 +++++++++++++++++++++---
 3 files changed, 106 insertions(+), 8 deletions(-)
---
diff --git a/TracAccountManager-0.3dev-r9591-genshi06.patch b/TracAccountManager-0.3dev-r9591-genshi06.patch
new file mode 100644
index 0000000..9358163
--- /dev/null
+++ b/TracAccountManager-0.3dev-r9591-genshi06.patch
@@ -0,0 +1,23 @@
+diff -up TracAccountManager-0.3dev-r9591/setup.py.orig TracAccountManager-0.3dev-r9591/setup.py
+--- TracAccountManager-0.3dev-r9591/setup.py.orig	2010-11-29 00:02:33.000000000 +0000
++++ TracAccountManager-0.3dev-r9591/setup.py	2010-12-24 14:20:28.295037108 +0000
+@@ -6,6 +6,10 @@
+ # can do whatever you want with this stuff. If we meet some day, and you think
+ # this stuff is worth it, you can buy me a beer in return.   Matthew Good
+ 
++
++__requires__ = "Genshi >= 0.6"
++
++import pkg_resources
+ from setuptools import setup
+ 
+ extra = {}
+@@ -48,7 +52,7 @@ setup(
+     },
+     test_suite = 'acct_mgr.tests.suite',
+     zip_safe=True,
+-    install_requires = ['Genshi >= 0.5', 'Trac >= 0.11'],
++    install_requires = ['Genshi >= 0.6', 'Trac >= 0.12'],
+     extras_require = {'Babel': 'Babel>= 0.9.5', 'Trac': 'Trac >= 0.12'},
+     entry_points = {
+         'trac.plugins': [
diff --git a/TracAccountManager-0.3dev-r9591-tests.patch b/TracAccountManager-0.3dev-r9591-tests.patch
new file mode 100644
index 0000000..f3549c6
--- /dev/null
+++ b/TracAccountManager-0.3dev-r9591-tests.patch
@@ -0,0 +1,26 @@
+--- TracAccountManager-0.3dev-r9591/acct_mgr/tests/htfile.py.orig	2010-10-09 20:14:43.000000000 +0100
++++ TracAccountManager-0.3dev-r9591/acct_mgr/tests/htfile.py	2010-12-21 16:31:07.012399185 +0000
+@@ -79,6 +79,7 @@
+         self.assertEqual([], list(self.store.get_users()))
+ 
+     def test_update_password(self):
++        self._init_password_file('test_update_password', '')
+         self.store.set_password('foo', 'pass1')
+         self.assertFalse(self.store.check_password('foo', 'pass2'))
+         self.store.set_password('foo', 'pass2')
+@@ -130,6 +131,7 @@
+         self.assertEqual([], list(self.store.get_users()))
+ 
+     def test_update_password(self):
++        self._init_password_file('test_update_password', '')
+         self.store.set_password('foo', 'pass1')
+         self.assertFalse(self.store.check_password('foo', 'pass2'))
+         self.store.set_password('foo', 'pass2')
+@@ -138,6 +140,7 @@
+         self.assertTrue(self.store.check_password('foo', 'pass3'))
+ 
+     def test_create_hash(self):
++        self._init_password_file('test_create_hash', '')
+         self.env.config.set('account-manager', 'htpasswd_hash_type', 'bad')
+         self.assertTrue(self.store.userline('user',
+                                             'password').startswith('user:'))
diff --git a/trac-accountmanager-plugin.spec b/trac-accountmanager-plugin.spec
index e5ab46a..c55f3db 100644
--- a/trac-accountmanager-plugin.spec
+++ b/trac-accountmanager-plugin.spec
@@ -1,27 +1,41 @@
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%{!?pybasever: %global pybasever %(%{__python} -c "import sys ; print sys.version[:3]" || echo 0.0)}
 
-%global svnrev 9591
+%global svnrev  9591
+%global svndate 20101206
 
 Name:           trac-accountmanager-plugin
 Version:        0.3
-Release:        0.1.20101206svn%{svnrev}%{?dist}
+Release:        0.2.%{svndate}svn%{svnrev}%{?dist}
 Summary:        Trac plugin for account registration and management
-
 Group:          Applications/Internet
 License:        Copyright only
 URL:            http://trac-hacks.org/wiki/AccountManagerPlugin
 Source0:        TracAccountManager-%{version}dev-r%{svnrev}.tar.bz2
 Source1:        pull-from-svn.sh
-
+Patch0:         TracAccountManager-0.3dev-r9591-tests.patch
+Patch1:         TracAccountManager-0.3dev-r9591-genshi06.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
 BuildArch:      noarch
 BuildRequires:  python2-devel
 BuildRequires:  python-setuptools
+
+# This is needed for the test suite
+BuildRequires:  trac >= 0.12
+
+# This package is explicitly for trac 0.12.x
 Requires:       trac >= 0.12
-Requires:       python-genshi >= 0.5
+
+# Required for import of pkg_resources
 Requires:       python-setuptools
 
+# Need at least this version
+%if 0%{?rhel}
+Requires:       python-genshi06
+%else
+Requires:       python-genshi >= 0.6
+%endif
+
 %description
 The AccountManagerPlugin offers several features for managing user accounts:
  * allow users to register new accounts
@@ -34,6 +48,12 @@ The AccountManagerPlugin offers several features for managing user accounts:
 %prep
 %setup -n TracAccountManager-%{version}dev-r%{svnrev} -q
 
+# Fix broken test suite
+%patch0 -p1
+
+# Make sure we can find Genshi >= 0.6 on EL-6, where it's in an egg
+%patch1 -p1
+
 
 %build
 %{__python} setup.py build
@@ -46,6 +66,11 @@ rm -rf %{buildroot}
 # Don't need to package this
 rm %{buildroot}%{python_sitelib}/acct_mgr/locale/.placeholder
 
+
+%check
+%{__python} setup.py test
+
+
 %clean
 rm -rf %{buildroot}
 
@@ -53,11 +78,35 @@ rm -rf %{buildroot}
 %files
 %defattr(-,root,root,-)
 %doc README contrib/sessionstore_convert.py
-%{python_sitelib}/acct_mgr/
-%{python_sitelib}/TracAccountManager-%{version}dev_r%{svnrev}-py*.egg-info/
+%dir %{python_sitelib}/acct_mgr/
+%{python_sitelib}/acct_mgr/*.py*
+%{python_sitelib}/acct_mgr/htdocs/
+%{python_sitelib}/acct_mgr/templates/
+%dir %{python_sitelib}/acct_mgr/locale/
+%dir %{python_sitelib}/acct_mgr/locale/de/
+%dir %{python_sitelib}/acct_mgr/locale/de/LC_MESSAGES/
+%lang(de) %{python_sitelib}/acct_mgr/locale/de/LC_MESSAGES/acct_mgr.mo
+%dir %{python_sitelib}/acct_mgr/locale/es/
+%dir %{python_sitelib}/acct_mgr/locale/es/LC_MESSAGES/
+%lang(es) %{python_sitelib}/acct_mgr/locale/es/LC_MESSAGES/acct_mgr.mo
+%dir %{python_sitelib}/acct_mgr/locale/ja/
+%dir %{python_sitelib}/acct_mgr/locale/ja/LC_MESSAGES/
+%lang(ja) %{python_sitelib}/acct_mgr/locale/ja/LC_MESSAGES/acct_mgr.mo
+%dir %{python_sitelib}/acct_mgr/locale/ru/
+%dir %{python_sitelib}/acct_mgr/locale/ru/LC_MESSAGES/
+%lang(ru) %{python_sitelib}/acct_mgr/locale/ru/LC_MESSAGES/acct_mgr.mo
+%{python_sitelib}/TracAccountManager-%{version}dev_r%{svnrev}-py%{pybasever}.egg-info/
 
 
 %changelog
+* Fri Dec 24 2010 Paul Howarth <paul at city-fan.org> - 0.3-0.2.20101206svn9591
+- Require python-genshi >= 0.6 or python-genshi06 as per trac itself
+- Go to great trouble to set %%lang on translations
+- Help setup.py find Genshi 0.6, which is in an egg for EPEL-6
+- Add %%check section and run test suite
+- Patch out errors in test suite
+- BR: trac for trac.test, needed for test suite
+
 * Tue Dec 14 2010 Paul Howarth <paul at city-fan.org> - 0.3-0.1.20101206svn9591
 - Update to current svn snapshot (from trunk for trac 0.12)
 - Require trac >= 0.12


More information about the scm-commits mailing list