Resolves: #1115489 - build with python 3.x for fedora >= 22
This commit is contained in:
parent
bba137d935
commit
748fd03a49
442
unbound-1.4.22-python3.patch
Normal file
442
unbound-1.4.22-python3.patch
Normal file
@ -0,0 +1,442 @@
|
||||
diff --git a/acx_python.m4 b/acx_python.m4
|
||||
index 99ffa25..254ff20 100644
|
||||
--- a/acx_python.m4
|
||||
+++ b/acx_python.m4
|
||||
@@ -14,58 +14,11 @@ AC_DEFUN([AC_PYTHON_DEVEL],[
|
||||
fi
|
||||
|
||||
if test -z "$PYTHON_VERSION"; then
|
||||
- PYTHON_VERSION=`$PYTHON -c "import sys, string; \
|
||||
- print string.split(sys.version)[[0]]"`
|
||||
+ PYTHON_VERSION=`$PYTHON -c "import sys; \
|
||||
+ print(sys.version.split()[[0]])"`
|
||||
fi
|
||||
|
||||
#
|
||||
- # Check for a version of Python >= 2.1.0
|
||||
- #
|
||||
- AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
|
||||
- ac_supports_python_ver=`$PYTHON -c "import sys, string; \
|
||||
- ver = string.split(sys.version)[[0]]; \
|
||||
- print ver >= '2.1.0'"`
|
||||
- if test "$ac_supports_python_ver" != "True"; then
|
||||
- if test -z "$PYTHON_NOVERSIONCHECK"; then
|
||||
- AC_MSG_RESULT([no])
|
||||
- AC_MSG_FAILURE([
|
||||
-This version of the AC@&t@_PYTHON_DEVEL macro
|
||||
-doesn't work properly with versions of Python before
|
||||
-2.1.0. You may need to re-run configure, setting the
|
||||
-variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
|
||||
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
|
||||
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
|
||||
-to something else than an empty string.
|
||||
-])
|
||||
- else
|
||||
- AC_MSG_RESULT([skip at user request])
|
||||
- fi
|
||||
- else
|
||||
- AC_MSG_RESULT([yes])
|
||||
- fi
|
||||
-
|
||||
- #
|
||||
- # if the macro parameter ``version'' is set, honour it
|
||||
- #
|
||||
- if test -n "$1"; then
|
||||
- AC_MSG_CHECKING([for a version of Python $1])
|
||||
- ac_supports_python_ver=`$PYTHON -c "import sys, string; \
|
||||
- ver = string.split(sys.version)[[0]]; \
|
||||
- print ver $1"`
|
||||
- if test "$ac_supports_python_ver" = "True"; then
|
||||
- AC_MSG_RESULT([yes])
|
||||
- else
|
||||
- AC_MSG_RESULT([no])
|
||||
- AC_MSG_ERROR([this package requires Python $1.
|
||||
-If you have it installed, but it isn't the default Python
|
||||
-interpreter in your system path, please pass the PYTHON_VERSION
|
||||
-variable to configure. See ``configure --help'' for reference.
|
||||
-])
|
||||
- PYTHON_VERSION=""
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- #
|
||||
# Check if you have distutils, else fail
|
||||
#
|
||||
AC_MSG_CHECKING([for the distutils Python package])
|
||||
@@ -86,7 +39,7 @@ $ac_distutils_result])
|
||||
AC_MSG_CHECKING([for Python include path])
|
||||
if test -z "$PYTHON_CPPFLAGS"; then
|
||||
python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print distutils.sysconfig.get_python_inc();"`
|
||||
+ print(distutils.sysconfig.get_python_inc());"`
|
||||
if test -n "${python_path}"; then
|
||||
python_path="-I$python_path"
|
||||
fi
|
||||
@@ -100,25 +53,8 @@ $ac_distutils_result])
|
||||
#
|
||||
AC_MSG_CHECKING([for Python library path])
|
||||
if test -z "$PYTHON_LDFLAGS"; then
|
||||
- # (makes two attempts to ensure we've got a version number
|
||||
- # from the interpreter)
|
||||
- py_version=`$PYTHON -c "from distutils.sysconfig import *; \
|
||||
- from string import join; \
|
||||
- print join(get_config_vars('VERSION'))"`
|
||||
- if test "$py_version" = "[None]"; then
|
||||
- if test -n "$PYTHON_VERSION"; then
|
||||
- py_version=$PYTHON_VERSION
|
||||
- else
|
||||
- py_version=`$PYTHON -c "import sys; \
|
||||
- print sys.version[[:3]]"`
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \
|
||||
- from string import join; \
|
||||
- print '-L' + get_python_lib(0,1), \
|
||||
- '-L' + os.path.dirname(get_python_lib(0,1)), \
|
||||
- '-lpython';"`$py_version
|
||||
+ print(get_config_var('BLDLIBRARY'));"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_LDFLAGS])
|
||||
AC_SUBST([PYTHON_LDFLAGS])
|
||||
@@ -129,36 +65,12 @@ $ac_distutils_result])
|
||||
AC_MSG_CHECKING([for Python site-packages path])
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print distutils.sysconfig.get_python_lib(1,0);"`
|
||||
+ print(distutils.sysconfig.get_python_lib(1,0));"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_SITE_PKG])
|
||||
AC_SUBST([PYTHON_SITE_PKG])
|
||||
|
||||
#
|
||||
- # libraries which must be linked in when embedding
|
||||
- #
|
||||
- AC_MSG_CHECKING(python extra libraries)
|
||||
- if test -z "$PYTHON_EXTRA_LIBS"; then
|
||||
- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
- print conf('LOCALMODLIBS'), conf('LIBS')"`
|
||||
- fi
|
||||
- AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
|
||||
- AC_SUBST(PYTHON_EXTRA_LIBS)
|
||||
-
|
||||
- #
|
||||
- # linking flags needed when embedding
|
||||
- #
|
||||
- AC_MSG_CHECKING(python extra linking flags)
|
||||
- if test -z "$PYTHON_EXTRA_LDFLAGS"; then
|
||||
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
- print conf('LINKFORSHARED')"`
|
||||
- fi
|
||||
- AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
|
||||
- AC_SUBST(PYTHON_EXTRA_LDFLAGS)
|
||||
-
|
||||
- #
|
||||
# final check to see if everything compiles alright
|
||||
#
|
||||
AC_MSG_CHECKING([consistency of all components of python development environment])
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 26e8abc..a22ddc9 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -465,7 +465,7 @@ if test x_$ub_test_python != x_no; then
|
||||
ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
|
||||
AC_PYTHON_DEVEL
|
||||
if test ! -z "$PYTHON_VERSION"; then
|
||||
- if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
|
||||
+ if test `$PYTHON -c "print('$PYTHON_VERSION' >= '2.4.0')"` = "False"; then
|
||||
AC_ERROR([Python version >= 2.4.0 is required])
|
||||
fi
|
||||
|
||||
diff --git a/libunbound/python/examples/async-lookup.py b/libunbound/python/examples/async-lookup.py
|
||||
index 52a2d3c..cbb8ea0 100644
|
||||
--- a/libunbound/python/examples/async-lookup.py
|
||||
+++ b/libunbound/python/examples/async-lookup.py
|
||||
@@ -39,9 +39,9 @@ ctx = unbound.ub_ctx()
|
||||
ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
def call_back(my_data,status,result):
|
||||
- print "Call_back:", my_data
|
||||
+ print("Call_back:", my_data)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:", result.data.address_list
|
||||
+ print("Result:", result.data.address_list)
|
||||
my_data['done_flag'] = True
|
||||
|
||||
|
||||
@@ -53,4 +53,4 @@ while (status == 0) and (not my_data['done_flag']):
|
||||
time.sleep(0.1)
|
||||
|
||||
if (status != 0):
|
||||
- print "Resolve error:", unbound.ub_strerror(status)
|
||||
+ print("Resolve error:", unbound.ub_strerror(status))
|
||||
diff --git a/libunbound/python/examples/dns-lookup.py b/libunbound/python/examples/dns-lookup.py
|
||||
index 2821ed3..b3f4008 100644
|
||||
--- a/libunbound/python/examples/dns-lookup.py
|
||||
+++ b/libunbound/python/examples/dns-lookup.py
|
||||
@@ -39,6 +39,6 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("www.nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:", result.data.address_list
|
||||
+ print("Result:", result.data.address_list)
|
||||
elif status != 0:
|
||||
- print "Error:", unbound.ub_strerror(status)
|
||||
+ print("Error:", unbound.ub_strerror(status))
|
||||
diff --git a/libunbound/python/examples/dnssec-valid.py b/libunbound/python/examples/dnssec-valid.py
|
||||
index 3e05ddd..5c3cad9 100644
|
||||
--- a/libunbound/python/examples/dnssec-valid.py
|
||||
+++ b/libunbound/python/examples/dnssec-valid.py
|
||||
@@ -48,12 +48,12 @@ if os.path.isfile("keys"):
|
||||
status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
|
||||
- print "Result:", result.data.address_list
|
||||
+ print("Result:", result.data.address_list)
|
||||
|
||||
if result.secure:
|
||||
- print "Result is secure"
|
||||
+ print("Result is secure")
|
||||
elif result.bogus:
|
||||
- print "Result is bogus"
|
||||
+ print("Result is bogus")
|
||||
else:
|
||||
- print "Result is insecure"
|
||||
+ print("Result is insecure")
|
||||
|
||||
diff --git a/libunbound/python/examples/dnssec_test.py b/libunbound/python/examples/dnssec_test.py
|
||||
index 138e19b..0d62b9f 100644
|
||||
--- a/libunbound/python/examples/dnssec_test.py
|
||||
+++ b/libunbound/python/examples/dnssec_test.py
|
||||
@@ -3,27 +3,27 @@ from unbound import ub_ctx, RR_TYPE_A, RR_TYPE_RRSIG, RR_TYPE_NSEC, RR_TYPE_NSEC
|
||||
import ldns
|
||||
|
||||
def dnssecParse(domain, rrType=RR_TYPE_A):
|
||||
- print "Resolving domain", domain
|
||||
+ print("Resolving domain", domain)
|
||||
s, r = resolver.resolve(domain)
|
||||
- print "status: %s, secure: %s, rcode: %s, havedata: %s, answer_len; %s" % (s, r.secure, r.rcode_str, r.havedata, r.answer_len)
|
||||
+ print("status: %s, secure: %s, rcode: %s, havedata: %s, answer_len; %s" % (s, r.secure, r.rcode_str, r.havedata, r.answer_len))
|
||||
|
||||
s, pkt = ldns.ldns_wire2pkt(r.packet)
|
||||
if s != 0:
|
||||
raise RuntimeError("Error parsing DNS packet")
|
||||
|
||||
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_ANSWER)
|
||||
- print "RRSIGs from answer:", rrsigs
|
||||
+ print("RRSIGs from answer:", rrsigs)
|
||||
|
||||
rrsigs = pkt.rr_list_by_type(RR_TYPE_RRSIG, ldns.LDNS_SECTION_AUTHORITY)
|
||||
- print "RRSIGs from authority:", rrsigs
|
||||
+ print("RRSIGs from authority:", rrsigs)
|
||||
|
||||
nsecs = pkt.rr_list_by_type(RR_TYPE_NSEC, ldns.LDNS_SECTION_AUTHORITY)
|
||||
- print "NSECs:", nsecs
|
||||
+ print("NSECs:", nsecs)
|
||||
|
||||
nsec3s = pkt.rr_list_by_type(RR_TYPE_NSEC3, ldns.LDNS_SECTION_AUTHORITY)
|
||||
- print "NSEC3s:", nsec3s
|
||||
+ print("NSEC3s:", nsec3s)
|
||||
|
||||
- print "---"
|
||||
+ print("---")
|
||||
|
||||
|
||||
resolver = ub_ctx()
|
||||
diff --git a/libunbound/python/examples/example8-1.py b/libunbound/python/examples/example8-1.py
|
||||
index 6816da0..ca868e5 100644
|
||||
--- a/libunbound/python/examples/example8-1.py
|
||||
+++ b/libunbound/python/examples/example8-1.py
|
||||
@@ -40,22 +40,22 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.mx_list:
|
||||
- print " priority:%d address:%s" % k
|
||||
+ print(" priority:%d address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.address_list:
|
||||
- print " address:%s" % k
|
||||
+ print(" address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.domain_list:
|
||||
- print " host: %s" % k
|
||||
+ print(" host: %s" % k)
|
||||
|
||||
diff --git a/libunbound/python/examples/idn-lookup.py b/libunbound/python/examples/idn-lookup.py
|
||||
index 7cfdc9e..2170637 100644
|
||||
--- a/libunbound/python/examples/idn-lookup.py
|
||||
+++ b/libunbound/python/examples/idn-lookup.py
|
||||
@@ -43,20 +43,20 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
#The unicode IDN string is automatically converted (if necessary)
|
||||
status, result = ctx.resolve(u"www.háčkyčárky.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.address_list:
|
||||
- print " address:%s" % k
|
||||
+ print(" address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve(u"háčkyčárky.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.mx_list_idn:
|
||||
- print " priority:%d address:%s" % k
|
||||
+ print(" priority:%d address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve(unbound.reverse('217.31.204.66')+'.in-addr.arpa', unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result.data:", result.data
|
||||
+ print("Result.data:", result.data)
|
||||
for k in result.data.domain_list_idn:
|
||||
- print " dname:%s" % k
|
||||
+ print(" dname:%s" % k)
|
||||
diff --git a/libunbound/python/examples/mx-lookup.py b/libunbound/python/examples/mx-lookup.py
|
||||
index cdcd1b1..f83f690 100644
|
||||
--- a/libunbound/python/examples/mx-lookup.py
|
||||
+++ b/libunbound/python/examples/mx-lookup.py
|
||||
@@ -40,14 +40,14 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_MX, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.mx_list:
|
||||
- print " priority:%d address:%s" % k
|
||||
+ print(" priority:%d address:%s" % k)
|
||||
|
||||
status, result = ctx.resolve("nic.cz", unbound.RR_TYPE_A, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.address_list:
|
||||
- print " address:%s" % k
|
||||
+ print(" address:%s" % k)
|
||||
diff --git a/libunbound/python/examples/ns-lookup.py b/libunbound/python/examples/ns-lookup.py
|
||||
index f9eafb2..bcd51de 100644
|
||||
--- a/libunbound/python/examples/ns-lookup.py
|
||||
+++ b/libunbound/python/examples/ns-lookup.py
|
||||
@@ -40,8 +40,8 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve("vutbr.cz", unbound.RR_TYPE_NS, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result:"
|
||||
- print " raw data:", result.data
|
||||
+ print("Result:")
|
||||
+ print(" raw data:", result.data)
|
||||
for k in result.data.domain_list:
|
||||
- print " host: %s" % k
|
||||
+ print(" host: %s" % k)
|
||||
|
||||
diff --git a/libunbound/python/examples/reverse-lookup.py b/libunbound/python/examples/reverse-lookup.py
|
||||
index 4d3e0bb..7e06844 100644
|
||||
--- a/libunbound/python/examples/reverse-lookup.py
|
||||
+++ b/libunbound/python/examples/reverse-lookup.py
|
||||
@@ -39,5 +39,5 @@ ctx.resolvconf("/etc/resolv.conf")
|
||||
|
||||
status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN)
|
||||
if status == 0 and result.havedata:
|
||||
- print "Result.data:", result.data, result.data.domain_list
|
||||
+ print("Result.data:", result.data, result.data.domain_list)
|
||||
|
||||
diff --git a/libunbound/python/libunbound.i b/libunbound/python/libunbound.i
|
||||
index 4f92799..313c748 100644
|
||||
--- a/libunbound/python/libunbound.i
|
||||
+++ b/libunbound/python/libunbound.i
|
||||
@@ -44,6 +44,15 @@
|
||||
|
||||
%pythoncode %{
|
||||
import encodings.idna
|
||||
+
|
||||
+ # Ensure compatibility with older python versions
|
||||
+ if 'bytes' not in vars():
|
||||
+ bytes = str
|
||||
+
|
||||
+ def ord(s):
|
||||
+ if isinstance(s, int):
|
||||
+ return s
|
||||
+ return __builtins__.ord(s)
|
||||
%}
|
||||
|
||||
//%include "doc.i"
|
||||
@@ -559,10 +568,10 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
:returns: * (int) 0 if OK, else error.
|
||||
* (:class:`ub_result`) the result data is returned in a newly allocated result structure. May be None on return, return value is set to an error in that case (out of memory).
|
||||
"""
|
||||
- if isinstance(name, unicode): #probably IDN
|
||||
- return _unbound.ub_resolve(self,idn2dname(name),rrtype,rrclass)
|
||||
- else:
|
||||
+ if isinstance(name, bytes): #probably IDN
|
||||
return _unbound.ub_resolve(self,name,rrtype,rrclass)
|
||||
+ else:
|
||||
+ return _unbound.ub_resolve(self,idn2dname(name),rrtype,rrclass)
|
||||
#parameters: struct ub_ctx *,char *,int,int,
|
||||
#retvals: int,struct ub_result **
|
||||
|
||||
@@ -597,10 +606,10 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
* `result` - the result structure. The result may be None, in that case err is set.
|
||||
|
||||
"""
|
||||
- if isinstance(name, unicode): #probably IDN
|
||||
- return _unbound._ub_resolve_async(self,idn2dname(name),rrtype,rrclass,mydata,callback)
|
||||
- else:
|
||||
+ if isinstance(name, bytes): #probably IDN
|
||||
return _unbound._ub_resolve_async(self,name,rrtype,rrclass,mydata,callback)
|
||||
+ else:
|
||||
+ return _unbound._ub_resolve_async(self,idn2dname(name),rrtype,rrclass,mydata,callback)
|
||||
#parameters: struct ub_ctx *,char *,int,int,void *,ub_callback_t,
|
||||
#retvals: int, int
|
||||
|
||||
@@ -689,7 +698,8 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
idx = ofs
|
||||
while (idx < slen):
|
||||
complen = ord(s[idx])
|
||||
- res.append(s[idx+1:idx+1+complen])
|
||||
+ # In python 3.x `str()` converts the string to unicode which is the expected text string type
|
||||
+ res.append(str(s[idx+1:idx+1+complen]))
|
||||
idx += complen + 1
|
||||
|
||||
return res
|
||||
@@ -764,13 +774,13 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
|
||||
|
||||
list = PyList_New(cnt);
|
||||
for (i=0;i<cnt;i++)
|
||||
- PyList_SetItem(list, i, PyString_FromStringAndSize(result->data[i],result->len[i]));
|
||||
+ PyList_SetItem(list, i, PyBytes_FromStringAndSize(result->data[i],result->len[i]));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
PyObject* _packet() {
|
||||
- return PyString_FromStringAndSize($self->answer_packet, $self->answer_len);
|
||||
+ return PyBytes_FromStringAndSize($self->answer_packet, $self->answer_len);
|
||||
}
|
||||
|
||||
%pythoncode %{
|
24
unbound.spec
24
unbound.spec
@ -2,6 +2,14 @@
|
||||
%{?!with_munin: %global with_munin 1}
|
||||
|
||||
%if %{with_python}
|
||||
%if 0%{?fedora} >= 22
|
||||
%global python python3
|
||||
%global __python %{__python3}
|
||||
%else
|
||||
%global python python2
|
||||
%global __python %{__python2}
|
||||
%endif
|
||||
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
%endif
|
||||
@ -11,7 +19,7 @@
|
||||
Summary: Validating, recursive, and caching DNS(SEC) resolver
|
||||
Name: unbound
|
||||
Version: 1.4.22
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: BSD
|
||||
Url: http://www.nlnetlabs.nl/unbound/
|
||||
Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
|
||||
@ -33,16 +41,20 @@ Source14: unbound.sysconfig
|
||||
Source15: unbound.cron
|
||||
Source16: unbound-munin.README
|
||||
Patch1: unbound-1.4.22-flushcache.patch
|
||||
# Support building with Python 3.x
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1115489
|
||||
Patch2: unbound-1.4.22-python3.patch
|
||||
|
||||
Group: System Environment/Daemons
|
||||
BuildRequires: flex, openssl-devel
|
||||
BuildRequires: libevent-devel expat-devel
|
||||
%if %{with_python}
|
||||
BuildRequires: python-devel swig
|
||||
BuildRequires: %{python}-devel swig
|
||||
%endif
|
||||
BuildRequires: systemd-units
|
||||
# Required for SVN versions
|
||||
# BuildRequires: bison
|
||||
BuildRequires: automake autoconf
|
||||
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
@ -106,8 +118,11 @@ Python modules and extensions for unbound
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
# This is needed to rebuild the configure script to support Python 3.x
|
||||
autoreconf
|
||||
export LDFLAGS="-Wl,-z,relro,-z,now -pie -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
|
||||
export CFLAGS="$RPM_OPT_FLAGS -fPIE -pie"
|
||||
export CXXFLAGS="$RPM_OPT_FLAGS -fPIE -pie"
|
||||
@ -116,7 +131,7 @@ export CXXFLAGS="$RPM_OPT_FLAGS -fPIE -pie"
|
||||
--with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \
|
||||
--with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \
|
||||
%if %{with_python}
|
||||
--with-pythonmodule --with-pyunbound \
|
||||
--with-pythonmodule --with-pyunbound PYTHON=%{__python} \
|
||||
%endif
|
||||
--enable-sha2 --disable-gost --disable-ecdsa \
|
||||
--with-rootkey-file=%{_sharedstatedir}/unbound/root.key
|
||||
@ -281,6 +296,9 @@ exit 0
|
||||
/bin/systemctl try-restart unbound-keygen.service >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Wed Sep 24 2014 Pavel Šimerda <psimerda@redhat.com> - 1.4.22-6
|
||||
- Resolves: #1115489 - build with python 3.x for fedora >= 22
|
||||
|
||||
* Thu Aug 21 2014 Kevin Fenzi <kevin@scrye.com> - 1.4.22-5
|
||||
- Rebuild for rpm bug 1131960
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user