diff mbox series

[v1,2/2] package/python-sysrepo: new package

Message ID 20260107175446.2470125-3-vjardin@free.fr
State New
Headers show
Series Add python-libyang and python-sysrepo packages | expand

Commit Message

Vincent Jardin Jan. 7, 2026, 5:54 p.m. UTC
Python CFFI bindings for the sysrepo YANG datastore. This package
provides the 'sysrepo' Python module which talks to the C sysrepo
library.

Also fix sysrepo build on riscv32 where glibc doesn't define
SYS_futex (only SYS_futex_time64). Use pthread-based condition
variables instead of futex on this architecture.

Upstream: https://github.com/sysrepo/sysrepo/issues/3346

Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
 package/python-sysrepo/Config.in           | 26 ++++++++++++++++++++++
 package/python-sysrepo/python-sysrepo.hash |  5 +++++
 package/python-sysrepo/python-sysrepo.mk   | 18 +++++++++++++++
 package/sysrepo/sysrepo.mk                 |  7 ++++++
 4 files changed, 56 insertions(+)
 create mode 100644 package/python-sysrepo/Config.in
 create mode 100644 package/python-sysrepo/python-sysrepo.hash
 create mode 100644 package/python-sysrepo/python-sysrepo.mk

Comments

Thomas Petazzoni Jan. 7, 2026, 10:45 p.m. UTC | #1
Hello Vincent,

Thanks for the patch.

On Wed,  7 Jan 2026 18:54:46 +0100
Vincent Jardin via buildroot <buildroot@buildroot.org> wrote:

> Python CFFI bindings for the sysrepo YANG datastore. This package
> provides the 'sysrepo' Python module which talks to the C sysrepo
> library.
> 
> Also fix sysrepo build on riscv32 where glibc doesn't define
> SYS_futex (only SYS_futex_time64). Use pthread-based condition
> variables instead of futex on this architecture.


> 
> Upstream: https://github.com/sysrepo/sysrepo/issues/3346
> 
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> ---
>  package/python-sysrepo/Config.in           | 26 ++++++++++++++++++++++
>  package/python-sysrepo/python-sysrepo.hash |  5 +++++
>  package/python-sysrepo/python-sysrepo.mk   | 18 +++++++++++++++
>  package/sysrepo/sysrepo.mk                 |  7 ++++++
>  4 files changed, 56 insertions(+)

Missing changes in DEVELOPERS and package/Config.in (because they are
mistakenly in PATCH 1/2).

> diff --git a/package/python-sysrepo/Config.in b/package/python-sysrepo/Config.in
> new file mode 100644
> index 0000000000..ce6b8611f2
> --- /dev/null
> +++ b/package/python-sysrepo/Config.in
> @@ -0,0 +1,26 @@
> +config BR2_PACKAGE_PYTHON_SYSREPO
> +	bool "python-sysrepo"
> +	depends on BR2_PACKAGE_PYTHON3

Not needed.

> +	depends on BR2_PACKAGE_SYSREPO

Should be a "select" + replication of sysrepo "depends on".

> +	# Python3 doesn't work with uClibc and kernel headers < 5.1
> +	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1

Not needed.

> +	select BR2_PACKAGE_PYTHON_LIBYANG

select BR2_PACKAGE_PYTHON_LIBYANG # runtime

> +	help
> +	  Python CFFI bindings for the sysrepo YANG datastore.
> +
> +	  This package provides the 'sysrepo' Python module which
> +	  talks to the C sysrepo library packaged as
> +	  BR2_PACKAGE_SYSREPO.
> +
> +	  Upstream project name on PyPI is 'sysrepo'.
> +
> +	  https://github.com/sysrepo/sysrepo-python
> +
> +comment "python-sysrepo needs python3, uClibc needs kernel headers >= 5.1"
> +	depends on !BR2_PACKAGE_PYTHON3 || \
> +		(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1)

To be updated based on the actual dependencies.

> +comment "python-sysrepo needs sysrepo"
> +	depends on BR2_PACKAGE_PYTHON3
> +	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
> +	depends on !BR2_PACKAGE_SYSREPO

Not needed.

> diff --git a/package/python-sysrepo/python-sysrepo.mk b/package/python-sysrepo/python-sysrepo.mk
> new file mode 100644
> index 0000000000..5e9e97df25
> --- /dev/null
> +++ b/package/python-sysrepo/python-sysrepo.mk
> @@ -0,0 +1,18 @@
> +################################################################################
> +#
> +# python-sysrepo
> +#
> +################################################################################
> +
> +PYTHON_SYSREPO_VERSION = 1.7.6
> +PYTHON_SYSREPO_SOURCE = sysrepo-$(PYTHON_SYSREPO_VERSION).tar.gz
> +PYTHON_SYSREPO_SITE = https://files.pythonhosted.org/packages/source/s/sysrepo
> +PYTHON_SYSREPO_SETUP_TYPE = setuptools
> +
> +PYTHON_SYSREPO_LICENSE = BSD-3-Clause
> +PYTHON_SYSREPO_LICENSE_FILES = LICENSE
> +
> +PYTHON_SYSREPO_DEPENDENCIES = sysrepo
> +PYTHON_SYSREPO_DEPENDENCIES += python-libyang

Are you sure python-libyang is a build-time dependency, or is it only a
runtime dependency?

Also, with Python packages, it's always good to have a minimal test
case in support/testing/.

> diff --git a/package/sysrepo/sysrepo.mk b/package/sysrepo/sysrepo.mk
> index 59dc59a5df..329c0ee7c6 100644
> --- a/package/sysrepo/sysrepo.mk
> +++ b/package/sysrepo/sysrepo.mk
> @@ -26,6 +26,13 @@ ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
>  SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
>  endif
>  
> +# riscv32 glibc doesn't define SYS_futex (only SYS_futex_time64)
> +# Use pthread-based condition variables instead of futex
> +# https://github.com/sysrepo/sysrepo/issues/3346
> +ifeq ($(BR2_RISCV_32),y)
> +SYSREPO_CONF_OPTS += -DSR_COND_IMPL=sr_cond_pthread
> +endif

This is unrelated and should really be in its own patch. I guess it fixes:

  https://autobuild.buildroot.net/results/b0f/b0f30feeddad1a8d51ac87af8b7c56fd9a9b5ff6/build-end.log

Correct?

If yes, then you should indicate in the patch that it fixes a build
issue, have the link to the autobuilder failure, and indicate when the
issue was introduced, so that we can understand if the fix should be
backported to our 2025.02 LTS branch.

Thanks a lot!

Thomas
diff mbox series

Patch

diff --git a/package/python-sysrepo/Config.in b/package/python-sysrepo/Config.in
new file mode 100644
index 0000000000..ce6b8611f2
--- /dev/null
+++ b/package/python-sysrepo/Config.in
@@ -0,0 +1,26 @@ 
+config BR2_PACKAGE_PYTHON_SYSREPO
+	bool "python-sysrepo"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on BR2_PACKAGE_SYSREPO
+	# Python3 doesn't work with uClibc and kernel headers < 5.1
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	select BR2_PACKAGE_PYTHON_LIBYANG
+	help
+	  Python CFFI bindings for the sysrepo YANG datastore.
+
+	  This package provides the 'sysrepo' Python module which
+	  talks to the C sysrepo library packaged as
+	  BR2_PACKAGE_SYSREPO.
+
+	  Upstream project name on PyPI is 'sysrepo'.
+
+	  https://github.com/sysrepo/sysrepo-python
+
+comment "python-sysrepo needs python3, uClibc needs kernel headers >= 5.1"
+	depends on !BR2_PACKAGE_PYTHON3 || \
+		(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1)
+
+comment "python-sysrepo needs sysrepo"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	depends on !BR2_PACKAGE_SYSREPO
diff --git a/package/python-sysrepo/python-sysrepo.hash b/package/python-sysrepo/python-sysrepo.hash
new file mode 100644
index 0000000000..4b70cd12da
--- /dev/null
+++ b/package/python-sysrepo/python-sysrepo.hash
@@ -0,0 +1,5 @@ 
+# From https://pypi.org/pypi/sysrepo/1.7.6/json
+sha256  d257f20ed134c00676ef38ce858a4e16ca573214d9fbf03078383f0ef8d17641  sysrepo-1.7.6.tar.gz
+
+# Locally computed
+sha256  c47e5249d2dff016106bf7395df1d94c7c5d74a36d64b81d96637f1f25dff4da  LICENSE
diff --git a/package/python-sysrepo/python-sysrepo.mk b/package/python-sysrepo/python-sysrepo.mk
new file mode 100644
index 0000000000..5e9e97df25
--- /dev/null
+++ b/package/python-sysrepo/python-sysrepo.mk
@@ -0,0 +1,18 @@ 
+################################################################################
+#
+# python-sysrepo
+#
+################################################################################
+
+PYTHON_SYSREPO_VERSION = 1.7.6
+PYTHON_SYSREPO_SOURCE = sysrepo-$(PYTHON_SYSREPO_VERSION).tar.gz
+PYTHON_SYSREPO_SITE = https://files.pythonhosted.org/packages/source/s/sysrepo
+PYTHON_SYSREPO_SETUP_TYPE = setuptools
+
+PYTHON_SYSREPO_LICENSE = BSD-3-Clause
+PYTHON_SYSREPO_LICENSE_FILES = LICENSE
+
+PYTHON_SYSREPO_DEPENDENCIES = sysrepo
+PYTHON_SYSREPO_DEPENDENCIES += python-libyang
+
+$(eval $(python-package))
diff --git a/package/sysrepo/sysrepo.mk b/package/sysrepo/sysrepo.mk
index 59dc59a5df..329c0ee7c6 100644
--- a/package/sysrepo/sysrepo.mk
+++ b/package/sysrepo/sysrepo.mk
@@ -26,6 +26,13 @@  ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
 SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
+# riscv32 glibc doesn't define SYS_futex (only SYS_futex_time64)
+# Use pthread-based condition variables instead of futex
+# https://github.com/sysrepo/sysrepo/issues/3346
+ifeq ($(BR2_RISCV_32),y)
+SYSREPO_CONF_OPTS += -DSR_COND_IMPL=sr_cond_pthread
+endif
+
 define SYSREPO_INSTALL_INIT_SYSV
 	$(INSTALL) -m 755 -D package/sysrepo/S51sysrepo-plugind \
 		$(TARGET_DIR)/etc/init.d/S51sysrepo-plugind