diff --git a/0001-Don-t-fail-on-older-python-versions-because-of-hashe.patch b/0001-Don-t-fail-on-older-python-versions-because-of-hashe.patch deleted file mode 100644 index d50bd54..0000000 --- a/0001-Don-t-fail-on-older-python-versions-because-of-hashe.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f6f6666438af884da7b4b1d76a258639f949406f Mon Sep 17 00:00:00 2001 -From: Jeffrey C. Ollie -Date: Thu, 2 Dec 2010 13:05:50 -0600 -Subject: [PATCH] Don't fail on older python versions because of hashes. - ---- - dns/hash.py | 3 --- - 1 files changed, 0 insertions(+), 3 deletions(-) - -diff --git a/dns/hash.py b/dns/hash.py -index 7bd5ae5..8582a9c 100644 ---- a/dns/hash.py -+++ b/dns/hash.py -@@ -37,9 +37,6 @@ def _setup(): - if sys.hexversion >= 0x02050200: - _hashes['SHA384'] = hashlib.sha384 - _hashes['SHA512'] = hashlib.sha512 -- else: -- _hashes['SHA384'] = _need_later_python('SHA384') -- _hashes['SHA512'] = _need_later_python('SHA512') - - if sys.hexversion < 0x02050000: - # hashlib doesn't conform to PEP 247: API for --- -1.7.3.2 - diff --git a/EL6_fixes.patch b/EL6_fixes.patch new file mode 100644 index 0000000..b710e19 --- /dev/null +++ b/EL6_fixes.patch @@ -0,0 +1,62 @@ +diff -ruN a/tests/test_dnssec.py b/tests/test_dnssec.py +--- a/tests/test_dnssec.py 2015-06-13 20:26:21.000000000 +0800 ++++ b/tests/test_dnssec.py 2016-02-12 14:14:10.556941459 +0800 +@@ -13,7 +13,7 @@ + # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +-import unittest ++import unittest2 as unittest + + import dns.dnssec + import dns.name +diff -ruN a/tests/test_exceptions.py b/tests/test_exceptions.py +--- a/tests/test_exceptions.py 2015-06-13 20:26:21.000000000 +0800 ++++ b/tests/test_exceptions.py 2016-02-12 14:13:58.496896295 +0800 +@@ -14,7 +14,7 @@ + # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + import binascii +-import unittest ++import unittest2 as unittest + + from dns.exception import DNSException + +diff -ruN a/tests/test_rdtypeanyeui.py a_patch/tests/test_rdtypeanyeui.py +--- a/tests/test_rdtypeanyeui.py 2016-01-09 08:16:49.000000000 +0800 ++++ b/tests/test_rdtypeanyeui.py 2016-02-12 17:57:19.699264077 +0800 +@@ -14,7 +14,7 @@ + # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +-import unittest ++import unittest2 as unittest + try: + from StringIO import StringIO + except ImportError: + +diff -ruN a/dns/tokenizer.py a_patch/dns/tokenizer.py +--- a/dns/tokenizer.py 2015-06-13 20:26:21.000000000 +0800 ++++ b/dns/tokenizer.py 2016-02-12 17:48:41.339066543 +0800 +@@ -15,6 +15,7 @@ + + """Tokenize DNS master file format""" + ++import StringIO + import cStringIO + import sys + +@@ -196,7 +197,11 @@ + """ + + if isinstance(f, (str, unicode)): +- f = cStringIO.StringIO(f) ++ # cStringIO doesn't support unicode ++ if isinstance(f, unicode): ++ f = StringIO.StringIO(f) ++ else: ++ f = cStringIO.StringIO(f) + if filename is None: + filename = '' + else: + diff --git a/python-dns.spec b/python-dns.spec index 5cfb372..84cd00f 100644 --- a/python-dns.spec +++ b/python-dns.spec @@ -1,87 +1,85 @@ -%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} + +%global py2commit a4774eea299e6a0ce01c074973dbddbe6fe20636 +%global py3commit 8d0fd8342089e66e199abe712ff22398bb7f736c + +# __python2 macro doesn't exist for el6 +%if 0%{?rhel} == 6 + %global __python2 %{__python} + %global python2_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") %endif -%undefine py2dir -%global py2dir %{_builddir}/dnspython/dnspython-%{version} +# Do not build python2 package for EPEL7+ since it's included in RHEL +%if 0%{?epel} > 6 + %global with_python2 0 +%else + %global with_python2 1 + %global py2prepdir %{_builddir}/dnspython/dnspython-%{py2commit} + %global py2unpack -a 0 -%if 0%{?rhel} == 5 -%global with_python26 1 -%undefine py26dir -%global py26dir %{_builddir}/dnspython/dnspython26-%{version} -%{!?__python26: %global __python26 /usr/bin/python26} -%{!?python26_sitelib: %global python26_sitelib %(%{__python26} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%endif - -# __python2 macro doesn't exist for el5 and 6 -%if 0%{?rhel} == 5 || 0%{?rhel} == 6 - %define __python2 %{__python} - %define python2_sitelib %{python_sitelib} + # Rename to python2-dns after Fedora 23 + %if 0%{?fedora} > 23 + %global with_p2subpkg 1 + %global python2_pkgversion 2 + %else + %global python2_pkgversion %{nil} + %endif + + %global py2dir %{_builddir}/dnspython/dnspython%{python2_pkgversion}-%{version} %endif +# Build python3 package for Fedora and EPEL7+ %if 0%{?fedora} > 12 || 0%{?epel} > 6 -%global with_python3 1 -%undefine py3dir -%global py3dir %{_builddir}/dnspython/dnspython3-%{version} -%global py3unpack -a 2 -%{!?python3_pkgversion: %global python3_pkgversion 3} -%endif - -# Rename to python2-dns after Fedora 23 -%if 0%{?fedora} > 23 - %global with_p2subpkg 1 + %global with_python3 1 + %{!?python3_pkgversion: %global python3_pkgversion 3} + %global py3prepdir %{_builddir}/dnspython/dnspython-%{py3commit} + %global py3dir %{_builddir}/dnspython/dnspython%{python3_pkgversion}-%{version} + %global py3unpack -a 2 %endif Name: python-dns -Version: 1.12.0GIT465785f -Release: 5%{?dist} +Version: 1.12.0GITa4774ee +Release: 1%{?dist} Summary: DNS toolkit for Python Group: Development/Languages License: MIT URL: http://www.dnspython.org/ -# git snapshots are not on the web + +%if 0%{?with_python2} #Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz -Source0: dnspython-%{version}.tar.gz +Source0: https://github.com/rthalley/dnspython/archive/%{py2commit}.tar.gz#/dnspython-%{version}.tar.gz +%endif + %if 0%{?with_python3} # git snapshots are not on the web #Source2: http://www.dnspython.org/kits3/%{version}/dnspython3-%{version}.tar.gz -Source2: dnspython3-%{version}.tar.gz +Source2: https://github.com/rthalley/dnspython/archive/%{py3commit}.tar.gz#/dnspython3-%{version}.tar.gz %endif -%if 0%{?rhel} == 5 -Patch0: 0001-Don-t-fail-on-older-python-versions-because-of-hashe.patch + +%if 0%{?rhel} == 6 +Patch0: EL6_fixes.patch %endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) - BuildArch: noarch +%if 0%{?with_python2} BuildRequires: python2-devel -# for tests BuildRequires: python-crypto - -%if 0%{?rhel} == 5 -BuildRequires: python-setuptools +%if ! 0%{?with_p2subpkg} +Provides: python2-dns = %{version}-%{release} +Requires: python-crypto +%if 0%{?rhel} == 6 +BuildRequires: python-unittest2 +%endif %endif - -%if 0%{?with_python26} -BuildRequires: python26-devel -# for tests -BuildRequires: python26-crypto %endif %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion}-devel -# for tests BuildRequires: python%{python3_pkgversion}-crypto %endif -%if ! 0%{?with_p2subpkg} -Provides: python2-dns = %{version}-%{release} -# for DNSSEC support -Requires: python-crypto -%endif - %description dnspython is a DNS toolkit for Python. It supports almost all record types. It can be used for queries, zone transfers, and dynamic @@ -97,8 +95,6 @@ manipulation of DNS zones, messages, names, and records. Summary: DNS toolkit for Python 2 Group: Development/Languages %{?python_provide:%python_provide python2-dns} - -# for DNSSEC support Requires: python2-crypto %description -n python2-dns @@ -112,32 +108,11 @@ class, and return an answer set. The low level classes allow direct manipulation of DNS zones, messages, names, and records. %endif -%if 0%{?with_python26} -%package -n python26-dns -Summary: DNS toolkit for Python 2.6 -Group: Development/Languages - -# for DNSSEC support -Requires: python26-crypto - -%description -n python26-dns -dnspython is a DNS toolkit for Python. It supports almost all record -types. It can be used for queries, zone transfers, and dynamic -updates. It supports TSIG authenticated messages and EDNS0. - -dnspython provides both high and low level access to DNS. The high -level classes perform queries for data of a given name, type, and -class, and return an answer set. The low level classes allow direct -manipulation of DNS zones, messages, names, and records. -%endif - %if 0%{?with_python3} %package -n python%{python3_pkgversion}-dns Summary: DNS toolkit for Python 3 Group: Development/Languages %{?python_provide:%python_provide python%{python3_pkgversion}-dns} - -# for DNSSEC support Requires: python%{python3_pkgversion}-crypto %description -n python%{python3_pkgversion}-dns @@ -152,42 +127,40 @@ manipulation of DNS zones, messages, names, and records. %endif %prep -%setup -q -T -c -n dnspython -a 0 %{?py3unpack:%{py3unpack}} +%setup -q -T -c -n dnspython %{?py2unpack:%{py2unpack}} %{?py3unpack:%{py3unpack}} # get rid of Mac goop find . -name ._\* -delete # strip executable permissions so that we don't pick up dependencies # from documentation -find %{py2dir}/examples -type f | xargs chmod a-x -%if 0%{?with_python3} -find %{py3dir}/examples -type f | xargs chmod a-x -%endif +%if 0%{?with_python2} +find %{py2prepdir}/examples -type f | xargs chmod a-x +if [ %{py2prepdir} != %{py2dir} ] +then + mv %{py2prepdir} %{py2dir} +fi -%if 0%{?with_python26} -rm -rf %{py26dir} -cp -a %{py2dir} %{py26dir} -find %{py26dir} -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python26}|' -%endif - -%if 0%{?rhel} == 5 +%if 0%{?rhel} == 6 pushd %{py2dir} %patch0 -p1 popd %endif -%build -pushd %{py2dir} -%if 0%{?rhel} == 5 -%{__python2} -c 'import setuptools; execfile("setup.py")' build -%else -%{__python2} setup.py build %endif -popd -%if 0%{?with_python26} -pushd %{py26dir} -%{__python26} setup.py build +%if 0%{?with_python3} +find %{py3prepdir}/examples -type f | xargs chmod a-x +if [ %{py3prepdir} != %{py3dir} ] +then + mv %{py3prepdir} %{py3dir} +fi +%endif + +%build +%if 0%{?with_python2} +pushd %{py2dir} +%{__python2} setup.py build popd %endif @@ -200,17 +173,9 @@ popd %install rm -rf %{buildroot} +%if 0%{?with_python2} pushd %{py2dir} -%if 0%{?rhel} == 5 -%{__python2} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot} -%else %{__python2} setup.py install --skip-build --root %{buildroot} -%endif -popd - -%if 0%{?with_python26} -pushd %{py26dir} -%{__python26} setup.py install --skip-build --root %{buildroot} popd %endif @@ -221,40 +186,17 @@ popd %endif %check +%if 0%{?with_python2} pushd %{py2dir}/tests # skip one test because it queries the network -# dnssec tests fail in RHEL5 Python 2.4 due to the -# lack of some hashes for py in test_*.py do -%if 0%{?rhel} == 5 - if [ $py != test_resolver.py -a $py != test_dnssec.py -a $py != test_grange.py ] -%else if [ $py != test_resolver.py ] -%endif then PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} $py fi done popd - -%if 0%{?with_python26} -pushd %{py26dir}/tests -# skip one test because it queries the network -# dnssec tests fail in RHEL5 Python 2.4 due to the -# lack of some hashes -for py in test_*.py -do -%if 0%{?rhel} == 5 - if [ $py != test_resolver.py -a $py != test_dnssec.py -a $py ] -%else - if [ $py != test_resolver.py ] -%endif - then - PYTHONPATH=%{buildroot}%{python26_sitelib} %{__python26} $py - fi -done -popd %endif %if 0%{?with_python3} @@ -273,40 +215,32 @@ popd %clean rm -rf %{buildroot} -# For Fedora > 23 builds +%if 0%{?with_python2} %if 0%{?with_p2subpkg} %files -n python2-dns %else %files %endif - %defattr(-,root,root,-) -%doc dnspython-%{version}/{ChangeLog,LICENSE,README,examples} - +%doc dnspython%{python2_pkgversion}-%{version}/{ChangeLog,LICENSE,README*,examples} %{python2_sitelib}/*egg-info %{python2_sitelib}/dns - -%if 0%{?with_python26} -%files -n python26-dns -%defattr(-,root,root,-) -%doc dnspython26-%{version}/{ChangeLog,LICENSE,README,examples} - -%{python26_sitelib}/*egg-info -%{python26_sitelib}/dns %endif %if 0%{?with_python3} %files -n python%{python3_pkgversion}-dns %defattr(-,root,root,-) -%doc dnspython3-%{version}/{ChangeLog,LICENSE,README,examples} - +%doc dnspython%{python3_pkgversion}-%{version}/{ChangeLog,LICENSE,README*,examples} %{python3_sitelib}/*egg-info %{python3_sitelib}/dns %endif %changelog -* Thu Feb 04 2016 Fedora Release Engineering - 1.12.0GIT465785f-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild +* Fri Feb 12 2016 Avram Lubkin - 1.12.0GITa4774ee-1 +- Latest Snapshot +- Drop EPEL5 from master spec +- Patch to support EL6 +- Disable python2 package for EPEL7+ * Mon Feb 01 2016 Avram Lubkin - 1.12.0GIT465785f-4 - Changed Python2 package name to python2-dns for Fedora 24+