diff mbox series

[master/kirkstone,v3,6/8] meta-arago-extras: sysrepo: Add sysrepo and sysrepo plugins

Message ID 20230627100345.24340-7-r-gunasekaran@ti.com
State Superseded
Delegated to: Ryan Eatmon
Headers show
Series Add meta-sysrepo recipes | expand

Commit Message

Ravi Gunasekaran June 27, 2023, 10:03 a.m. UTC
NETCONF protocol is implemented via netopeer2/sysrepo.
Add the sysrepo recipe so that the NETCONF protocol can be realized
on devices supporting ethernet.

The recipe is taken as-is from the commit 09f73e7 ("update for honister")
from the public repo [1].

[1] - https://github.com/sartura/meta-sysrepo

Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
---

Changes since v2:
---------------
Newly introduced in this series

 .../0001-so-version.patch                     | 12 +++++
 .../sysrepo-plugins-common_git.bb             | 26 ++++++++++
 .../recipes-sysrepo/sysrepo/sysrepo/sysrepo   | 51 +++++++++++++++++++
 .../recipes-sysrepo/sysrepo/sysrepo_git.bb    | 34 +++++++++++++
 4 files changed, 123 insertions(+)
 create mode 100644 meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/0001-so-version.patch
 create mode 100644 meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/sysrepo-plugins-common_git.bb
 create mode 100644 meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo/sysrepo
 create mode 100644 meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo_git.bb
diff mbox series

Patch

diff --git a/meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/0001-so-version.patch b/meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/0001-so-version.patch
new file mode 100644
index 00000000..0eabf6a9
--- /dev/null
+++ b/meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/0001-so-version.patch
@@ -0,0 +1,12 @@ 
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index fd64b80..910510d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,6 +23,7 @@ include_directories(${LIBYANG_INCLUDE_DIRS})
+ include_directories(${SYSREPO_INCLUDE_DIRS})
+
+ add_library(${PROJECT_NAME} SHARED ${SRPC_SOURCES})
++set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0 SOVERSION 1)
+
+ install(
+     TARGETS ${PROJECT_NAME}
diff --git a/meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/sysrepo-plugins-common_git.bb b/meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/sysrepo-plugins-common_git.bb
new file mode 100644
index 00000000..48f6bc35
--- /dev/null
+++ b/meta-arago-extras/recipes-sysrepo/sysrepo-plugins-common/sysrepo-plugins-common_git.bb
@@ -0,0 +1,26 @@ 
+SUMMARY = "Set of utilities/functionalities which can be used for easier build of sysrepo plugins."
+DESCRIPTION = ""
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=f91d5dfaae99cc1943a8eca222cafa5c"
+
+SRC_URI = "gitsm://github.com/telekom/sysrepo-plugins-common.git;protocol=https;branch=devel "
+SRC_URI += " file://0001-so-version.patch "
+FILESEXTRAPATHS:prepend := "${THISDIR}:"
+
+PV = "dev+git${SRCPV}"
+SRCREV = "20885de0d3bb95a05610fdb3a0f83d8f7c370fad"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "libyang sysrepo"
+
+FILES:${PN} += ""
+
+inherit cmake pkgconfig
+
+# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
+EXTRA_OECMAKE = " -DCMAKE_INSTALL_PREFIX:PATH=/usr "
+
+do_install:append () {
+    true
+}
diff --git a/meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo/sysrepo b/meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo/sysrepo
new file mode 100644
index 00000000..06881c68
--- /dev/null
+++ b/meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo/sysrepo
@@ -0,0 +1,51 @@ 
+#!/bin/sh
+
+# Source function library.
+. /etc/init.d/functions
+
+EXEC_PATH="/usr/bin"
+SYSREPOPLUGIND_EXEC="sysrepo-plugind"
+SERVER_OPTS=" -d -v 1"
+
+init_sysrepo() {
+    export NP2_MODULE_DIR="/usr/share/yang/modules/netopeer2"
+    export NP2_MODULE_PERMS="600"
+    export NP2_MODULE_OWNER="root"
+    export NP2_MODULE_GROUP="root"
+    if [ -x /usr/bin/sysrepoctl ]; then
+        sh /etc/netopeer2/scripts/setup.sh
+    fi
+    if [ -x /usr/bin/sysrepocfg ]; then
+        sh /etc/netopeer2/scripts/merge_hostkey.sh
+        sh /etc/netopeer2/scripts/merge_config.sh
+    fi
+    touch /etc/sysrepo/init
+}
+
+
+case "$1" in
+    start)
+        test -r /etc/sysrepo/init || init_sysrepo
+        start-stop-daemon --start --background --exec $EXEC_PATH/$SYSREPOPLUGIND_EXEC -- $SERVER_OPTS
+        ;;
+    stop)
+        start-stop-daemon --stop --quiet --exec $EXEC_PATH/$SYSREPOPLUGIND_EXEC
+        rm -rf /var/run/sysrepo-subscriptions/*
+        ;;
+    status)
+        status $SYSREPOPLUGIND_EXEC
+        ;;
+    reload)
+        echo "not supported"
+        ;;
+    restart)
+        $0 stop
+        $0 start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|status|restart}"
+        exit 1;;
+esac
+
+
+exit 0
diff --git a/meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo_git.bb b/meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo_git.bb
new file mode 100644
index 00000000..18da3ca3
--- /dev/null
+++ b/meta-arago-extras/recipes-sysrepo/sysrepo/sysrepo_git.bb
@@ -0,0 +1,34 @@ 
+# Recipe created by recipetool
+SUMMARY = "YANG-based configuration and operational state data store for Unix/Linux applications."
+DESCRIPTION = ""
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=ef345f161efb68c3836e6f5648b2312f"
+
+SRC_URI = "git://github.com/sysrepo/sysrepo.git;protocol=https;branch=devel file://sysrepo"
+
+PV = "2.2.71+git${SRCPV}"
+SRCREV = "b828f0ab4693c613cc66efd053a146e05854d5c8"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "libyang protobuf protobuf-c protobuf-c-native libredblack libev libnetconf2"
+
+FILES:${PN} += "/usr/share/yang/* /usr/lib/sysrepo-plugind/*"
+
+inherit cmake pkgconfig python3native python3-dir
+
+# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
+EXTRA_OECMAKE = " -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE:String=Release -DBUILD_EXAMPLES:String=False -DENABLE_TESTS:String=False -DREPOSITORY_LOC:PATH=/etc/sysrepo  -DCALL_TARGET_BINS_DIRECTLY=False -DGEN_LANGUAGE_BINDINGS:String=False "
+
+BBCLASSEXTEND = "native nativesdk"
+
+do_install:append () {
+    install -d ${D}/etc/sysrepo/data/notifications
+    install -d ${D}/etc/sysrepo/yang
+    install -o root -g root ${S}/modules/ietf-netconf-notifications.yang ${D}/etc/sysrepo/yang/ietf-netconf-notifications@2012-02-06.yang
+    install -o root -g root ${S}/modules/ietf-netconf-with-defaults.yang ${D}/etc/sysrepo/yang/ietf-netconf-with-defaults@2011-06-01.yang
+    install -o root -g root ${S}/modules/ietf-netconf.yang ${D}/etc/sysrepo/yang/ietf-netconf@2011-06-01.yang
+    install -d ${D}/etc/init.d
+    install -m 0775 ${WORKDIR}/sysrepo ${D}/etc/init.d/
+    install -d ${D}/usr/lib/sysrepo/plugins
+}