git: 26eecc68d56b - main - devel/py-libzfs: Unbreak on FreeBSD 15 by pulling a patch from upstream

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Mon, 08 Jul 2024 14:03:49 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=26eecc68d56b64a3299a565569809ec387fa4b19

commit 26eecc68d56b64a3299a565569809ec387fa4b19
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-07-08 14:03:01 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-07-08 14:03:44 +0000

    devel/py-libzfs: Unbreak on FreeBSD 15 by pulling a patch from upstream
    
    PR:             279450
---
 devel/py-libzfs/Makefile                    |  4 +++
 devel/py-libzfs/files/extra-zpool-add.patch | 44 +++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/devel/py-libzfs/Makefile b/devel/py-libzfs/Makefile
index 0cd22c4a3932..f68d645c2054 100644
--- a/devel/py-libzfs/Makefile
+++ b/devel/py-libzfs/Makefile
@@ -24,6 +24,10 @@ MAKE_ENV=	freebsd_src=${SRC_BASE}
 
 .include <bsd.port.options.mk>
 
+.if ${OSVERSION} >= 1500000
+EXTRA_PATCHES+=	${FILESDIR}/extra-zpool-add.patch
+.endif
+
 .if !exists(${SRC_BASE}/sys/Makefile)
 IGNORE=		requires kernel source files in ${SRC_BASE}
 .endif
diff --git a/devel/py-libzfs/files/extra-zpool-add.patch b/devel/py-libzfs/files/extra-zpool-add.patch
new file mode 100644
index 000000000000..7d0688ca4f13
--- /dev/null
+++ b/devel/py-libzfs/files/extra-zpool-add.patch
@@ -0,0 +1,44 @@
+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)