From cbe6341ca8dd6d091650ed2962558f4ec35c6df80a0d8a1189f1f797ac77c20f Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Wed, 3 Jul 2013 12:43:31 +0000 Subject: [PATCH] revert to 37 again OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httplib2?expand=0&rev=40 --- ca_certs_locater.py | 13 ---------- certbundle.run | 43 ------------------------------ httplib2-use-system-certs.patch | 46 +++++++++++++++++++++++++++++++++ pre_checkin.sh | 4 +++ python-httplib2.changes | 14 ---------- python-httplib2.spec | 29 +++------------------ 6 files changed, 54 insertions(+), 95 deletions(-) delete mode 100644 ca_certs_locater.py delete mode 100644 certbundle.run create mode 100644 httplib2-use-system-certs.patch create mode 100644 pre_checkin.sh diff --git a/ca_certs_locater.py b/ca_certs_locater.py deleted file mode 100644 index 57a3a0d..0000000 --- a/ca_certs_locater.py +++ /dev/null @@ -1,13 +0,0 @@ -# -# httplib2 system SSL certificate bundle locator for openSUSE. -# -# Author: Sascha Peilicke -# - - -def get(): - return "/etc/ssl/ca-bundle.pem" - - -if __name__ == "__main__": - print get() diff --git a/certbundle.run b/certbundle.run deleted file mode 100644 index ee3400f..0000000 --- a/certbundle.run +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# vim: syntax=sh - -shopt -s nullglob - -cafile=${1:-/etc/ssl/ca-bundle.pem} -cadir="/etc/ssl/certs" - -for i in "$@"; do - if [ "$i" = "-f" ]; then - fresh=1 - elif [ "$i" = "-v" ]; then - verbose=1 - fi -done - -if [ -z "$fresh" -a "$cafile" -nt "$cadir" ]; then - exit 0 -fi -echo "creating $cafile ..." -cat > "$cafile.new" <&2; continue ;; - esac - fi - openssl x509 -in "$i" -done >> "$cafile.new" -mv "$cafile.new" "$cafile" diff --git a/httplib2-use-system-certs.patch b/httplib2-use-system-certs.patch new file mode 100644 index 0000000..4571c98 --- /dev/null +++ b/httplib2-use-system-certs.patch @@ -0,0 +1,46 @@ +diff -ruN a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py +--- a/python2/httplib2/__init__.py 2013-03-06 21:45:31.000000000 +0100 ++++ b/python2/httplib2/__init__.py 2013-03-22 14:02:09.458410128 +0100 +@@ -184,15 +184,8 @@ + # requesting that URI again. + DEFAULT_MAX_REDIRECTS = 5 + +-try: +- # Users can optionally provide a module that tells us where the CA_CERTS +- # are located. +- import ca_certs_locater +- CA_CERTS = ca_certs_locater.get() +-except ImportError: +- # Default CA certificates file bundled with httplib2. +- CA_CERTS = os.path.join( +- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt") ++# Default CA certificates file bundled with httplib2. ++CA_CERTS = '/etc/ssl/ca-bundle.pem' + + # Which headers are hop-by-hop headers by default + HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade'] +diff -ruN a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py +--- a/python3/httplib2/__init__.py 2013-03-06 21:45:31.000000000 +0100 ++++ b/python3/httplib2/__init__.py 2013-03-22 14:01:51.270409717 +0100 +@@ -124,8 +124,8 @@ + HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade'] + + # Default CA certificates file bundled with httplib2. +-CA_CERTS = os.path.join( +- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt") ++CA_CERTS = '/etc/ssl/ca-bundle.pem' ++ + + def _get_end2end_headers(response): + hopbyhop = list(HOP_BY_HOP) +diff -ruN a/setup.py b/setup.py +--- a/setup.py 2013-03-06 21:45:31.000000000 +0100 ++++ b/setup.py 2013-03-22 14:02:33.031410660 +0100 +@@ -62,7 +62,6 @@ + """, + package_dir=pkgdir, + packages=['httplib2'], +- package_data={'httplib2': ['*.txt']}, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Web Environment', diff --git a/pre_checkin.sh b/pre_checkin.sh new file mode 100644 index 0000000..ded8e93 --- /dev/null +++ b/pre_checkin.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +sed 's,^\(Name: *\)python-,\1python3-,;s,^\(Requires: *\)python-,\1python3-,;s,^\(BuildRequires: *\)python-,\1python3-,;s,python setup.py,python3 setup.py,;s,python_sitelib,python3_sitelib,;s,python_sitearch,python3_sitearch,' python-httplib2.spec > python3-httplib2.spec +cp python-httplib2.changes python3-httplib2.changes diff --git a/python-httplib2.changes b/python-httplib2.changes index 753a338..98354f4 100644 --- a/python-httplib2.changes +++ b/python-httplib2.changes @@ -1,17 +1,3 @@ -------------------------------------------------------------------- -Wed Jul 3 08:26:46 UTC 2013 - speilicke@suse.com - -- Drop SLES parts of ca_certs_locater.py, it's meant for openSUSE only - -------------------------------------------------------------------- -Thu Jun 20 11:48:15 UTC 2013 - speilicke@suse.com - -- Change the mechanism to use system-wide CA certificates: - + on openSUSE, use the (new) upstream ca_certs_locater mechanism - and don't ship a private copy of Mozilla's CA certs file - + on SLES, regenerate cacerts.txt from /etc/ssl/certs when - httplib2 is installed and/or openssl-certs is installed/updated - ------------------------------------------------------------------- Thu May 2 10:23:29 UTC 2013 - speilicke@suse.com diff --git a/python-httplib2.spec b/python-httplib2.spec index 980a577..9667d71 100644 --- a/python-httplib2.spec +++ b/python-httplib2.spec @@ -25,10 +25,9 @@ License: MIT and Apache-2.0 and (MPL-1.1 or GPL-2.0+ or LGPL-2.1+) Group: Development/Libraries/Python Source: http://pypi.python.org/packages/source/h/httplib2/httplib2-%{version}.tar.gz # PATCH-FIX-OPENSUSE: Don't ship private copy of Mozilla NSS certs, use system certs instead (bnc#761162) -Source1: ca_certs_locater.py -Source2: certbundle.run +Patch0: httplib2-use-system-certs.patch # PATCH-FIX-UPSTREAM: speilicke@suse.com -- SSL certificate hostname mismatch is checked only once -Patch0: httplib2-bnc-818100.patch +Patch1: httplib2-bnc-818100.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel # Test requirements (for ssl module): @@ -51,41 +50,21 @@ left out of other HTTP libraries. %prep %setup -q -n httplib2-%{version} %patch0 -p1 +%patch1 -p1 %build python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} -# NOTE(saschpe): On SLES, there's no /etc/ssl/ca-bundle.pem, thus -# we have to generate a private copy (and refresh it occasionally) -%if 0%{?sles_version} -install -m 0755 %{SOURCE2} %{buildroot}%{python_sitelib}/httplib2/ -%else -install -m 0644 %{SOURCE1} %{buildroot}%{python_sitelib}/httplib2/ -rm %{buildroot}%{python_sitelib}/httplib2/cacerts.txt -%endif #%%check #python python2/httplib2test.py -%if 0%{?sles_version} -%post -%{python_sitelib}/httplib2/certbundle.run %{python_sitelib}/httplib2/cacerts.txt - -%triggerin -- openssl-certs -%{python_sitelib}/httplib2/certbundle.run %{python_sitelib}/httplib2/cacerts.txt -%endif - %files %defattr(-,root,root) %doc README %{python_sitelib}/httplib2-%{version}-py%{py_ver}.egg-info -%dir %{python_sitelib}/httplib2 -%{python_sitelib}/httplib2/*.py* -%if 0%{?sles_version} -%{python_sitelib}/httplib2/certbundle.run -%ghost %{python_sitelib}/httplib2/cacerts.txt -%endif +%{python_sitelib}/httplib2 %changelog