diff --git a/.python-beaker.metadata b/.python-beaker.metadata new file mode 100644 index 0000000..b7ec92a --- /dev/null +++ b/.python-beaker.metadata @@ -0,0 +1 @@ +72a696854e36e2ea92f4535209e4538baf06caa0 SOURCES/Beaker-1.5.4.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/beaker-anydbm.patch b/SOURCES/beaker-anydbm.patch new file mode 100644 index 0000000..7de82c9 --- /dev/null +++ b/SOURCES/beaker-anydbm.patch @@ -0,0 +1,12 @@ +Index: Beaker-1.5.4/beaker/container.py +=================================================================== +--- Beaker-1.5.4.orig/beaker/container.py ++++ Beaker-1.5.4/beaker/container.py +@@ -1,5 +1,6 @@ + """Container and Namespace classes""" +-import anydbm ++# For python3 (will be converted as import dbsm as anydbm) ++import anydbm as anydbm + import cPickle + import logging + import os diff --git a/SOURCES/beaker-disable-badtest.patch b/SOURCES/beaker-disable-badtest.patch new file mode 100644 index 0000000..9d12fed --- /dev/null +++ b/SOURCES/beaker-disable-badtest.patch @@ -0,0 +1,18 @@ +The current upstream has not fixed an imperfect test that fails if there is any +load on the machine. This renders Beaker unbuildable, so I'm turning it off for +now. + +diff -r 251c42a5f849 tests/test_container.py +--- a/tests/test_container.py Tue Jul 27 11:07:50 2010 -0700 ++++ b/tests/test_container.py Thu Aug 12 17:01:53 2010 -0700 +@@ -109,8 +109,8 @@ + def test_memory_container_3(): + test_memory_container(expiretime=5, delay=2) + +-def test_dbm_container_2(): +- test_dbm_container(expiretime=2) ++#def test_dbm_container_2(): ++# test_dbm_container(expiretime=2) + + def test_dbm_container_3(): + test_dbm_container(expiretime=5, delay=2) diff --git a/SOURCES/beaker-fips-md5.patch b/SOURCES/beaker-fips-md5.patch new file mode 100644 index 0000000..49ab9d2 --- /dev/null +++ b/SOURCES/beaker-fips-md5.patch @@ -0,0 +1,40 @@ +--- beaker/session.py.orig 2010-06-16 21:39:49.000000000 +0200 ++++ beaker/session.py 2013-08-13 13:03:01.662618580 +0200 +@@ -4,7 +4,7 @@ + import time + from datetime import datetime, timedelta + +-from beaker.crypto import hmac as HMAC, hmac_sha1 as SHA1, md5 ++from beaker.crypto import hmac as HMAC, hmac_sha1 as SHA1, sha1 + from beaker.util import pickle + + from beaker import crypto +@@ -121,10 +121,10 @@ + raise + + def _create_id(self): +- self.id = md5( +- md5("%f%s%f%s" % (time.time(), id({}), random.random(), +- getpid())).hexdigest(), +- ).hexdigest() ++ self.id = b64encode( ++ sha1("%f%s%f%s" % (time.time(), id({}), random.random(), ++ getpid())).digest() ++ ).replace('+','-').replace('/','_').rstrip('=') + self.is_new = True + self.last_accessed = None + if self.use_cookies: +@@ -447,10 +447,9 @@ + return pickle.loads(data) + + def _make_id(self): +- return md5(md5( +- "%f%s%f%s" % (time.time(), id({}), random.random(), getpid()) +- ).hexdigest() +- ).hexdigest() ++ return b64encode( ++ sha1("%f%s%f%s" % (time.time(), id({}), random.random(), getpid()) ++ ).digest()).replace('+','-').replace('/','_').rstrip('=') + + def save(self, accessed_only=False): + """Saves the data for this session to persistent storage""" diff --git a/SOURCES/beaker-use-system-paste.patch b/SOURCES/beaker-use-system-paste.patch new file mode 100644 index 0000000..98d34dd --- /dev/null +++ b/SOURCES/beaker-use-system-paste.patch @@ -0,0 +1,58 @@ +diff -up Beaker-1.3.1/beaker/converters.py.bak Beaker-1.3.1/beaker/converters.py +--- Beaker-1.3.1/beaker/converters.py.bak 2008-02-28 16:02:30.000000000 -0500 ++++ Beaker-1.3.1/beaker/converters.py 2010-06-28 20:58:33.032604522 -0400 +@@ -1,26 +1,29 @@ +-# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) +-# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php +-def asbool(obj): +- if isinstance(obj, (str, unicode)): +- obj = obj.strip().lower() +- if obj in ['true', 'yes', 'on', 'y', 't', '1']: +- return True +- elif obj in ['false', 'no', 'off', 'n', 'f', '0']: +- return False +- else: +- raise ValueError( +- "String is not true/false: %r" % obj) +- return bool(obj) ++try: ++ from paste.util.converters import asbool, aslist ++except ImportError: ++ # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) ++ # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php ++ def asbool(obj): ++ if isinstance(obj, (str, unicode)): ++ obj = obj.strip().lower() ++ if obj in ['true', 'yes', 'on', 'y', 't', '1']: ++ return True ++ elif obj in ['false', 'no', 'off', 'n', 'f', '0']: ++ return False ++ else: ++ raise ValueError( ++ "String is not true/false: %r" % obj) ++ return bool(obj) + +-def aslist(obj, sep=None, strip=True): +- if isinstance(obj, (str, unicode)): +- lst = obj.split(sep) +- if strip: +- lst = [v.strip() for v in lst] +- return lst +- elif isinstance(obj, (list, tuple)): +- return obj +- elif obj is None: +- return [] +- else: +- return [obj] ++ def aslist(obj, sep=None, strip=True): ++ if isinstance(obj, (str, unicode)): ++ lst = obj.split(sep) ++ if strip: ++ lst = [v.strip() for v in lst] ++ return lst ++ elif isinstance(obj, (list, tuple)): ++ return obj ++ elif obj is None: ++ return [] ++ else: ++ return [obj] diff --git a/SPECS/python-beaker.spec b/SPECS/python-beaker.spec new file mode 100644 index 0000000..49151ee --- /dev/null +++ b/SPECS/python-beaker.spec @@ -0,0 +1,270 @@ +%if 0%{?fedora} +%global with_python3 1 +%else +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%endif + +%if 0%{?fedora} <= 16 +%{!?python3_version: %global python3_version %(%{__python3} -c 'import sys ; sys.stdout.write("%s.%s" % sys.version_info[:2])')} +%endif + +Name: python-beaker +Version: 1.5.4 +Release: 9%{?dist} +Summary: WSGI middleware layer to provide sessions + +Group: Development/Languages +License: BSD and MIT +URL: http://beaker.groovie.org/ +Source0: http://pypi.python.org/packages/source/B/Beaker/Beaker-%{version}.tar.gz +Patch0: beaker-use-system-paste.patch +Patch1: beaker-disable-badtest.patch +Patch2: beaker-anydbm.patch +# Switch to sha1 from md5 in beaker.session module +# (rhbz#996219) +Patch3: beaker-fips-md5.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +BuildRequires: python2-devel +BuildRequires: python-setuptools +# Needed for the test suite +BuildRequires: python-nose +BuildRequires: python-webtest +Requires: python-paste +%if 0%{?fedora} +Requires: pycryptopp +%else +# neither python-crypto, nor pycryptopp are currently available in RHEL 7.0 (rhbz#997326) +#Requires: python-crypto +%endif + +%if 0%{?with_python3} +BuildRequires: /usr/bin/2to3 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +# Needed for complete test suite +#BuildRequires: python3-webtest +%if 0%{?fedora} > 14 +BuildRequires: python3-nose +%endif +%endif # if with_python3 + +%description +Beaker is a caching library that includes Session and Cache objects built on +Myghty's Container API used in MyghtyUtils. WSGI middleware is also included to +manage Session objects and signed cookies. + +%if 0%{?with_python3} +%package -n python3-beaker +Summary: WSGI middleware layer to provide sessions +Group: Development/Languages +# Paste is not python3 compatible at the moment +#Requires: python3-paste +# Without one of these there's no aes implementation which means there's no way to +# have encrypted cookies. This is a reduction in features over the python2 version. +# Currently there's no working python3 port for either: +# http://allmydata.org/trac/pycryptopp/ticket/35 +# http://lists.dlitz.net/pipermail/pycrypto/2010q2/000253.html +#%if 0%{?fedora} +#Requires: python3-pycryptopp +#%else +#Requires: python3-crypto +#%endif + +%description -n python3-beaker +Beaker is a caching library that includes Session and Cache objects built on +Myghty's Container API used in MyghtyUtils. WSGI middleware is also included to +manage Session objects and signed cookies. +%endif # with_python3 + + +%prep +%setup -q -n Beaker-%{version} +%patch0 -p1 -b .system +%patch1 -p1 -b .badtest +%patch2 -p1 -b .anydbm +%patch3 -p0 + +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif # with_python3 + + +%build +%{__python} setup.py build + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif # with_python3 + + +%install +rm -rf $RPM_BUILD_ROOT +%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd +%endif # with_python3 + + +%check +PYTHONPATH=$(pwd) nosetests + +#%%if 0%{?with_python3} && 0%{?fedora} > 14 +#pushd %{py3dir} +#PYTHONPATH=$(pwd) nosetests-%{python3_version} +#popd +#%%endif + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc LICENSE CHANGELOG +%{python_sitelib}/beaker/ +%{python_sitelib}/Beaker* + +%if 0%{?with_python3} +%files -n python3-beaker +%defattr(-,root,root,-) +%{python3_sitelib}/beaker/ +%{python3_sitelib}/Beaker* +%endif + + +%changelog +* Thu Aug 15 2013 Matej Stuchlik - 1.5.4-9 +- Removed python-crypto from Requires +Resolves: rhbz#997326 + +* Tue Aug 13 2013 Robert Kuska - 1.5.4-8 +- Change beaker.session to use sha1 instead of md5 because of failures in fips mode +Resolves: rhbz#996219 + +* Thu Feb 14 2013 Fedora Release Engineering - 1.5.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Aug 04 2012 David Malcolm - 1.5.4-6 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 + +* Fri Aug 3 2012 David Malcolm - 1.5.4-5 +- remove rhel logic from with_python3 conditional + +* Sat Jul 21 2012 Fedora Release Engineering - 1.5.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Feb 09 2012 Luke Macken - 1.5.4-3 +- Remove the python3-paste dependency. + +* Sat Jan 14 2012 Fedora Release Engineering - 1.5.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Sep 6 2011 Toshio Kuratomi - 1.5.4-1 +- Update to 1.5.4 +- Fix for python3 module and anydbm +- Tried enabling unittests on python3 -- still no joy + +* Tue Feb 08 2011 Fedora Release Engineering - 1.5.3-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Oct 27 2010 Toshio Kuratomi - 1.5.3-8 +- Remove explicit call to 2to3; setup.py handles this + +* Wed Aug 25 2010 Thomas Spura - 1.5.3-7 +- rebuild with python3.2 + http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html + +* Thu Aug 12 2010 Kyle VanderBeek - 1.5.3-6 +- Disable broken test_dbm_container2 test. + +* Wed Jul 21 2010 David Malcolm - 1.5.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Mon Jun 28 2010 Toshio Kuratomi - 1.5.3-4 +- Add Requires for crypto libs so we have encrypted cookies +- Add patch to unbundle file that comes from paste + +* Sun Jun 27 2010 Kyle VanderBeek - 1.5.3-3 +- Add python3 conditionals + +* Thu May 06 2010 Luke Macken - 1.5.3-2 +- Add a python3 subpackage + +* Mon Mar 22 2010 Luke Macken - 1.5.3-1 +- Update to 1.5.3 +- Remove the abspath patch, which was fixed upstream +- Run the test suite + +* Fri Jan 22 2010 Luke Macken - 1.5.1-1 +- Update to 1.5.1 +- Remove beaker-hmac2.4.patch, which made it into 1.4 upstream +- Remove middleware-config.patch which is also upstream + +* Sun Jul 26 2009 Fedora Release Engineering - 1.3.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Jul 21 2009 Kyle VanderBeek - 1.3.1-5 +- Add patch based on upstream hg 403ef7c82d32 for config overwriting that + breaks Pylons unit tests + +* Sat Jun 27 2009 Luke Macken - 1.3.1-4 +- Add a patch to remove the use of __future__.absolute_import in the google + backend + +* Sat Jun 20 2009 Toshio Kuratomi - 1.3.1-3 +- Different hmac patch suitable for upstream inclusion. + +* Tue Jun 02 2009 Luke Macken - 1.3.1-2 +- Add a patch to remove Beaker's use of hashlib on Python2.4, + due to incompatiblities with Python's hmac module (#503772) + +* Sun May 31 2009 Luke Macken - 1.3.1-1 +- Update to 1.3.1 + +* Tue Apr 07 2009 Felix Schwarz - 1.3-1 +- Update to 1.3 + +* Sun Apr 05 2009 Felix Schwarz - 1.2.3-1 +- Update to 1.2.3 + +* Thu Feb 26 2009 Fedora Release Engineering - 1.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Jan 06 2009 Luke Macken - 1.1.3-1 +- Update to 1.1.3 + +* Sat Dec 20 2008 Felix Schwarz - 1.1.2-1 +- Update to 1.1.2 + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 1.0.3-2 +- Rebuild for Python 2.6 + +* Tue Jun 24 2008 Felix Schwarz - 1.0.3-1 +- Update to 1.0.3. + +* Tue Jun 24 2008 Kyle VanderBeek - 0.9.5-1 +- Update to 0.9.5. +- Remove license patch which is now corrected upstream. + +* Mon May 12 2008 Kyle VanderBeek - 0.9.4-4 +- Fix files to not use wildcard, fixing dir ownership + +* Mon May 12 2008 Kyle VanderBeek - 0.9.4-3 +- Corrected license + +* Mon May 12 2008 Kyle VanderBeek - 0.9.4-2 +- More restrictive file includes for safety + +* Sun May 11 2008 Kyle VanderBeek - 0.9.4-1 +- Update to 0.9.4 (security fix) +- Fix rpmlint complaints, add CHANGELOG and LICENSE + +* Wed Apr 9 2008 Kyle VanderBeek - 0.9.3-1 +- Initial version.