pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
py-netsnmp-cffi: fix definition of time types on NetBSD.
Module Name: pkgsrc-wip
Committed By: Havard Eidnes <he%NetBSD.org@localhost>
Pushed By: he
Date: Wed Apr 23 01:29:21 2025 +0200
Changeset: 93c68c6863c38589ff35892aeb8405db0d190d6f
Modified Files:
py-netsnmp-cffi/Makefile
py-netsnmp-cffi/PLIST
py-netsnmp-cffi/distinfo
Added Files:
py-netsnmp-cffi/patches/patch-src_netsnmpy_netsnmp__ffi.py
Log Message:
py-netsnmp-cffi: fix definition of time types on NetBSD.
Apparently, we can't use preprocessor macros in the limited C
dialect python's ffi understands, so this is another way to work
around this problem: via a patch and substitution from the Makefile.
This fixes it at least for NetBSD, but non-Linux and non-NetBSD are
probably left out in the cold. A better way to solve this would
be nice.
Bump PKGREVISION.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=93c68c6863c38589ff35892aeb8405db0d190d6f
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
py-netsnmp-cffi/Makefile | 26 +++++++++++++++++++++-
py-netsnmp-cffi/PLIST | 2 +-
py-netsnmp-cffi/distinfo | 1 +
.../patches/patch-src_netsnmpy_netsnmp__ffi.py | 21 +++++++++++++++++
4 files changed, 48 insertions(+), 2 deletions(-)
diffs:
diff --git a/py-netsnmp-cffi/Makefile b/py-netsnmp-cffi/Makefile
index 4ff607f053..a551690736 100644
--- a/py-netsnmp-cffi/Makefile
+++ b/py-netsnmp-cffi/Makefile
@@ -2,6 +2,7 @@
DISTNAME= netsnmp-cffi-0.1.1
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_GITHUB:=Uninett/}
GITHUB_PROJECT= netsnmp-cffi
@@ -15,11 +16,34 @@ USE_LANGUAGES+= c
# Needs python >= 39
PYTHON_VERSIONS_INCOMPATIBLE+= 27
-MAKE_ENV+= SETUPTOOLS_SCM_PRETEND_VERSION=${PKGVERSION}
+MAKE_ENV+= SETUPTOOLS_SCM_PRETEND_VERSION=${PKGVERSION_NOREV}
TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools>=70.1:../../devel/py-setuptools
DEPENDS+= ${PYPKGPREFIX}-cffi-[0-9]*:../../devel/py-cffi
+.include "../../mk/bsd.prefs.mk"
+
+.if ${MACHINE_PLATFORM:MNetBSD-*}
+TIME_T_CMD= ${CC} -E -dD - </dev/null | \
+ sed -n -e '/__UINT64_TYPE__/s/\#define __UINT64_TYPE__ //p'
+TIME_T= ${TIME_T_CMD:sh}
+SUSECONDS_T= int
+.else
+# what was there before, applies at least on Linux:
+TIME_T= long
+SUSECONDS_T= long
+.endif
+FIX_TIME_T= src/netsnmpy/netsnmp_ffi.py
+
+pre-configure:
+ cd ${WRKSRC}; \
+ for f in ${FIX_TIME_T}; do \
+ sed -e "s/@TIME_T@/${TIME_T}/g" <$$f >$$f.new; \
+ mv $$f.new $$f; \
+ sed -e "s/@SUSECONDS_T@/${SUSECONDS_T}/g" <$$f >$$f.new; \
+ mv $$f.new $$f; \
+ done
+
.include "../../net/net-snmp/buildlink3.mk"
.include "../../lang/python/wheel.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/py-netsnmp-cffi/PLIST b/py-netsnmp-cffi/PLIST
index c50e53df55..ff3b1977b2 100644
--- a/py-netsnmp-cffi/PLIST
+++ b/py-netsnmp-cffi/PLIST
@@ -1,10 +1,10 @@
@comment $NetBSD$
bin/asnmpget
-${PYSITELIB}/${WHEEL_INFODIR}/LICENSE
${PYSITELIB}/${WHEEL_INFODIR}/METADATA
${PYSITELIB}/${WHEEL_INFODIR}/RECORD
${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
${PYSITELIB}/${WHEEL_INFODIR}/entry_points.txt
+${PYSITELIB}/${WHEEL_INFODIR}/licenses/LICENSE
${PYSITELIB}/${WHEEL_INFODIR}/top_level.txt
${PYSITELIB}/netsnmpy/__init__.py
${PYSITELIB}/netsnmpy/__init__.pyc
diff --git a/py-netsnmp-cffi/distinfo b/py-netsnmp-cffi/distinfo
index 83e3a31619..e51023e1f2 100644
--- a/py-netsnmp-cffi/distinfo
+++ b/py-netsnmp-cffi/distinfo
@@ -3,3 +3,4 @@ $NetBSD$
BLAKE2s (netsnmp-cffi-0.1.1.tar.gz) = 10d75260cfca2be08f73f7ff0e8726a3eec2b351a6a6c8f136d0a4ddea087d37
SHA512 (netsnmp-cffi-0.1.1.tar.gz) = 1f0be1e2af13364f3b93c7dc26e2f78d57e9f9120185fe4b85251e4b0a7417117a83dd3626abd2874a6b1ce99cbd1d7e42198b1159bd7b715b51084a9e121311
Size (netsnmp-cffi-0.1.1.tar.gz) = 38212 bytes
+SHA1 (patch-src_netsnmpy_netsnmp__ffi.py) = de719c36fecb5e9c48011e0ed88c424123498b21
diff --git a/py-netsnmp-cffi/patches/patch-src_netsnmpy_netsnmp__ffi.py b/py-netsnmp-cffi/patches/patch-src_netsnmpy_netsnmp__ffi.py
new file mode 100644
index 0000000000..2a1b8f9c6f
--- /dev/null
+++ b/py-netsnmp-cffi/patches/patch-src_netsnmpy_netsnmp__ffi.py
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Provide a hook to replace correct type for time_t and suseconds_t.
+See pre-configure target.
+
+--- src/netsnmpy/netsnmp_ffi.py.orig 2025-02-19 13:40:58.000000000 +0000
++++ src/netsnmpy/netsnmp_ffi.py
+@@ -20,9 +20,11 @@ typedef unsigned short u_short;
+ typedef unsigned char u_char;
+ typedef unsigned int u_int;
+ typedef unsigned long oid;
++typedef @TIME_T@ time_t; /* @TIME_T@ substituted by pre-configure target */
++typedef @SUSECONDS_T@ suseconds_t; /* also done by pre-configure target */
+ typedef struct timeval {{
+- long tv_sec;
+- long tv_usec;
++ time_t tv_sec;
++ suseconds_t tv_usec;
+ }};
+
+
Home |
Main Index |
Thread Index |
Old Index