SWIG 4.2 and i686 compatibility
Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
af48b855ac
commit
15dbd0729d
26
ldns-swig-32bit.patch
Normal file
26
ldns-swig-32bit.patch
Normal file
@ -0,0 +1,26 @@
|
||||
32-bit compatibility for Python SWIG bindings
|
||||
|
||||
The ssize_t type can be int instead of long, and the pointer types are
|
||||
incompatible.
|
||||
|
||||
Submitted upstream: <https://github.com/NLnetLabs/ldns/pull/233>
|
||||
|
||||
diff -ur ldns-1.8.3.orig/ldns-1.8.3/contrib/python/ldns.i ldns-1.8.3/ldns-1.8.3/contrib/python/ldns.i
|
||||
--- ldns-1.8.3.orig/ldns-1.8.3/contrib/python/ldns.i 2022-08-15 12:38:22.000000000 +0200
|
||||
+++ ldns-1.8.3/ldns-1.8.3/contrib/python/ldns.i 2024-01-26 11:46:55.329133288 +0100
|
||||
@@ -99,12 +99,14 @@
|
||||
%typemap(in, noblock=1) (ssize_t)
|
||||
{
|
||||
int $1_res = 0;
|
||||
- $1_res = SWIG_AsVal_long($input, &$1);
|
||||
+ long val;
|
||||
+ $1_res = SWIG_AsVal_long($input, &val);
|
||||
if (!SWIG_IsOK($1_res)) {
|
||||
SWIG_exception_fail(SWIG_ArgError($1_res), "in method '"
|
||||
"$symname" "', argument " "$argnum" " of type '"
|
||||
"$type""'");
|
||||
}
|
||||
+ $1 = val;
|
||||
}
|
||||
|
||||
|
||||
60
ldns-swig-4.2.patch
Normal file
60
ldns-swig-4.2.patch
Normal file
@ -0,0 +1,60 @@
|
||||
SWIG_Python_str_AsChar removal in SWIG 4.2.0
|
||||
|
||||
The replacement, SWIG_PyUnicode_AsUTF8AndSize, has different memory
|
||||
management requirements.
|
||||
|
||||
Submitted upstream: <https://github.com/NLnetLabs/ldns/pull/232>
|
||||
|
||||
diff -ur ldns-1.8.3.orig/ldns-1.8.3/contrib/python/ldns_rdf.i ldns-1.8.3/ldns-1.8.3/contrib/python/ldns_rdf.i
|
||||
--- ldns-1.8.3.orig/ldns-1.8.3/contrib/python/ldns_rdf.i 2022-08-15 12:38:22.000000000 +0200
|
||||
+++ ldns-1.8.3/ldns-1.8.3/contrib/python/ldns_rdf.i 2024-01-26 11:28:52.983540469 +0100
|
||||
@@ -56,7 +56,11 @@
|
||||
*/
|
||||
%typemap(arginit, noblock=1) const ldns_rdf *
|
||||
{
|
||||
+#if SWIG_VERSION >= 0x040200
|
||||
+ PyObject *$1_bytes = NULL;
|
||||
+#else
|
||||
char *$1_str = NULL;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -66,11 +70,17 @@
|
||||
%typemap(in, noblock=1) const ldns_rdf * (void* argp, $1_ltype tmp = 0, int res)
|
||||
{
|
||||
if (Python_str_Check($input)) {
|
||||
+ const char *argstr;
|
||||
+#if SWIG_VERSION >= 0x040200
|
||||
+ argstr = SWIG_PyUnicode_AsUTF8AndSize($input, NULL, &$1_bytes);
|
||||
+#else
|
||||
$1_str = SWIG_Python_str_AsChar($input);
|
||||
- if ($1_str == NULL) {
|
||||
+ argstr = $1_str;
|
||||
+#endif
|
||||
+ if (argstr == NULL) {
|
||||
%argument_fail(SWIG_TypeError, "char *", $symname, $argnum);
|
||||
}
|
||||
- tmp = ldns_dname_new_frm_str($1_str);
|
||||
+ tmp = ldns_dname_new_frm_str(argstr);
|
||||
if (tmp == NULL) {
|
||||
%argument_fail(SWIG_TypeError, "char *", $symname, $argnum);
|
||||
}
|
||||
@@ -90,10 +100,17 @@
|
||||
*/
|
||||
%typemap(freearg, noblock=1) const ldns_rdf *
|
||||
{
|
||||
+#if SWIG_VERSION >= 0x040200
|
||||
+ if ($1_bytes != NULL) {
|
||||
+ /* Is not NULL only when a conversion form string occurred. */
|
||||
+ Py_XDECREF($1_bytes);
|
||||
+ }
|
||||
+#else
|
||||
if ($1_str != NULL) {
|
||||
/* Is not NULL only when a conversion form string occurred. */
|
||||
SWIG_Python_str_DelForPy3($1_str); /* Is a empty macro for Python < 3. */
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
%nodefaultctor ldns_struct_rdf; /* No default constructor. */
|
||||
@ -37,7 +37,7 @@
|
||||
Summary: Low-level DNS(SEC) library with API
|
||||
Name: ldns
|
||||
Version: 1.8.3
|
||||
Release: 12%{?dist}
|
||||
Release: 13%{?dist}
|
||||
|
||||
License: BSD-3-Clause
|
||||
Url: https://www.nlnetlabs.nl/%{name}/
|
||||
@ -50,6 +50,10 @@ Patch1: ldns-1.7.0-multilib.patch
|
||||
Patch2: ldns-1.8-python-dirs.patch
|
||||
# https://github.com/NLnetLabs/ldns/pull/230
|
||||
Patch3: ldns-1.8-root-servers.net.patch
|
||||
# https://github.com/NLnetLabs/ldns/pull/232
|
||||
Patch4: ldns-swig-4.2.patch
|
||||
# https://github.com/NLnetLabs/ldns/pull/233
|
||||
Patch5: ldns-swig-32bit.patch
|
||||
|
||||
BuildRequires: libtool
|
||||
BuildRequires: autoconf
|
||||
@ -357,6 +361,9 @@ rm -rf doc/man
|
||||
%doc doc
|
||||
|
||||
%changelog
|
||||
* Fri Jan 26 2024 Florian Weimer <fweimer@redhat.com> - 1.8.3-13
|
||||
- SWIG 4.2 and i686 compatibility
|
||||
|
||||
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.3-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user