Skip to contentSkip to conversation

Improve sysrepo support

PATCH New Jan Kundrát 4 participants 27 messages Dec 4, 2019 – Dec 22, 2019

lore
Share & tools
lore
#0 lore raw

cover Improve sysrepo support

This patch series synces up current Buildroot support (thanks for submitting it, Heiko) with what I have been using for 2+ years. I still have a few pending patches for Netopeer2 in my queue, please expect them later this week.

Jan Kundr?t (7):
libyang: Optional C++ bindings
sysrepo: fix a typo when installing with systemd
sysrepo: libnetconf2 is not needed
sysrepo: Optional support for C++ bindings
sysrepo: Use a common repository location
libnetconf2: adjust dependencies
Add me as a maintainer for the NETCONF stack

 DEVELOPERS                    |  3 +++
 package/libnetconf2/Config.in |  4 ++++
 package/libyang/Config.in     | 10 ++++++++++
 package/libyang/libyang.mk    |  7 +++++++
 package/sysrepo/Config.in     |  7 ++++++-
 package/sysrepo/sysrepo.mk    | 22 ++++++++++++++++++----
 6 files changed, 48 insertions(+), 5 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/7 libyang: Optional C++ bindings

---
 package/libyang/Config.in  | 10 ++++++++++
 package/libyang/libyang.mk |  7 +++++++
 2 files changed, 17 insertions(+)
package/libyang/Config.in +10 -0
index fec1160a6f..fc598af8e1 100644
@@ -10,5 +10,15 @@ config BR2_PACKAGE_LIBYANG
 
 	  https://github.com/CESNET/libyang
 
+if BR2_PACKAGE_LIBYANG
+
+config BR2_PACKAGE_LIBYANG_CPP
+	bool "Enable libyang C++ bindings"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
+	help
+	  Build the C++ wrapper around libyang.
+
+endif
+
 comment "libyang needs a toolchain w/ threads, dynamic library"
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
package/libyang/libyang.mk +7 -0
index cfec08cd16..87a1a4ef7c 100644
@@ -21,5 +21,12 @@ HOST_LIBYANG_CONF_OPTS = \
 	-DENABLE_VALGRIND_TESTS=OFF \
 	-DGEN_PYTHON_BINDINGS=OFF
 
+ifdef BR2_PACKAGE_LIBYANG_CPP
+	LIBYANG_DEPENDENCIES += host-swig
+	HOST_LIBYANG_DEPENDENCIES += host-swig
+	LIBYANG_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+	HOST_LIBYANG_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+endif
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
Signature · 1 line
2.21.0
#2 lore raw

PATCH 1/7 libyang: Optional C++ bindings

Hi,

Quoted 39 lines

-----Urspr?ngliche Nachricht-----
Von: buildroot [mailto:buildroot-bounces at busybox.net] Im Auftrag von Jan Kundr?t
Gesendet: Mittwoch, 4. Oktober 2017 07:49
An: buildroot at buildroot.org
Cc: Heiko Thiery; Fabrice Fontaine
Betreff: [Buildroot] [PATCH 1/7] libyang: Optional C++ bindings

---
 package/libyang/Config.in  | 10 ++++++++++  package/libyang/libyang.mk |  7
+++++++
 2 files changed, 17 insertions(+)
package/libyang/Config.in index renamed from package/libyang/Config.in +0 -0

fec1160a6f..fc598af8e1 100644

package/libyang/Config.in +10 -1
@@ -10,5 +10,15 @@ config BR2_PACKAGE_LIBYANG
 
 	  https://github.com/CESNET/libyang
 
+if BR2_PACKAGE_LIBYANG
+
+config BR2_PACKAGE_LIBYANG_CPP
+	bool "Enable libyang C++ bindings"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
+	help
+	  Build the C++ wrapper around libyang.
+
+endif
+
 comment "libyang needs a toolchain w/ threads, dynamic library"
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS diff
--git a/package/libyang/libyang.mk b/package/libyang/libyang.mk index

cfec08cd16..87a1a4ef7c 100644

package/libyang/libyang.mk HOST_LIBYANG_CONF_OPTS = \ · line 27

Quoted 7 lines
package/libyang/libyang.mk +4 -0
@@ -21,5 +21,12 @@ HOST_LIBYANG_CONF_OPTS = \
 	-DENABLE_VALGRIND_TESTS=OFF \
 	-DGEN_PYTHON_BINDINGS=OFF
 
+ifdef BR2_PACKAGE_LIBYANG_CPP
+	LIBYANG_DEPENDENCIES += host-swig
+	HOST_LIBYANG_DEPENDENCIES += host-swig
+	LIBYANG_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF

GEN_PYTHON_BINDINGS=OFF is already set for target and host config above. Should we disable JAVA bindings there also by default?

Quoted 13 lines
package/libyang/libyang.mk +3 -1
+	HOST_LIBYANG_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+endif
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
--

2.21.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/7 libyang: Optional C++ bindings

In reply to Jan Kundrát

package/libyang/Config.in config BR2_PACKAGE_LIBYANG · line 16

Quoted 4 lines · On Wed, 4 Oct 2017 07:48:35 +0200 Jan Kundr?t <[email protected]> wrote:
package/libyang/Config.in +4 -0
+if BR2_PACKAGE_LIBYANG
+
+config BR2_PACKAGE_LIBYANG_CPP
+	bool "Enable libyang C++ bindings"

Just:

bool "enable C++ bindings"

no need to repeat the package name.

package/libyang/Config.in config BR2_PACKAGE_LIBYANG · line 17

Quoted 1 line
package/libyang/Config.in +1 -0
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11

I suppose you also need:

depends on BR2_INSTALL_LIBSTDCPP

package/libyang/Config.in config BR2_PACKAGE_LIBYANG · line 19

Quoted 2 lines
package/libyang/Config.in +2 -0
+	help
+	  Build the C++ wrapper around libyang.

You also need a Config.in comment to document the C++ and gcc >= 4.8 dependencies.

package/libyang/libyang.mk HOST_LIBYANG_CONF_OPTS = \ · line 24

Quoted 9 lines
package/libyang/libyang.mk +1 -0
index cfec08cd16..87a1a4ef7c 100644
@@ -21,5 +21,12 @@ HOST_LIBYANG_CONF_OPTS = \
 	-DENABLE_VALGRIND_TESTS=OFF \
 	-DGEN_PYTHON_BINDINGS=OFF
 
+ifdef BR2_PACKAGE_LIBYANG_CPP

should be:

ifeq ($(BR2_PACKAGE_LIBYANG_CPP),y)

package/libyang/libyang.mk HOST_LIBYANG_CONF_OPTS = \ · line 28

Quoted 4 lines
package/libyang/libyang.mk +4 -0
+	LIBYANG_DEPENDENCIES += host-swig
+	HOST_LIBYANG_DEPENDENCIES += host-swig
+	LIBYANG_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+	HOST_LIBYANG_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF

This is not good: BR2_PACKAGE_LIBYANG_CPP is a target configuration option, it should not affect how the host variant of libyang is built.

Unless you need the C++ bindings in host-libyang, just make BR2_PACKAGE_LIBYANG_CPP=y enable the C++ bindings in the target package.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 2/7 sysrepo: fix a typo when installing with systemd

In reply to Jan Kundrát
---
 package/sysrepo/sysrepo.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/sysrepo/sysrepo.mk +1 -1
index 8676158a19..49c908d62d 100644
@@ -42,7 +42,7 @@ define SYSREPO_INSTALL_INIT_SYSV
 endef
 
 define SYSREPO_INSTALL_INIT_SYSTEMD
-	mkdir -p $(TARGET_DIR)/etc/systemd/systemd/multi-user.target.wants
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
 	ln -fs ../../../../usr/lib/systemd/system/sysrepod.service \
 		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
 	ln -fs ../../../../usr/lib/systemd/system/sysrepo-plugind.service \
Signature · 1 line
2.21.0
#5 lore raw

PATCH 2/7 sysrepo: fix a typo when installing with systemd

Quoted 11 lines

-----Urspr?ngliche Nachricht-----
Von: buildroot [mailto:buildroot-bounces at busybox.net] Im Auftrag von Jan Kundr?t
Gesendet: Mittwoch, 4. Dezember 2019 10:06
An: buildroot at buildroot.org
Cc: Heiko Thiery; Fabrice Fontaine
Betreff: [Buildroot] [PATCH 2/7] sysrepo: fix a typo when installing with systemd

Quoted 1 line
Quoted 24 lines
---
 package/sysrepo/sysrepo.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/sysrepo/sysrepo.mk index renamed from package/sysrepo/sysrepo.mk +0 -0

8676158a19..49c908d62d 100644

package/sysrepo/sysrepo.mk +1 -2
@@ -42,7 +42,7 @@ define SYSREPO_INSTALL_INIT_SYSV  endef
 
 define SYSREPO_INSTALL_INIT_SYSTEMD
-	mkdir -p $(TARGET_DIR)/etc/systemd/systemd/multi-user.target.wants
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
 	ln -fs ../../../../usr/lib/systemd/system/sysrepod.service \
 		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
 	ln -fs ../../../../usr/lib/systemd/system/sysrepo-plugind.service \
--

2.21.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#6 lore raw

PATCH 2/7 sysrepo: fix a typo when installing with systemd

In reply to Jan Kundrát
Quoted 4 lines · On Wed, 4 Dec 2019 10:05:47 +0100 Jan Kundr?t <[email protected]> wrote:
---
 package/sysrepo/sysrepo.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

The commit title prefix should have been "package/sysrepo:", so I fixed that and applied. Thanks Jan!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

PATCH 3/7 sysrepo: libnetconf2 is not needed

In reply to Jan Kundrát

The libnetconf2 library is a dependency of Netopeer2. Sysrepo does not have a NETCONF server or a NETCONF client, so it does not use this library.

---
 package/sysrepo/Config.in  | 1 -
 package/sysrepo/sysrepo.mk | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
package/sysrepo/Config.in +0 -1
index 18a09e0c57..df7f0fd68e 100644
@@ -8,7 +8,6 @@ config BR2_PACKAGE_SYSREPO
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" # host-protobuf
 	select BR2_PACKAGE_LIBAVL
 	select BR2_PACKAGE_LIBEV
-	select BR2_PACKAGE_LIBNETCONF2
 	select BR2_PACKAGE_LIBYANG
 	select BR2_PACKAGE_PCRE
 	select BR2_PACKAGE_PCRE_UCP
package/sysrepo/sysrepo.mk +2 -2
index 49c908d62d..216e517526 100644
@@ -9,8 +9,8 @@ SYSREPO_SITE = $(call github,sysrepo,sysrepo,v$(SYSREPO_VERSION))
 SYSREPO_INSTALL_STAGING = YES
 SYSREPO_LICENSE = Apache-2.0
 SYSREPO_LICENSE_FILES = LICENSE
-SYSREPO_DEPENDENCIES = libev libnetconf2 libavl libyang pcre protobuf-c host-sysrepo
-HOST_SYSREPO_DEPENDENCIES = host-libev host-libnetconf2 host-libavl host-libyang host-pcre host-protobuf-c
+SYSREPO_DEPENDENCIES = libev libavl libyang pcre protobuf-c host-sysrepo
+HOST_SYSREPO_DEPENDENCIES = host-libev host-libavl host-libyang host-pcre host-protobuf-c
 
 SYSREPO_CONF_OPTS = \
 	-DIS_DEVELOPER_CONFIGURATION=OFF \
Signature · 1 line
2.21.0
#9 lore raw

PATCH 3/7 sysrepo: libnetconf2 is not needed

Quoted 10 lines

-----Urspr?ngliche Nachricht-----
Von: buildroot [mailto:buildroot-bounces at busybox.net] Im Auftrag von Jan Kundr?t
Gesendet: Mittwoch, 4. Dezember 2019 10:35
An: buildroot at buildroot.org
Cc: Heiko Thiery; Fabrice Fontaine
Betreff: [Buildroot] [PATCH 3/7] sysrepo: libnetconf2 is not needed

Quoted 4 lines

The libnetconf2 library is a dependency of Netopeer2. Sysrepo does not have a NETCONF server or a NETCONF client, so it does not use this library.

Quoted 44 lines
---
 package/sysrepo/Config.in  | 1 -
 package/sysrepo/sysrepo.mk | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
package/sysrepo/Config.in index renamed from package/sysrepo/Config.in +0 -0

18a09e0c57..df7f0fd68e 100644

package/sysrepo/Config.in +0 -0
@@ -8,7 +8,6 @@ config BR2_PACKAGE_SYSREPO
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" #

host-protobuf

package/sysrepo/Config.in +0 -1
 	select BR2_PACKAGE_LIBAVL
 	select BR2_PACKAGE_LIBEV
-	select BR2_PACKAGE_LIBNETCONF2
 	select BR2_PACKAGE_LIBYANG
 	select BR2_PACKAGE_PCRE
 	select BR2_PACKAGE_PCRE_UCP
package/sysrepo/sysrepo.mk index renamed from package/sysrepo/sysrepo.mk +0 -0

49c908d62d..216e517526 100644

package/sysrepo/sysrepo.mk +0 -1
@@ -9,8 +9,8 @@ SYSREPO_SITE = $(call
 github,sysrepo,sysrepo,v$(SYSREPO_VERSION))
 SYSREPO_INSTALL_STAGING = YES
 SYSREPO_LICENSE = Apache-2.0
 SYSREPO_LICENSE_FILES = LICENSE
-SYSREPO_DEPENDENCIES = libev libnetconf2 libavl libyang pcre protobuf-c

host-sysrepo -HOST_SYSREPO_DEPENDENCIES = host-libev host-libnetconf2 host-libavl host-libyang host-pcre host-protobuf-c

package/sysrepo/sysrepo.mk +3 -1
+SYSREPO_DEPENDENCIES = libev libavl libyang pcre protobuf-c
+host-sysrepo HOST_SYSREPO_DEPENDENCIES = host-libev host-libavl
+host-libyang host-pcre host-protobuf-c
 
 SYSREPO_CONF_OPTS = \
 	-DIS_DEVELOPER_CONFIGURATION=OFF \
--

2.21.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#10 lore raw

PATCH 3/7 sysrepo: libnetconf2 is not needed

In reply to Jan Kundrát
Quoted 5 lines · On Wed, 4 Dec 2019 10:35:27 +0100 Jan Kundr?t <[email protected]> wrote:

The libnetconf2 library is a dependency of Netopeer2. Sysrepo does not have a NETCONF server or a NETCONF client, so it does not use this library.

There was a line:

depends on BR2_USE_MMU # libnetconf2

which no longer made sense since sysrepo no longer selects libnetconf2. However, a look at the sysrepo code shows that it is using fork(), and therefore I changed the line to just:

depends on BR2_USE_MMU

I also fixed the commit title to use "package/sysrepo:" as the prefix.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

PATCH 3/7 sysrepo: libnetconf2 is not needed

In reply to Jan Kundrát
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jan" == Jan Kundr?t <[email protected]> writes:

The libnetconf2 library is a dependency of Netopeer2. Sysrepo does not have a NETCONF server or a NETCONF client, so it does not use this library.

Committed to 2019.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#12 lore raw

PATCH 4/7 sysrepo: Optional support for C++ bindings

In reply to Jan Kundrát
---
 package/sysrepo/Config.in  | 6 ++++++
 package/sysrepo/sysrepo.mk | 7 +++++++
 2 files changed, 13 insertions(+)
package/sysrepo/Config.in +6 -0
index df7f0fd68e..81571ff9b3 100644
@@ -25,6 +25,12 @@ config BR2_PACKAGE_SYSREPO_EXAMPLES
 	help
 	  Enable sysrepo examples.
 
+config BR2_PACKAGE_SYSREPO_CPP
+	bool "Enable sysrepo C++ bindings"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
+	help
+	  Build the C++ wrapper around sysrepo.
+
 endif
 
 comment "sysrepo needs a toolchain w/ C++, NPTL, dynamic library, gcc >= 4.8"
package/sysrepo/sysrepo.mk +7 -0
index 216e517526..113ed7a929 100644
@@ -61,5 +61,12 @@ HOST_SYSREPO_CONF_OPTS = \
 	-DREPOSITORY_LOC=$(HOST_DIR)/etc/sysrepo \
 	-DSUBSCRIPTIONS_SOCKET_DIR=$(HOST_DIR)/var/run/sysrepo-subscriptions
 
+ifdef BR2_PACKAGE_SYSREPO_CPP
+	SYSREPO_DEPENDENCIES += host-swig
+	HOST_SYSREPO_DEPENDENCIES += host-swig
+	SYSREPO_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+	HOST_SYSREPO_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+endif
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
Signature · 1 line
2.21.0
#13 lore raw

PATCH 4/7 sysrepo: Optional support for C++ bindings

Quoted 28 lines · On Wed, 4 Dec 2019 10:37:14 +0100 Jan Kundr?t <[email protected]> wrote:
---
 package/sysrepo/Config.in  | 6 ++++++
 package/sysrepo/sysrepo.mk | 7 +++++++
 2 files changed, 13 insertions(+)
package/sysrepo/Config.in +6 -0
index df7f0fd68e..81571ff9b3 100644
@@ -25,6 +25,12 @@ config BR2_PACKAGE_SYSREPO_EXAMPLES
 	help
 	  Enable sysrepo examples.
 
+config BR2_PACKAGE_SYSREPO_CPP
+	bool "Enable sysrepo C++ bindings"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
+	help
+	  Build the C++ wrapper around sysrepo.
+
 endif
 
 comment "sysrepo needs a toolchain w/ C++, NPTL, dynamic library, gcc >= 4.8"
package/sysrepo/sysrepo.mk +0 -0
index 216e517526..113ed7a929 100644

package/sysrepo/sysrepo.mk HOST_SYSREPO_CONF_OPTS = \ · line 64

Quoted 4 lines
package/sysrepo/sysrepo.mk +1 -0
@@ -61,5 +61,12 @@ HOST_SYSREPO_CONF_OPTS = \
 	-DREPOSITORY_LOC=$(HOST_DIR)/etc/sysrepo \
 	-DSUBSCRIPTIONS_SOCKET_DIR=$(HOST_DIR)/var/run/sysrepo-subscriptions
 
+ifdef BR2_PACKAGE_SYSREPO_CPP

ifeq ($(BR2_PACKAGE_SYSREPO_CPP),y)

package/sysrepo/sysrepo.mk HOST_SYSREPO_CONF_OPTS = \ · line 68

Quoted 4 lines
package/sysrepo/sysrepo.mk +4 -0
+	SYSREPO_DEPENDENCIES += host-swig
+	HOST_SYSREPO_DEPENDENCIES += host-swig
+	SYSREPO_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
+	HOST_SYSREPO_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF

This has the same problem as your patch on libyang C++ bindings:
BR2_PACKAGE_SYSREPO_CPP is an option that affects the target package, so it should not have an effect on the host package.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#14 lore raw

PATCH 5/7 sysrepo: Use a common repository location

In reply to Jan Kundrát

Because the executables contain a hardcoded location to the on-disk repository path, we take care to use a stable, shared location between the host-sysrepo and sysrepo builds so that the host-side tools can install YANG modules and have them available once the system boots on the target.

This means that other packages, such as the upcoming netopeer2-keystored or the netopeer2-server, or really anything else which installs YANG modules into sysrepo, can just call sysrepoctl from host-sysrepo, and the resulting *target* image will have that module also available.

Also make sure that we prune the notification directory. "Notifications" in this context refer to a persistent state of NETCONF-level notifications which are created either by sysrepoctl for events such as module (de)installations, and by third-party code. There is no value in leaking these events from the build env into the target, and killing these causes in one fewer things to care about.

---
 package/sysrepo/sysrepo.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
package/sysrepo/sysrepo.mk +8 -1
index 113ed7a929..2ef64d13e2 100644
@@ -58,7 +58,7 @@ HOST_SYSREPO_CONF_OPTS = \
 	-DCALL_TARGET_BINS_DIRECTLY=OFF \
 	-DBUILD_EXAMPLES=OFF \
 	-DBUILD_CPP_EXAMPLES=OFF \
-	-DREPOSITORY_LOC=$(HOST_DIR)/etc/sysrepo \
+	-DREPOSITORY_LOC=$(BASE_TARGET_DIR)/etc/sysrepo \
 	-DSUBSCRIPTIONS_SOCKET_DIR=$(HOST_DIR)/var/run/sysrepo-subscriptions
 
 ifdef BR2_PACKAGE_SYSREPO_CPP
@@ -68,5 +68,12 @@ ifdef BR2_PACKAGE_SYSREPO_CPP
 	HOST_SYSREPO_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_JAVA_BINDINGS=OFF
 endif
 
+# There's no point in keeping the logs around
+define SYSREPO_REMOVE_NOTIFICATION_LOG
+	rm -rf $(BASE_TARGET_DIR)/etc/sysrepo/data/notifications/
+endef
+
+SYSREPO_TARGET_FINALIZE_HOOKS += SYSREPO_REMOVE_NOTIFICATION_LOG
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
Signature · 1 line
2.21.0
#15 lore raw

PATCH 5/7 sysrepo: Use a common repository location

Hi Jan,

Quoted 17 lines

-----Urspr?ngliche Nachricht-----
Von: Jan Kundr?t [mailto:jan.kundrat at cesnet.cz]
Gesendet: Mittwoch, 4. Dezember 2019 10:38
An: buildroot at buildroot.org
Cc: Heiko Thiery; Fabrice Fontaine
Betreff: [PATCH 5/7] sysrepo: Use a common repository location

Because the executables contain a hardcoded location to the on-disk repository path, we take care to use a stable, shared location between the host-sysrepo and sysrepo builds so that the host-side tools can install YANG modules and have them available once the system boots on the target.

This means that other packages, such as the upcoming netopeer2-keystored or the netopeer2-server, or really anything else which installs YANG modules into sysrepo, can just call sysrepoctl from host-sysrepo, and the resulting *target* image will have that module also available.

Quoted 8 lines

Also make sure that we prune the notification directory. "Notifications" in this context refer to a persistent state of NETCONF-level notifications which are created either by sysrepoctl for events such as module (de)installations, and by third-party code. There is no value in leaking these events from the build env into the target, and killing these causes in one fewer things to care about.

Quoted 36 lines
---
 package/sysrepo/sysrepo.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
package/sysrepo/sysrepo.mk index renamed from package/sysrepo/sysrepo.mk +0 -0

113ed7a929..2ef64d13e2 100644

package/sysrepo/sysrepo.mk +1 -1
@@ -58,7 +58,7 @@ HOST_SYSREPO_CONF_OPTS = \
 	-DCALL_TARGET_BINS_DIRECTLY=OFF \
 	-DBUILD_EXAMPLES=OFF \
 	-DBUILD_CPP_EXAMPLES=OFF \
-	-DREPOSITORY_LOC=$(HOST_DIR)/etc/sysrepo \
+	-DREPOSITORY_LOC=$(BASE_TARGET_DIR)/etc/sysrepo \
 	-DSUBSCRIPTIONS_SOCKET_DIR=$(HOST_DIR)/var/run/sysrepo-

subscriptions

ifdef BR2_PACKAGE_SYSREPO_CPP

package/sysrepo/sysrepo.mk +0 -0
@@ -68,5 +68,12 @@ ifdef BR2_PACKAGE_SYSREPO_CPP
 	HOST_SYSREPO_CONF_OPTS += -DGEN_LANGUAGE_BINDINGS=ON -

DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -
DGEN_JAVA_BINDINGS=OFF endif

package/sysrepo/sysrepo.mk +6 -0
+# There's no point in keeping the logs around define
+SYSREPO_REMOVE_NOTIFICATION_LOG
+	rm -rf $(BASE_TARGET_DIR)/etc/sysrepo/data/notifications/
+endef
+
+SYSREPO_TARGET_FINALIZE_HOOKS +=

SYSREPO_REMOVE_NOTIFICATION_LOG
+
$(eval $(cmake-package))
$(eval $(host-cmake-package))
--
2.21.0

#16 lore raw

PATCH 5/7 sysrepo: Use a common repository location

In reply to Jan Kundrát

package/sysrepo/sysrepo.mk HOST_SYSREPO_CONF_OPTS = \ · line 61

Quoted 10 lines · On Wed, 4 Dec 2019 10:37:37 +0100 Jan Kundr?t <[email protected]> wrote:
package/sysrepo/sysrepo.mk +1 -1
index 113ed7a929..2ef64d13e2 100644
@@ -58,7 +58,7 @@ HOST_SYSREPO_CONF_OPTS = \
 	-DCALL_TARGET_BINS_DIRECTLY=OFF \
 	-DBUILD_EXAMPLES=OFF \
 	-DBUILD_CPP_EXAMPLES=OFF \
-	-DREPOSITORY_LOC=$(HOST_DIR)/etc/sysrepo \
+	-DREPOSITORY_LOC=$(BASE_TARGET_DIR)/etc/sysrepo \

I suppose you're using $(BASE_TARGET_DIR) here instead of $(TARGET_DIR) to work around issues with per-package directory support ?

Unfortunately, using $(BASE_TARGET_DIR) is not really a good option. Indeed, if any host-sysrepo tool gets used during the build, it will point to $(BASE_TARGET_DIR), which is with per-package directory support enabled, is completely empty during the build. It only gets populated at the very end of the build, in target-finalize.

With per-package directory, we cannot have a hardcoded path to the target, it really needs to be dynamic. Can the sysrepoctl tool use an environment variable for example ?

package/sysrepo/sysrepo.mk ifdef BR2_PACKAGE_SYSREPO_CPP · line 73

Quoted 3 lines
package/sysrepo/sysrepo.mk +3 -0
+# There's no point in keeping the logs around
+define SYSREPO_REMOVE_NOTIFICATION_LOG
+	rm -rf $(BASE_TARGET_DIR)/etc/sysrepo/data/notifications/

Here, you can definitely use $(TARGET_DIR), because when the target-finalize hooks are executed, TARGET_DIR is defined to BASE_TARGET_DIR.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#17 lore raw

PATCH 6/7 libnetconf2: adjust dependencies

In reply to Jan Kundrát

This package needs at least one of these two options, or both:

- openssl
- libssh + the server option

Without these, it is not possible to produce a usable library, so let's reflect this in the dependencies.

I'm not sure that there is so much value in this; I would actually prefer to have both of these unconditionally enabled, but the package is already done in this way, so be it.

---
 package/libnetconf2/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
package/libnetconf2/Config.in +4 -0
index 0a735b5ed6..6d4c9c71d1 100644
@@ -3,6 +3,7 @@ config BR2_PACKAGE_LIBNETCONF2
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBSSH_SERVER || BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_LIBYANG
 	help
 	  libnetconf2 is a NETCONF library in C intended for building
@@ -13,3 +14,6 @@ config BR2_PACKAGE_LIBNETCONF2
 comment "libnetconf2 needs a toolchain w/ threads, dynamic libraray"
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "libnetconf2 requires libssh w/ server support and/or openssl"
+	depends on !BR2_PACKAGE_LIBSSH_SERVER && !BR2_PACKAGE_OPENSSL
Signature · 1 line
2.21.0
#18 lore raw

PATCH 6/7 libnetconf2: adjust dependencies

Hi Jan,

Quoted 12 lines

-----Urspr?ngliche Nachricht-----
Von: Jan Kundr?t [mailto:jan.kundrat at cesnet.cz]
Gesendet: Freitag, 17. M?rz 2017 19:30
An: buildroot at buildroot.org
Cc: Heiko Thiery; Fabrice Fontaine
Betreff: [PATCH 6/7] libnetconf2: adjust dependencies

This package needs at least one of these two options, or both:

- openssl
- libssh + the server option

Quoted 6 lines

Without these, it is not possible to produce a usable library, so let's reflect this in the dependencies.

I'm not sure that there is so much value in this; I would actually prefer to have both of these unconditionally enabled, but the package is already done in this way, so be it.

The intention was to be able to select the SSH/TLS support by providing/selecting the dependent package.

Do you think that is not reasonable?

Quoted 28 lines
---
 package/libnetconf2/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
package/libnetconf2/Config.in +2 -0
index 0a735b5ed6..6d4c9c71d1 100644
@@ -3,6 +3,7 @@ config BR2_PACKAGE_LIBNETCONF2
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBSSH_SERVER || BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_LIBYANG
 	help
 	  libnetconf2 is a NETCONF library in C intended for building @@ -13,3
+14,6 @@ config BR2_PACKAGE_LIBNETCONF2  comment "libnetconf2 needs a

toolchain w/ threads, dynamic libraray"

package/libnetconf2/Config.in +3 -0
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "libnetconf2 requires libssh w/ server support and/or openssl"
+	depends on !BR2_PACKAGE_LIBSSH_SERVER &&

!BR2_PACKAGE_OPENSSL
--
2.21.0

#19 lore raw

PATCH 6/7 libnetconf2: adjust dependencies

Quoted 5 lines

The intention was to be able to select the SSH/TLS support by providing/selecting the
dependent package.

Do you think that is not reasonable?

I think that the code in current buildroot does not enforce this. I.e., in case I have neither openssl nor libssh+server already selected, I will end up with a libnetconf2 which cannot do anything. I think that that is confusing.

There are other options, of course:

- We could add nested suboptions below BR2_PACKAGE_LIBNETCONF2 which would pick the corresponding depenency. That way, people would at least have a hint that they should drill down within KConfig and notice that there are two options. Both of these could be checked by default. Disadvantage: if the libssh+server or openssl gets enabled later, there's a risk that these two get out of sync.

- We coud just add a hard dependency on both. That IMHO also makes sense because I have a feeling that the majority of people actually want both ways.

Jan

#20 lore raw

PATCH 6/7 libnetconf2: adjust dependencies

Quoted 27 lines

-----Urspr?ngliche Nachricht-----
Von: Jan Kundr?t [mailto:jan.kundrat at cesnet.cz]
Gesendet: Mittwoch, 4. Dezember 2019 14:01
An: Heiko Thiery
Cc: buildroot at buildroot.org; Fabrice Fontaine
Betreff: Re: [Buildroot] [PATCH 6/7] libnetconf2: adjust dependencies

Quoted 4 lines

The intention was to be able to select the SSH/TLS support by providing/selecting the dependent package.

Do you think that is not reasonable?

I think that the code in current buildroot does not enforce this. I.e., in case I have neither openssl nor libssh+server already selected, I will end up with a libnetconf2 which cannot do anything. I think that that is confusing.

There are other options, of course:

- We could add nested suboptions below BR2_PACKAGE_LIBNETCONF2 which would pick the corresponding depenency. That way, people would at least have a hint that they should drill down within KConfig and notice that there are two options. Both of these could be checked by default. Disadvantage: if the libssh+server or openssl gets enabled later, there's a risk that these two get out of sync.

Quoted 2 lines

- We coud just add a hard dependency on both. That IMHO also makes sense because I have a feeling that the majority of people actually want both ways.

Just tried to add you're patch and see that with that at least the package testing (utils/test-pkg -p sysrep) will not work without providing a config-snippet that enables one of them (ssl or ssh).

@thomas: is that a valid way (package cannot be tested without config-snippet) or do we have to select the required dependencies to have the test abilitiy?

Quoted 1 line

Jan

#21 lore raw

PATCH 6/7 libnetconf2: adjust dependencies

In reply to Jan Kundrát
Quoted 22 lines · On Fri, 17 Mar 2017 19:29:53 +0100 Jan Kundr?t <[email protected]> wrote:

This package needs at least one of these two options, or both:

- openssl
- libssh + the server option

Without these, it is not possible to produce a usable library, so let's reflect this in the dependencies.

I'm not sure that there is so much value in this; I would actually prefer to have both of these unconditionally enabled, but the package is already done in this way, so be it.

---
 package/libnetconf2/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
package/libnetconf2/Config.in +0 -0
index 0a735b5ed6..6d4c9c71d1 100644

package/libnetconf2/Config.in config BR2_PACKAGE_LIBNETCONF2 · line 6

Quoted 4 lines
package/libnetconf2/Config.in +1 -0
@@ -3,6 +3,7 @@ config BR2_PACKAGE_LIBNETCONF2
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBSSH_SERVER || BR2_PACKAGE_OPENSSL

If one of these is really mandatory for the package to work in any meaningful way, then:

select ONE_OPTION if !SECOND_OPTION

is preferred, so that it is more natural for users, and you don't need the Config.in comment.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#22 lore raw

PATCH 7/7 Add me as a maintainer for the NETCONF stack

In reply to Jan Kundrát

We've been using libyang, sysrepo, libnetconf2 and the Netopeer2 suite of software for more than two years, so let's make this official.

---
 DEVELOPERS | 3 +++
 1 file changed, 3 insertions(+)
DEVELOPERS +3 -0
index a1f94df951..7dc318f013 100644
@@ -1165,6 +1165,9 @@ F:	configs/orangepi_lite_defconfig
 N:	Jan Kundr?t <[email protected]>
 F:	configs/solidrun_clearfog_defconfig
 F:	board/solidrun/clearfog/
+F:	package/libnetconf2/
+F:	package/libyang/
+F:	package/sysrepo/
 
 N:	Jan Pedersen <[email protected]>
 F:	package/zip/
Signature · 1 line
2.21.0
#23 lore raw

PATCH 7/7 Add me as a maintainer for the NETCONF stack

Quoted 7 lines · On Wed, 4 Dec 2019 11:17:27 +0100 Jan Kundr?t <[email protected]> wrote:

We've been using libyang, sysrepo, libnetconf2 and the Netopeer2 suite of software for more than two years, so let's make this official.

---
 DEVELOPERS | 3 +++
 1 file changed, 3 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#24 lore raw

PATCH 7/7 Add me as a maintainer for the NETCONF stack

In reply to Jan Kundrát
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jan" == Jan Kundr?t <[email protected]> writes:

We've been using libyang, sysrepo, libnetconf2 and the Netopeer2 suite of software for more than two years, so let's make this official.

Committed to 2019.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#25 lore raw

cover Improve sysrepo support

In reply to Jan Kundrát

Hello Jan,

Quoted 8 lines · On Wed, 4 Dec 2019 11:41:44 +0100 Jan Kundr?t <[email protected]> wrote:

Jan Kundr?t (7):
libyang: Optional C++ bindings
sysrepo: fix a typo when installing with systemd
sysrepo: libnetconf2 is not needed
sysrepo: Optional support for C++ bindings
sysrepo: Use a common repository location
libnetconf2: adjust dependencies
Add me as a maintainer for the NETCONF stack

I have applied some of the patches in this series (patches 2, 3 and 7), but the other patches (1, 4, 5 and 6) had some comments. Could you take them into account and send an updated series ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#26 lore raw

cover Improve sysrepo support

Quoted 3 lines

I have applied some of the patches in this series (patches 2, 3 and 7), but the other patches (1, 4, 5 and 6) had some comments. Could you take them into account and send an updated series ?

Thanks for your feedback. I'll send an update in a day or two.

Jan