rpms/python-beaker/F-11 beaker-hmac2.4.patch, NONE, 1.1 python-beaker-absimport.patch, NONE, 1.1 python-beaker-middleware-config.patch, NONE, 1.1 .cvsignore, 1.8, 1.9 python-beaker.spec, 1.9, 1.10 sources, 1.8, 1.9

Kyle VanderBeek kylev at fedoraproject.org
Thu Jul 30 19:02:44 UTC 2009


Author: kylev

Update of /cvs/pkgs/rpms/python-beaker/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30774

Modified Files:
	.cvsignore python-beaker.spec sources 
Added Files:
	beaker-hmac2.4.patch python-beaker-absimport.patch 
	python-beaker-middleware-config.patch 
Log Message:
Begin back-porting Pylons 0.9.7 prereqs to F-11

beaker-hmac2.4.patch:
 crypto/pbkdf2.py |   12 ++++++++----
 session.py       |   26 ++++++++++++++++++++------
 2 files changed, 28 insertions(+), 10 deletions(-)

--- NEW FILE beaker-hmac2.4.patch ---
diff -up Beaker-1.3.1/beaker/crypto/pbkdf2.py.hmac Beaker-1.3.1/beaker/crypto/pbkdf2.py
--- Beaker-1.3.1/beaker/crypto/pbkdf2.py.hmac	2008-09-19 16:49:24.000000000 -0700
+++ Beaker-1.3.1/beaker/crypto/pbkdf2.py	2009-06-20 12:05:47.994184824 -0700
@@ -79,12 +79,16 @@ try:
 except ImportError:
     # PyCrypto not available.  Use the Python standard library.
     import hmac as HMAC
-    try:
-        from hashlib import sha1 as SHA1
-    except ImportError:
+    import sys
+    # When using the stdlib, we have to make sure the hmac version and sha
+    # version are compatible
+    if sys.version_info[0:2] <= (2,4):
+        # hmac in python2.4 or less require the sha module
+        import sha as SHA1
+    else:
         # NOTE: We have to use the callable with hashlib (hashlib.sha1),
         # otherwise hmac only accepts the sha module object itself
-        import sha as SHA1
+        from hashlib import sha1 as SHA1
 
 def strxor(a, b):
     return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b)])
diff -up Beaker-1.3.1/beaker/session.py.hmac Beaker-1.3.1/beaker/session.py
--- Beaker-1.3.1/beaker/session.py.hmac	2009-05-05 09:58:19.000000000 -0700
+++ Beaker-1.3.1/beaker/session.py	2009-06-20 12:04:36.435934313 -0700
@@ -6,12 +6,26 @@ import random
 import time
 from datetime import datetime, timedelta
 try:
-    from hashlib import md5, sha1
+    from hashlib import md5
 except ImportError:
     from md5 import md5
-    # NOTE: We have to use the callable with hashlib (hashlib.sha1),
-    # otherwise hmac only accepts the sha module object itself
-    import sha as sha1
+try:
+    # Use PyCrypto (if available)
+    from Crypto.Hash import HMAC, SHA as SHA1
+
+except ImportError:
+    # PyCrypto not available.  Use the Python standard library.
+    import hmac as HMAC
+    import sys
+    # When using the stdlib, we have to make sure the hmac version and sha
+    # version are compatible
+    if sys.version_info[0:2] <= (2,4):
+        # hmac in python2.4 or less require the sha module
+        import sha as SHA1
+    else:
+        # NOTE: We have to use the callable with hashlib (hashlib.sha1),
+        # otherwise hmac only accepts the sha module object itself
+        from hashlib import sha1 as SHA1
 
 # Check for pycryptopp encryption for AES
 try:
@@ -37,14 +51,14 @@ class SignedCookie(Cookie.BaseCookie):
     
     def value_decode(self, val):
         val = val.strip('"')
-        sig = hmac.new(self.secret, val[40:], sha1).hexdigest()
+        sig = HMAC.new(self.secret, val[40:], SHA1).hexdigest()
         if sig != val[:40]:
             return None, val
         else:
             return val[40:], val
     
     def value_encode(self, val):
-        sig = hmac.new(self.secret, val, sha1).hexdigest()
+        sig = HMAC.new(self.secret, val, SHA1).hexdigest()
         return str(val), ("%s%s" % (sig, val))
 
 

python-beaker-absimport.patch:
 google.py |    1 -
 1 file changed, 1 deletion(-)

--- NEW FILE python-beaker-absimport.patch ---
--- beaker/ext/google.py.orig	2009-06-27 13:57:33.000000000 -0400
+++ beaker/ext/google.py	2009-06-27 13:57:37.000000000 -0400
@@ -1,4 +1,3 @@
-from __future__ import absolute_import
 import cPickle
 import logging
 from datetime import datetime

python-beaker-middleware-config.patch:
 middleware.py |   11 +++++++----
 util.py       |    9 ++++++---
 2 files changed, 13 insertions(+), 7 deletions(-)

--- NEW FILE python-beaker-middleware-config.patch ---
# HG changeset patch -- Bitbucket.org
# Project beaker
# URL http://bitbucket.org/bbangert/beaker/overview/
# User Ben Bangert <ben at groovie.org>
# Date 1245698939 25200
# Node ID 403ef7c82d328c7c0057cde5510a387d830e1595
# Parent 9d0c12f93b4d65771e243fd96e81b40e137843cd
* Fixed bug with CacheMiddleware overwriting configuration with default
  arguments despite prior setting.

--- a/beaker/util.py
+++ b/beaker/util.py
@@ -304,12 +304,15 @@ def coerce_cache_params(params):
     return verify_rules(params, rules)
 
 
-def parse_cache_config_options(config):
+def parse_cache_config_options(config, include_defaults=True):
     """Parse configuration options and validate for use with the
     CacheManager"""
     # Load default cache options
-    options= dict(type='memory', data_dir=None, expire=None, 
-                       log_file=None)
+    if include_defaults:
+        options= dict(type='memory', data_dir=None, expire=None, 
+                           log_file=None)
+    else:
+        options = {}
     for key, val in config.iteritems():
         if key.startswith('beaker.cache.'):
             options[key[13:]] = val

--- a/beaker/middleware.py
+++ b/beaker/middleware.py
@@ -47,11 +47,14 @@ class CacheMiddleware(object):
         
         self.options = {}
         
-        # Pull out any config args starting with beaker cache. if there are any
-        for dct in [config, kwargs]:
-            parsed_opts = parse_cache_config_options(dct)
-            self.options.update(parsed_opts)
+        # Update the options with the parsed config
+        self.options.update(parse_cache_config_options(config))
         
+        # Add any options from kwargs, but leave out the defaults this
+        # time
+        self.options.update(
+            parse_cache_config_options(kwargs, include_defaults=False))
+                
         # Assume all keys are intended for cache if none are prefixed with
         # 'cache.'
         if not self.options and config:



Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/python-beaker/F-11/.cvsignore,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- .cvsignore	7 Apr 2009 06:26:05 -0000	1.8
+++ .cvsignore	30 Jul 2009 19:02:43 -0000	1.9
@@ -1 +1 @@
-Beaker-1.3.tar.gz
+Beaker-1.3.1.tar.gz


Index: python-beaker.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-beaker/F-11/python-beaker.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- python-beaker.spec	7 Apr 2009 06:26:05 -0000	1.9
+++ python-beaker.spec	30 Jul 2009 19:02:43 -0000	1.10
@@ -1,8 +1,8 @@
 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
 Name: python-beaker
-Version: 1.3
-Release: 1%{?dist}
+Version: 1.3.1
+Release: 6%{?dist}
 Summary: WSGI middleware layer to provide sessions
 
 Group: Development/Languages
@@ -12,6 +12,9 @@ Source0: http://pypi.python.org/packages
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
 BuildRequires: python-setuptools-devel
+Patch0: beaker-hmac2.4.patch
+Patch1: %{name}-absimport.patch
+Patch2: %{name}-middleware-config.patch
 
 %description
 Beaker is a caching library that includes Session and Cache objects built on
@@ -21,6 +24,9 @@ manage Session objects and signed cookie
 
 %prep
 %setup -q -n Beaker-%{version}
+%patch0 -p1 -b .hashlib
+%patch1 -p0 -b .absimport
+%patch2 -p1 -b .middleconfig
 
 
 %build
@@ -44,6 +50,27 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sun Jul 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.1-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Tue Jul 21 2009 Kyle VanderBeek <kylev at kylev.com> - 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 <lmacken at redhat.com> - 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 <toshio at fedoraproject.org> - 1.3.1-3
+- Different hmac patch suitable for upstream inclusion.
+
+* Tue Jun 02 2009 Luke Macken <lmacken at redhat.com> - 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 <lmacken at redhat.com> - 1.3.1-1
+- Update to 1.3.1
+
 * Tue Apr 07 2009 Felix Schwarz <felix.schwarz at oss.schwarz.eu> - 1.3-1
 - Update to 1.3
  


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/python-beaker/F-11/sources,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- sources	7 Apr 2009 06:26:05 -0000	1.8
+++ sources	30 Jul 2009 19:02:43 -0000	1.9
@@ -1 +1 @@
-b38afdc892460113609bf933284c75c5  Beaker-1.3.tar.gz
+bdc4237d68f1a0f9b853d202a2d16617  Beaker-1.3.1.tar.gz




More information about the fedora-extras-commits mailing list