1
0
mirror of https://git.freebsd.org/ports.git synced 2026-06-02 11:08:52 +00:00

filesystems/py-libzfs: 2.0.0

Truenas has abandoned this project.  I've made a personal fork and
applied various fixes there.  Switch the port to point at my fork.

https://github.com/asomers/py-libzfs/blob/master/CHANGELOG.md

Sponsored by:	ConnectWise
Reviewed by:	arrowd
Approved by:	ports (arrowd)
Differential Revision: https://reviews.freebsd.org/D57277
This commit is contained in:
Alan Somers
2026-05-27 10:09:41 -06:00
parent bddef8b9bc
commit ab895c9782
4 changed files with 8 additions and 101 deletions
+5 -24
View File
@@ -1,27 +1,23 @@
PORTNAME= libzfs
PORTVERSION= 1.1.2023020700
PORTREVISION= 4
DISTVERSIONPREFIX=v
DISTVERSION= 2.0.0
CATEGORIES= filesystems devel python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= asomers@FreeBSD.org
COMMENT= Python libzfs bindings
WWW= https://github.com/truenas/py-libzfs
WWW= https://github.com/asomers/py-libzfs
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
HAS_CONFIGURE= yes
USES= compiler:c11 python
USE_PYTHON= autoplist cython0 distutils
PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
PATCHFILES+= 666e8b6fdbbd4bb75f91e267be0e4c6378dd3558.diff:-p1 # backport of https://github.com/truenas/py-libzfs/pull/231
USE_PYTHON= autoplist cython distutils
USE_GITHUB= yes
GH_ACCOUNT= truenas
GH_ACCOUNT= asomers
GH_PROJECT= py-libzfs
GH_TAGNAME= c1bd4a0
CONFIGURE_ENV= freebsd_src=${SRC_BASE}
MAKE_ENV= freebsd_src=${SRC_BASE}
@@ -32,19 +28,4 @@ MAKE_ENV= freebsd_src=${SRC_BASE}
IGNORE= requires kernel source files in ${SRC_BASE}
.endif
.if ${OPSYS} == FreeBSD
PATCHFILES+= 0b2ab0594997c44e80e3fdfe9d2add106d81149a.diff:-p1 # backport of https://github.com/truenas/py-libzfs/pull/251
EXTRA_PATCHES+= ${FILESDIR}/extra-zpool-add.patch
.endif
.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1500000
PATCHFILES+= 0ce0c8be75ae4c8873824b3c6e8f0a1736cd673b.diff:-p1 # backport of https://github.com/truenas/py-libzfs/pull/297
PATCHFILES+= 9882ea5d43407b3be71621a2988e7cdaaf87aa09.diff:-p1 # backport of https://github.com/truenas/py-libzfs/pull/297
.endif
.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1600005
# https://github.com/truenas/py-libzfs/pull/310
EXTRA_PATCHES+= ${FILESDIR}/extra-libuutil.patch
.endif
.include <bsd.port.mk>
+3 -11
View File
@@ -1,11 +1,3 @@
TIMESTAMP = 1773915602
SHA256 (truenas-py-libzfs-1.1.2023020700-c1bd4a0_GH0.tar.gz) = 23b2d6e1b6ed78be2d12068f9b1b0b01270afaaf0f017817a5fb109d358aa818
SIZE (truenas-py-libzfs-1.1.2023020700-c1bd4a0_GH0.tar.gz) = 99656
SHA256 (0b2ab0594997c44e80e3fdfe9d2add106d81149a.diff) = 1fb37c3a678dbaadd47999f7d29631824a404561ca5f2237613d2b22b42fa138
SIZE (0b2ab0594997c44e80e3fdfe9d2add106d81149a.diff) = 1453
SHA256 (666e8b6fdbbd4bb75f91e267be0e4c6378dd3558.diff) = 4acc13d3257ba0457183527a36a0c65ad1c37b198008c99e2fb1d145fbb6709e
SIZE (666e8b6fdbbd4bb75f91e267be0e4c6378dd3558.diff) = 905
SHA256 (0ce0c8be75ae4c8873824b3c6e8f0a1736cd673b.diff) = 19b00cd7f7441ad705dba7b35c79cfc95eb2d1dd118636b74da6a1be581eb00c
SIZE (0ce0c8be75ae4c8873824b3c6e8f0a1736cd673b.diff) = 7515
SHA256 (9882ea5d43407b3be71621a2988e7cdaaf87aa09.diff) = 337ac1dda8890935e582f36eff551813ecb5d1a74f9ffe7c9fa23c0a2a7badca
SIZE (9882ea5d43407b3be71621a2988e7cdaaf87aa09.diff) = 10116
TIMESTAMP = 1779900212
SHA256 (asomers-py-libzfs-v2.0.0_GH0.tar.gz) = 6123ef4a8e7cc091cbf510f8b7176b8dea3ba15446af7b73e20676e44f5253b1
SIZE (asomers-py-libzfs-v2.0.0_GH0.tar.gz) = 99038
@@ -1,22 +0,0 @@
--- configure.orig 2025-12-09 20:43:08 UTC
+++ configure
@@ -3439,7 +3439,7 @@ CFLAGS="-DCYTHON_FALLTHROUGH"
esac
CFLAGS="-DCYTHON_FALLTHROUGH"
-LIBS="-lzfs -lnvpair -lzfs_core -luutil"
+LIBS="-lzfs -lnvpair -lzfs_core -lpthread"
if [ "${build_freebsd}" = "yes" ]; then
LIBS="-lgeom ${LIBS}"
--- setup.py.orig 2025-12-09 20:55:09 UTC
+++ setup.py
@@ -43,7 +43,7 @@ except ImportError:
config = namedtuple('config', ['CFLAGS', 'CPPFLAGS', 'LDFLAGS'])([], [], [])
-libraries = ['nvpair', 'zfs', 'zfs_core', 'uutil']
+libraries = ['nvpair', 'zfs', 'zfs_core']
if platform.system().lower() == 'freebsd':
libraries.append('geom')
@@ -1,44 +0,0 @@
From b5ffe1f1d6097df6e2f5cc6dd3c968872ec60804 Mon Sep 17 00:00:00 2001
From: Ameer Hamza <ahamza@ixsystems.com>
Date: Tue, 2 Apr 2024 23:56:55 +0500
Subject: [PATCH] zpool_add API changed in upstream zfs master
---
libzfs.pyx | 5 +++--
pxd/libzfs.pxd | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libzfs.pyx b/libzfs.pyx
index a59fca8..71efa96 100644
--- a/libzfs.pyx
+++ ./libzfs.pyx
@@ -3175,13 +3175,14 @@ cdef class ZFSPool(object):
hopts = self.root.generate_history_opts(fsopts, '-o')
self.root.write_history('zfs create', hopts, name)
- def attach_vdevs(self, vdevs_tree):
+ def attach_vdevs(self, vdevs_tree, check_ashift=0):
cdef const char *command = 'zpool add'
cdef ZFSVdev vd = self.root.make_vdev_tree(vdevs_tree, {'ashift': self.properties['ashift'].parsed})
cdef int ret
+ cdef boolean_t ashift = check_ashift
with nogil:
- ret = libzfs.zpool_add(self.handle, vd.nvlist.handle)
+ ret = libzfs.zpool_add(self.handle, vd.nvlist.handle, ashift)
if ret != 0:
raise self.root.get_error()
diff --git a/pxd/libzfs.pxd b/pxd/libzfs.pxd
index 3ab9374..6afa275 100644
--- a/pxd/libzfs.pxd
+++ ./pxd/libzfs.pxd
@@ -228,7 +228,7 @@ cdef extern from "libzfs.h" nogil:
extern int zpool_create(libzfs_handle_t *, const char *, nvpair.nvlist_t *,
nvpair.nvlist_t *, nvpair.nvlist_t *)
extern int zpool_destroy(zpool_handle_t *, const char *)
- extern int zpool_add(zpool_handle_t *, nvpair.nvlist_t *)
+ extern int zpool_add(zpool_handle_t *, nvpair.nvlist_t *, boolean_t)
IF HAVE_ZPOOL_SCAN == 3:
extern int zpool_scan(zpool_handle_t *, zfs.pool_scan_func_t, zfs.pool_scrub_cmd_t)