From 8e1366d91befadb73e023ecd786a5bb038b65ea816963c0b5e40211d955218ef Mon Sep 17 00:00:00 2001
From: Jan Matejek <ja+suse@matejcik.cz>
Date: Fri, 20 Oct 2017 13:26:33 +0000
Subject: [PATCH 1/4] Accepting request 535455 from
 home:alarrosa:branches:devel:languages:python

- Update to 0.27.0
  * Fix licence: it is MIT, not BSD
  * At least minimal support of SNI in httpslib.
  * Small bugfixes and cleanups.
  * More effort to make build system more robust.
  * Restore m2.rsa_set_e() and m2.rsa_set_n().
  * Make sure that every exceptional return throws and exception and viceversa.
- Add patch fix-build-python3.diff to let it build with python3
- Add patch fix-openssl-include-path.diff to fix openssl include path
  (the code already includes the openssl/ part)
- Create a new package python-M2Crypto-doc for documentation since rpmlint
  was complaining around 75% of the package was documentation.

OBS-URL: https://build.opensuse.org/request/show/535455
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=45
---
 M2Crypto-0.26.4.tar.gz        |  3 ---
 M2Crypto-0.27.0.tar.gz        |  3 +++
 fix-build-python3.diff        | 16 ++++++++++++++++
 fix-openssl-include-path.diff | 13 +++++++++++++
 python-M2Crypto.changes       | 16 ++++++++++++++++
 python-M2Crypto.spec          | 32 ++++++++++++++++++++++++++++++--
 6 files changed, 78 insertions(+), 5 deletions(-)
 delete mode 100644 M2Crypto-0.26.4.tar.gz
 create mode 100644 M2Crypto-0.27.0.tar.gz
 create mode 100644 fix-build-python3.diff
 create mode 100644 fix-openssl-include-path.diff

diff --git a/M2Crypto-0.26.4.tar.gz b/M2Crypto-0.26.4.tar.gz
deleted file mode 100644
index be99731..0000000
--- a/M2Crypto-0.26.4.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5cae7acc0b34821f8c0ddf6665e482893fe1f198ad6379e61ffa9d8e65f5c199
-size 1116587
diff --git a/M2Crypto-0.27.0.tar.gz b/M2Crypto-0.27.0.tar.gz
new file mode 100644
index 0000000..4d11b7c
--- /dev/null
+++ b/M2Crypto-0.27.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:82317459d653322d6b37f122ce916dc91ddcd9d1b814847497ac796c4549dd68
+size 1119288
diff --git a/fix-build-python3.diff b/fix-build-python3.diff
new file mode 100644
index 0000000..fd3518f
--- /dev/null
+++ b/fix-build-python3.diff
@@ -0,0 +1,16 @@
+Index: M2Crypto-0.27.0/setup.py
+===================================================================
+--- M2Crypto-0.27.0.orig/setup.py
++++ M2Crypto-0.27.0/setup.py
+@@ -48,7 +48,10 @@ def _get_additional_includes():
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE)
+     _, err = pid.communicate()
+-    err = [line.lstrip() for line in err.split('\n') if line and line[0] == ' ']
++    if sys.version_info[0] == 2:
++        err = [line.lstrip() for line in err.split('\n') if line and line[0] == ' ']
++    else:
++        err = [line.lstrip() for line in err.split(b'\n') if line and line[0] == b' ']
+     return err
+ 
+ 
diff --git a/fix-openssl-include-path.diff b/fix-openssl-include-path.diff
new file mode 100644
index 0000000..7640f65
--- /dev/null
+++ b/fix-openssl-include-path.diff
@@ -0,0 +1,13 @@
+Index: M2Crypto-0.27.0/setup.py
+===================================================================
+--- M2Crypto-0.27.0.orig/setup.py
++++ M2Crypto-0.27.0/setup.py
+@@ -159,7 +164,7 @@ class _M2CryptoBuildExt(build_ext.build_
+ 
+         if platform.system() == "Linux":
+             self.include_dirs += _get_additional_includes()
+-            inc_openssl_dir = '/usr/include/openssl'
++            inc_openssl_dir = '/usr/include/'
+             if inc_openssl_dir not in self.include_dirs:
+                 self.include_dirs.append(inc_openssl_dir)
+             log.debug('self.include_dirs = %s', self.include_dirs)
diff --git a/python-M2Crypto.changes b/python-M2Crypto.changes
index 91cee19..6f299d5 100644
--- a/python-M2Crypto.changes
+++ b/python-M2Crypto.changes
@@ -1,3 +1,19 @@
+-------------------------------------------------------------------
+Wed Oct 18 07:13:58 UTC 2017 - alarrosa@suse.com
+
+- Update to 0.27.0
+  * Fix licence: it is MIT, not BSD
+  * At least minimal support of SNI in httpslib.
+  * Small bugfixes and cleanups.
+  * More effort to make build system more robust.
+  * Restore m2.rsa_set_e() and m2.rsa_set_n().
+  * Make sure that every exceptional return throws and exception and viceversa.
+- Add patch fix-build-python3.diff to let it build with python3
+- Add patch fix-openssl-include-path.diff to fix openssl include path
+  (the code already includes the openssl/ part)
+- Create a new package python-M2Crypto-doc for documentation since rpmlint
+  was complaining around 75% of the package was documentation.
+
 -------------------------------------------------------------------
 Tue Sep 26 12:32:25 UTC 2017 - michael@stroeder.com
 
diff --git a/python-M2Crypto.spec b/python-M2Crypto.spec
index 9a25508..2a16370 100644
--- a/python-M2Crypto.spec
+++ b/python-M2Crypto.spec
@@ -22,13 +22,17 @@
 %define oldpython python
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-M2Crypto
-Version:        0.26.4
+Version:        0.27.0
 Release:        0
 Url:            https://gitlab.com/m2crypto/m2crypto
 Summary:        Crypto and SSL toolkit for Python
 License:        MIT and ZPL-2.0 and BSD-3-Clause
 Group:          Development/Languages/Python
 Source:         https://pypi.io/packages/source/M/M2Crypto/M2Crypto-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM fix-build-python3.diff -- Fixes a str/bytes issue when building with python3
+Patch0:         fix-build-python3.diff
+# PATCH-FIX-OPENSUSE fix-openssl-include-path.diff -- Fixes include path for openssl
+Patch1:         fix-openssl-include-path.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
@@ -67,8 +71,28 @@ HMAC'ing AuthCookies for web session management. FTP/TLS client and
 server. S/MIME. ZServerSSL: A HTTPS server for Zope. ZSmime: An S/MIME
 messenger for Zope.
 
+%package -n %{name}-doc
+Summary:        Documentation for the Crypto and SSL toolkit for Python
+Group:          Development/Libraries/Python
+BuildArch:      noarch
+Requires:       %{name} = %{version}
+
+%description -n %{name}-doc
+M2Crypto is a crypto and SSL toolkit for Python featuring the following:
+
+RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including
+AES). SSL functionality to implement clients and servers. HTTPS
+extensions to Python's httplib, urllib, and xmlrpclib. Unforgeable
+HMAC'ing AuthCookies for web session management. FTP/TLS client and
+server. S/MIME. ZServerSSL: A HTTPS server for Zope. ZSmime: An S/MIME
+messenger for Zope.
+
+Documentation for the Crypto and SSL toolkit for Python
+
 %prep
 %setup -q -n M2Crypto-%{version}
+%patch0 -p1
+%patch1 -p1
 
 %build
 export CFLAGS="%{optflags}"
@@ -77,6 +101,7 @@ export CFLAGS="%{optflags}"
 %install
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitearch}
+%fdupes %{buildroot}%{_docdir}
 
 %if %{with tests}
 %check
@@ -86,7 +111,10 @@ export CFLAGS="%{optflags}"
 %files %{python_files}
 %defattr(-,root,root)
 %doc CHANGES LICENCE README.rst
-%doc doc/
 %{python_sitearch}/*
 
+%files -n %{name}-doc
+%defattr(-,root,root)
+%doc doc/*
+
 %changelog

From 50f02cb942532eabc11b94025bf5c02e09fb4180e794e59e35c0849804adf5f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Str=C3=B6der?= <michael@stroeder.com>
Date: Mon, 23 Oct 2017 08:24:03 +0000
Subject: [PATCH 2/4] Accepting request 535913 from
 home:alarrosa:branches:devel:languages:python

- Remove unnecessary fdupes call

OBS-URL: https://build.opensuse.org/request/show/535913
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=46
---
 python-M2Crypto.changes | 5 +++++
 python-M2Crypto.spec    | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/python-M2Crypto.changes b/python-M2Crypto.changes
index 6f299d5..7dcdd32 100644
--- a/python-M2Crypto.changes
+++ b/python-M2Crypto.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Fri Oct 20 13:51:00 UTC 2017 - alarrosa@suse.com
+
+- Remove unnecessary fdupes call 
+
 -------------------------------------------------------------------
 Wed Oct 18 07:13:58 UTC 2017 - alarrosa@suse.com
 
diff --git a/python-M2Crypto.spec b/python-M2Crypto.spec
index 2a16370..9b42fc8 100644
--- a/python-M2Crypto.spec
+++ b/python-M2Crypto.spec
@@ -101,7 +101,6 @@ export CFLAGS="%{optflags}"
 %install
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitearch}
-%fdupes %{buildroot}%{_docdir}
 
 %if %{with tests}
 %check

From 55bd80ebe41d224e2c6e6fc3db615e8c7091209e241b24da8f0be89db9b6a9be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Str=C3=B6der?= <michael@stroeder.com>
Date: Wed, 25 Oct 2017 20:06:47 +0000
Subject: [PATCH 3/4] OBS-URL:
 https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=47

---
 python-M2Crypto.spec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python-M2Crypto.spec b/python-M2Crypto.spec
index 9b42fc8..cd8cbb8 100644
--- a/python-M2Crypto.spec
+++ b/python-M2Crypto.spec
@@ -26,7 +26,7 @@ Version:        0.27.0
 Release:        0
 Url:            https://gitlab.com/m2crypto/m2crypto
 Summary:        Crypto and SSL toolkit for Python
-License:        MIT and ZPL-2.0 and BSD-3-Clause
+License:        MIT
 Group:          Development/Languages/Python
 Source:         https://pypi.io/packages/source/M/M2Crypto/M2Crypto-%{version}.tar.gz
 # PATCH-FIX-UPSTREAM fix-build-python3.diff -- Fixes a str/bytes issue when building with python3

From a7cea0608da6ff71d69cf4533a1691a62e3ca29b92d461f7ea71443b5c130db0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Str=C3=B6der?= <michael@stroeder.com>
Date: Wed, 25 Oct 2017 20:07:25 +0000
Subject: [PATCH 4/4] OBS-URL:
 https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=48

---
 python-M2Crypto.changes | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/python-M2Crypto.changes b/python-M2Crypto.changes
index 7dcdd32..b12cff9 100644
--- a/python-M2Crypto.changes
+++ b/python-M2Crypto.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Wed Oct 25 20:07:14 UTC 2017 - michael@stroeder.com
+
+- License set to MIT
+
 -------------------------------------------------------------------
 Fri Oct 20 13:51:00 UTC 2017 - alarrosa@suse.com