diff --git a/.cvsignore b/.cvsignore index 51df5ad..cb14750 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -pycrypto-2.0.1.tar.gz +pycrypto-2.1.0.tar.gz diff --git a/python-crypto-2.1.0-optflags.patch b/python-crypto-2.1.0-optflags.patch new file mode 100644 index 0000000..b0e541f --- /dev/null +++ b/python-crypto-2.1.0-optflags.patch @@ -0,0 +1,28 @@ +--- pycrypto-2.1.0/setup.py.orig 2009-12-13 20:39:29.000000000 +0000 ++++ pycrypto-2.1.0/setup.py 2010-02-16 13:18:15.910546268 +0000 +@@ -124,25 +124,6 @@ + # Make assert() statements always work + self.__remove_compiler_option("-DNDEBUG") + +- # Choose our own optimization options +- for opt in ["-O", "-O0", "-O1", "-O2", "-O3", "-Os"]: +- self.__remove_compiler_option(opt) +- if self.debug: +- # Basic optimization is still needed when debugging to compile +- # the libtomcrypt code. +- self.__add_compiler_option("-O") +- else: +- # Speed up execution by tweaking compiler options. This +- # especially helps the DES modules. +- self.__add_compiler_option("-O3") +- self.__add_compiler_option("-fomit-frame-pointer") +- # Don't include debug symbols unless debugging +- self.__remove_compiler_option("-g") +- if USE_GCOV: +- self.__add_compiler_option("-fprofile-arcs") +- self.__add_compiler_option("-ftest-coverage") +- self.compiler.libraries += ['gcov'] +- + # Call the superclass's build_extensions method + build_ext.build_extensions(self) + diff --git a/python-crypto-fix_buffer_overflow.patch b/python-crypto-fix_buffer_overflow.patch deleted file mode 100644 index b16a307..0000000 --- a/python-crypto-fix_buffer_overflow.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naur pycrypto-2.0.1.org/src/ARC2.c pycrypto-2.0.1/src/ARC2.c ---- pycrypto-2.0.1.org/src/ARC2.c 2009-02-13 17:08:30.000000000 +0100 -+++ pycrypto-2.0.1/src/ARC2.c 2009-02-13 17:08:47.000000000 +0100 -@@ -11,6 +11,7 @@ - */ - - #include -+#include "Python.h" - - #define MODULE_NAME ARC2 - #define BLOCK_SIZE 8 -@@ -146,6 +147,12 @@ - We'll hardwire it to 1024. */ - #define bits 1024 - -+ if ((U32)keylength > sizeof(self->xkey)) { -+ PyErr_SetString(PyExc_ValueError, -+ "ARC2 key length must be less than 128 bytes"); -+ return; -+ } -+ - memcpy(self->xkey, key, keylength); - - /* Phase 1: Expand input key to 128 bytes */ diff --git a/python-crypto-hmac_md5.patch b/python-crypto-hmac_md5.patch deleted file mode 100644 index 22ac8f8..0000000 --- a/python-crypto-hmac_md5.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- pycrypto-2.0.1.orig/Hash/HMAC.py 2002-07-25 13:19:02.000000000 -0400 -+++ pycrypto-2.0.1/Hash/HMAC.py 2009-02-13 14:11:10.000000000 -0500 -@@ -33,8 +33,8 @@ - digestmod: A module supporting PEP 247. Defaults to the md5 module. - """ - if digestmod == None: -- import md5 -- digestmod = md5 -+ import MD5 -+ digestmod = MD5 - - self.digestmod = digestmod - self.outer = digestmod.new() diff --git a/python-crypto-use_hashlib_when_possible.patch b/python-crypto-use_hashlib_when_possible.patch deleted file mode 100644 index 5f2527b..0000000 --- a/python-crypto-use_hashlib_when_possible.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- pycrypto-2.0.1.orig/Hash/MD5.py 2002-07-11 10:31:19.000000000 -0400 -+++ pycrypto-2.0.1/Hash/MD5.py 2009-02-13 14:07:52.000000000 -0500 -@@ -3,11 +3,21 @@ - - __revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $" - --from md5 import * -+__all__ = ['new', 'digest_size'] - --import md5 --if hasattr(md5, 'digestsize'): -- digest_size = digestsize -- del digestsize --del md5 -+try: -+ # The md5 module is deprecated in Python 2.6, so use hashlib when possible. -+ import hashlib -+ def new(data=""): -+ return hashlib.md5(data) -+ digest_size = new().digest_size -+ -+except ImportError: -+ from md5 import * -+ -+ import md5 -+ if hasattr(md5, 'digestsize'): -+ digest_size = digestsize -+ del digestsize -+ del md5 - ---- pycrypto-2.0.1.orig/Hash/SHA.py 2002-07-11 10:31:19.000000000 -0400 -+++ pycrypto-2.0.1/Hash/SHA.py 2009-02-13 14:13:09.000000000 -0500 -@@ -3,9 +3,19 @@ - - __revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $" - --from sha import * --import sha --if hasattr(sha, 'digestsize'): -- digest_size = digestsize -- del digestsize --del sha -+__all__ = ['new', 'digest_size'] -+ -+try: -+ # The md5 module is deprecated in Python 2.6, so use hashlib when possible. -+ import hashlib -+ def new(data=""): -+ return hashlib.sha1(data) -+ digest_size = new().digest_size -+ -+except ImportError: -+ from sha import * -+ import sha -+ if hasattr(sha, 'digestsize'): -+ digest_size = digestsize -+ del digestsize -+ del sha diff --git a/python-crypto.spec b/python-crypto.spec index 1f387af..18c0597 100644 --- a/python-crypto.spec +++ b/python-crypto.spec @@ -1,80 +1,83 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from -distutils.sysconfig import get_python_lib; print get_python_lib()")} -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%global pythonver %(%{__python} -c "import sys; print sys.version[:3]" || echo 0.0) +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Summary: Cryptography library for Python Name: python-crypto -Version: 2.0.1 -Release: 19 -License: Public Domain +Version: 2.1.0 +Release: 1%{?dist} +# Mostly Public Domain apart from parts of HMAC.py and setup.py, which are Python +License: Public Domain and Python Group: Development/Libraries -# FIXME: In the near future, new releases will be at http://www.dlitz.net/software/pycrypto/ -URL: http://www.amk.ca/python/code/crypto.html -Source: http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz -# patch taken from -# http://gitweb2.dlitz.net/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d1c4875e1f220652fe7ff8358f56dee3b2aba31b -Patch0: %{name}-fix_buffer_overflow.patch -# Python 2.6 compatibility: Use Hash.MD5 instead of Python "md5" module in the HMAC... -# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=84b793416b52311643bfd456a4544444afbfb5da -Patch1: python-crypto-hmac_md5.patch -# Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5... -# http://gitweb.pycrypto.org/?p=crypto/pycrypto-2.x.git;a=commitdiff;h=d2311689910240e425741a546576129f4c9735e2 -Patch2: python-crypto-use_hashlib_when_possible.patch - +URL: http://www.pycrypto.org/ +Source0: http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-%{version}.tar.gz +Patch0: python-crypto-2.1.0-optflags.patch Provides: pycrypto = %{version}-%{release} -BuildRequires: python >= 2.2 -BuildRequires: python-devel >= 2.2 -BuildRequires: gmp-devel >= 4.1 +BuildRequires: python-devel >= 2.2, gmp-devel >= 4.1 BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot-%(%{__id_u} -n) +# Don't want provides for python shared objects +%{?filter_provides_in: %filter_provides_in %{python_sitearch}/Crypto/.*\.so} +%{?filter_setup} + %description Python-crypto is a collection of both secure hash functions (such as MD5 and -SHA), and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.). - +SHA), and various encryption algorithms (AES, DES, RSA, ElGamal etc.). %prep %setup -n pycrypto-%{version} -q -sed -i s:/lib:/%_lib:g setup.py -%patch0 -b .patch0 -p1 -%patch1 -b .patch1 -p1 -%patch2 -b .patch2 -p1 -%build -CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +# Use distribution compiler flags rather than upstream's +%patch0 -p1 + +# Remove spurious shellbangs +%{__sed} -i -e '\|^#!/usr/local/bin/python| d' lib/Crypto/Util/RFC1751.py + +# Fix permissions for debuginfo +%{__chmod} -x src/*.c +%build +CFLAGS="%{optflags}" %{__python} setup.py build %install -rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -find -name "*.py"|xargs %{__perl} -pi -e "s:/usr/local/bin/python:%{__python}:" +%{__rm} -rf %{buildroot} +%{__python} setup.py install -O1 --skip-build --root %{buildroot} +# Remove group write permissions on shared objects +/usr/bin/find %{buildroot}%{python_sitearch} -name '*.so' \ + -exec %{__chmod} g-w {} \; -%clean -rm -rf $RPM_BUILD_ROOT +# See if there's any egg-info +if [ -f %{buildroot}%{python_sitearch}/pycrypto-%{version}-py%{pythonver}.egg-info ]; then + echo %{python_sitearch}/pycrypto-%{version}-py%{pythonver}.egg-info +fi > egg-info +%check +%{__python} setup.py test -%files -%defattr(-,root,root,-) -%doc README TODO ACKS ChangeLog LICENSE Doc -%{python_sitearch}/*.egg-info -%{python_sitearch}/Crypto/*.py* -%{python_sitearch}/Crypto/Cipher/*.so -%{python_sitearch}/Crypto/Cipher/*.py* -%{python_sitearch}/Crypto/Hash/*.so -%{python_sitearch}/Crypto/Hash/*.py* -%{python_sitearch}/Crypto/Protocol/*.py* -%{python_sitearch}/Crypto/PublicKey/*.so -%{python_sitearch}/Crypto/PublicKey/*.py* -%{python_sitearch}/Crypto/Util/*.py* -%dir %{python_sitearch}/Crypto -%dir %{python_sitearch}/Crypto/Cipher/ -%dir %{python_sitearch}/Crypto/Hash/ -%dir %{python_sitearch}/Crypto/Protocol/ -%dir %{python_sitearch}/Crypto/PublicKey/ -%dir %{python_sitearch}/Crypto/Util/ +%clean +%{__rm} -rf %{buildroot} +%files -f egg-info +%defattr(-,root,root,-) +%doc README TODO ACKS ChangeLog LEGAL/ COPYRIGHT Doc/ +%{python_sitearch}/Crypto/ %changelog +* Tue Feb 16 2010 Paul Howarth - 2.1.0-1 +- Update to 2.1.0 (see ChangeLog for details) +- Remove patches (no longer needed) +- Use new upstream URLs +- Upstream has replaced LICENSE with LEGAL/ and COPYRIGHT +- Clarify that license is mostly Public Domain, partly Python +- Add %%check section and run the test suite in it +- Remove upstream's fiddling with compiler optimization flags so we get + usable debuginfo +- Filter out unwanted provides for python shared objects +- Tidy up egg-info handling +- Simplify %%files list +- Pacify rpmlint as much as is reasonable +- Add dist tag + * Sun Jul 26 2009 Fedora Release Engineering - 2.0.1-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild diff --git a/sources b/sources index 48224a6..7361466 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4d5674f3898a573691ffb335e8d749cd pycrypto-2.0.1.tar.gz +1d3eb04f06e6f09a080bc37fb019f9bf pycrypto-2.1.0.tar.gz