From 1953132ceaccbe2020af810ebf2370ccb3cf9f70 Mon Sep 17 00:00:00 2001 From: Lucian Cristian Date: Tue, 5 May 2020 21:07:28 +0300 Subject: [PATCH] sysrepo: update to 1.4.2 Signed-off-by: Lucian Cristian --- libs/libyang/Makefile | 23 +++++- net/sysrepo/Makefile | 70 +++++++------------ net/sysrepo/files/libsysrepo.default | 18 ++--- net/sysrepo/files/sysrepo.init | 10 +-- .../002-remove-buildtime-module-install.patch | 24 ------- .../004-disable-sysrepod-autostart.patch | 23 ------ .../patches/005-fix-struct-ucred-define.patch | 28 -------- 7 files changed, 55 insertions(+), 141 deletions(-) delete mode 100644 net/sysrepo/patches/002-remove-buildtime-module-install.patch delete mode 100644 net/sysrepo/patches/004-disable-sysrepod-autostart.patch delete mode 100644 net/sysrepo/patches/005-fix-struct-ucred-define.patch diff --git a/libs/libyang/Makefile b/libs/libyang/Makefile index 69e227732a..d719c23c22 100644 --- a/libs/libyang/Makefile +++ b/libs/libyang/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libyang PKG_VERSION:=1.0.130 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/CESNET/libyang/tar.gz/v$(PKG_VERSION)? @@ -34,6 +34,14 @@ define Package/libyang DEPENDS:=+libpcre +libpthread endef +define Package/libyang-cpp + SECTION:=libs + CATEGORY:=Libraries + TITLE:=YANG data modeling C++ language library + URL:=https://github.com/CESNET/libyang + DEPENDS:=+libyang +libstdcpp +endef + define Package/yanglint SECTION:=utils CATEGORY:=Utilities @@ -47,7 +55,12 @@ define Package/libyang/description The library is used e.g. in libnetconf2, Netopeer2 or sysrepo projects. endef -CMAKE_OPTIONS += -DENABLE_LYD_PRIV:BOOL=ON +CMAKE_OPTIONS += \ + -DENABLE_LYD_PRIV:BOOL=ON \ + -DCMAKE_BUILD_TYPE:String="Release" \ + -DGEN_LANGUAGE_BINDINGS=ON \ + -DGEN_PYTHON_BINDINGS=OFF + define Package/libyang/install $(INSTALL_DIR) $(1)/usr/lib @@ -60,10 +73,16 @@ define Package/libyang/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libyang/user_types/* $(1)/usr/lib/libyang/user_types endef +define Package/libyang-cpp/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libyang-cpp.so* $(1)/usr/lib/ +endef + define Package/yanglint/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/yanglint $(1)/usr/bin/ endef $(eval $(call BuildPackage,libyang)) +$(eval $(call BuildPackage,libyang-cpp)) $(eval $(call BuildPackage,yanglint)) diff --git a/net/sysrepo/Makefile b/net/sysrepo/Makefile index 13fc9d79cb..6843f123db 100644 --- a/net/sysrepo/Makefile +++ b/net/sysrepo/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sysrepo -PKG_VERSION:=0.7.8 -PKG_RELEASE:=2 +PKG_VERSION:=1.4.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/sysrepo/sysrepo/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=d3066c1776a6727b96bbb3517eb646d0bb6037e8e1addcbe873cae590493843e +PKG_HASH:=d84d4f092feab83b0a39fef5d0d62bc6ed1f0f8aa274329f2cbf0a95a6528d8a PKG_MAINTAINER:=Mislav Novakovic PKG_LICENSE:=Apache-2.0 @@ -33,7 +33,7 @@ define Package/libsysrepo CATEGORY:=Libraries TITLE:=YANG-based data store library URL:=https://www.sysrepo.org/ - DEPENDS:=+libyang +libprotobuf-c +libev +libredblack +librt +libpthread + DEPENDS:=+libyang +libatomic +libprotobuf-c +libev +libredblack +librt +libpthread endef define Package/python3-sysrepo @@ -42,7 +42,7 @@ define Package/python3-sysrepo SUBMENU:=Python TITLE:=YANG-based data store library - Python 3 bindings URL:=https://www.sysrepo.org/ - DEPENDS:=+libsysrepo +libstdcpp +python3-base + DEPENDS:=+libsysrepo +libstdcpp +python3-base +libyang-cpp endef define Package/sysrepo @@ -76,46 +76,27 @@ endef SWIG_VERSION:=4.0.1 CMAKE_OPTIONS += \ - -DUSE_AVL_LIB:BOOL=FALSE \ -DENABLE_TESTS:BOOL=FALSE \ -DBUILD_EXAMPLES:BOOL=FALSE \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE="Package" \ -DREPOSITORY_LOC:PATH=/etc/sysrepo \ - -DENABLE_NACM:BOOL=FALSE \ - -DREQUEST_TIMEOUT=6 \ - -DLONG_REQUEST_TIMEOUT=30 \ - -DCOMMIT_VERIFY_TIMEOUT=20 \ - -DOPER_DATA_PROVIDE_TIMEOUT=4 \ - -DNOTIF_AGE_TIMEOUT=120 \ - -DNOTIF_TIME_WINDOW=20 \ - -DUSE_SR_MEM_MGMT=0 \ - -DFILE_FORMAT_EXT:STRING=xml \ -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=FALSE \ - -DGEN_LANGUAGE_BINDINGS:BOOL=TRUE \ - -DSWIG_DIR=$(STAGING_DIR_HOSTPKG)/share/swig/$(SWIG_VERSION) \ -DSWIG_EXECUTABLE=$(STAGING_DIR_HOSTPKG)/bin/swig \ -DCALL_TARGET_BINS_DIRECTLY=OFF \ - -DGEN_PYTHON_BINDINGS:BOOL=TRUE \ - -DGEN_PYTHON_VERSION=3 \ - -DGEN_PYTHON3_TESTS:BOOL=FALSE + -DGEN_LANGUAGE_BINDINGS:BOOL=TRUE \ + -DGEN_PYTHON_BINDINGS:BOOL=TRUE define Package/libsysrepo/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/src/libsysrepo.so* $(1)/usr/lib/ - - $(INSTALL_DIR) $(1)/etc/sysrepo/yang/internal - $(INSTALL_CONF) $(PKG_BUILD_DIR)/yang/sysrepo-module-dependencies.yang $(1)/etc/sysrepo/yang/internal - $(INSTALL_CONF) $(PKG_BUILD_DIR)/yang/sysrepo-notification-store.yang $(1)/etc/sysrepo/yang/internal - $(INSTALL_CONF) $(PKG_BUILD_DIR)/yang/sysrepo-persistent-data.yang $(1)/etc/sysrepo/yang/internal + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsysrepo.so* $(1)/usr/lib/ $(INSTALL_DIR) $(1)/etc/sysrepo/yang - $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/ietf-netconf-acm@2018-02-14.yang $(1)/etc/sysrepo/yang/ietf-netconf-acm@2018-02-14.yang - $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/ietf-netconf-notifications.yang $(1)/etc/sysrepo/yang/ietf-netconf-notifications@2012-02-06.yang - $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/nc-notifications.yang $(1)/etc/sysrepo/yang/nc-notifications@2008-07-14.yang - $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/notifications.yang $(1)/etc/sysrepo/yang/notifications@2008-07-14.yang - $(INSTALL_DATA) $(PKG_BUILD_DIR)/yang/ietf-netconf@2011-06-01.yang $(1)/etc/sysrepo/yang/ietf-netconf@2011-06-01.yang - - $(INSTALL_DIR) $(1)/etc/sysrepo/data/internal - $(INSTALL_DIR) $(1)/etc/sysrepo/data/notifications + $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-netconf-with-defaults.yang $(1)/etc/sysrepo/yang/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-netconf-notifications.yang $(1)/etc/sysrepo/yang/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-netconf.yang $(1)/etc/sysrepo/yang/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-origin.yang $(1)/etc/sysrepo/yang/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/sysrepo.yang $(1)/etc/sysrepo/yang/ $(INSTALL_DIR) $(1)/etc/uci-defaults $(INSTALL_BIN) ./files/libsysrepo.default $(1)/etc/uci-defaults/95_libsysrepo @@ -123,31 +104,28 @@ endef define Package/python3-sysrepo/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/swig/libSysrepo-cpp.so* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsysrepo-cpp.so* $(1)/usr/lib $(INSTALL_DIR) $(1)$(PYTHON3_PKG_DIR) - $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python/sysrepo.py $(1)$(PYTHON3_PKG_DIR) - $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python/_sysrepo.so $(1)$(PYTHON3_PKG_DIR) + $(INSTALL_DATA) $(PKG_BUILD_DIR)/bindings/python/sysrepo.py $(1)$(PYTHON3_PKG_DIR) + $(INSTALL_DATA) $(PKG_BUILD_DIR)/bindings/python/_sysrepo.so $(1)$(PYTHON3_PKG_DIR) endef define Package/sysrepo/install - $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepod $(1)/bin/ - - $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepo-plugind $(1)/bin/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sysrepo-plugind $(1)/usr/bin/ $(INSTALL_DIR) $(1)/etc/init.d/ $(INSTALL_BIN) ./files/sysrepo.init $(1)/etc/init.d/sysrepo endef define Package/sysrepoctl/install - $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepoctl $(1)/bin/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sysrepoctl $(1)/usr/bin/ endef define Package/sysrepocfg/install - $(INSTALL_DIR) $(1)/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sysrepocfg $(1)/bin/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sysrepocfg $(1)/usr/bin/ endef $(eval $(call BuildPackage,libsysrepo)) diff --git a/net/sysrepo/files/libsysrepo.default b/net/sysrepo/files/libsysrepo.default index 6fd06ef819..4158041929 100644 --- a/net/sysrepo/files/libsysrepo.default +++ b/net/sysrepo/files/libsysrepo.default @@ -3,29 +3,29 @@ # Warning, problems can occur if the device restarts in the middle of this uci-default script if [ -x /bin/sysrepoctl ]; then - match=$(sysrepoctl -l | grep "notifications ") + match=$(sysrepoctl -l | grep "ietf-netconf-notifications ") if [ ! "$match" ]; then - sysrepoctl --install --yang=/etc/sysrepo/yang/notifications@2008-07-14.yang -p 666 + sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-notifications.yang -p 666 fi - match=$(sysrepoctl -l | grep "nc-notifications ") + match=$(sysrepoctl -l | grep "ietf-netconf-with-default ") if [ ! "$match" ]; then - sysrepoctl --install --yang=/etc/sysrepo/yang/nc-notifications@2008-07-14.yang -p 666 + sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-with-defaults.yang -p 666 fi - match=$(sysrepoctl -l | grep "ietf-netconf-acm ") + match=$(sysrepoctl -l | grep "ietf-origin ") if [ ! "$match" ]; then - sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-acm@2018-02-14.yang -p 644 + sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-origin.yang -p 644 fi - match=$(sysrepoctl -l | grep "ietf-netconf-notifications ") + match=$(sysrepoctl -l | grep "sysrepo ") if [ ! "$match" ]; then - sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-notifications@2012-02-06.yang -p 600 + sysrepoctl --install --yang=/etc/sysrepo/yang/sysrepo.yang -p 600 fi match=$(sysrepoctl -l | grep "ietf-netconf ") if [ ! "$match" ]; then - sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf@2011-06-01.yang -p 600 + sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf.yang -p 600 fi sysrepoctl -m ietf-netconf -e writable-running sysrepoctl -m ietf-netconf -e candidate diff --git a/net/sysrepo/files/sysrepo.init b/net/sysrepo/files/sysrepo.init index a2599cbdb9..4b832939b8 100644 --- a/net/sysrepo/files/sysrepo.init +++ b/net/sysrepo/files/sysrepo.init @@ -4,16 +4,9 @@ START=60 STOP=10 USE_PROCD=1 -PROG_DAEMON=/bin/sysrepod -PROG_PLUGIN=/bin/sysrepo-plugind +PROG_PLUGIN=/usr/bin/sysrepo-plugind start_service() { - procd_open_instance - procd_set_param command ${PROG_DAEMON} - procd_append_param command -d -l 0 - procd_set_param respawn - procd_close_instance - procd_open_instance procd_set_param command ${PROG_PLUGIN} procd_append_param command -d -l 0 @@ -25,6 +18,5 @@ stop_service() { kill -9 `ps | grep netopeer2-server | grep -v grep | awk '{print $1}'` >/dev/null 2>&1 service_stop ${PROG_PLUGIN} - service_stop ${PROG_DAEMON} rm -rf /var/run/sysrepo-subscriptions/* } diff --git a/net/sysrepo/patches/002-remove-buildtime-module-install.patch b/net/sysrepo/patches/002-remove-buildtime-module-install.patch deleted file mode 100644 index 2a703bbe89..0000000000 --- a/net/sysrepo/patches/002-remove-buildtime-module-install.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -335,7 +335,7 @@ install (FILES ${INTERNAL_YANGS} DESTINATION ${INTERNAL_SCHEMA_SEARCH_DIR}) - - # install NACM YANG module - if(ENABLE_NACM) -- INSTALL_YANG("ietf-netconf-acm" "@2018-02-14" "644") -+# INSTALL_YANG("ietf-netconf-acm" "@2018-02-14" "644") - endif(ENABLE_NACM) - - # generate and install pkg-config file -@@ -356,9 +356,9 @@ if(WITH_SYSTEMD) - FILES_MATCHING PATTERN "*.service") - endif() - --INSTALL_YANG("ietf-netconf-notifications" "" "666") --INSTALL_YANG("nc-notifications" "" "666") --INSTALL_YANG("notifications" "" "666") -+#INSTALL_YANG("ietf-netconf-notifications" "" "666") -+#INSTALL_YANG("nc-notifications" "" "666") -+#INSTALL_YANG("notifications" "" "666") - - # uninstall - add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake") diff --git a/net/sysrepo/patches/004-disable-sysrepod-autostart.patch b/net/sysrepo/patches/004-disable-sysrepod-autostart.patch deleted file mode 100644 index 255b4ad673..0000000000 --- a/net/sysrepo/patches/004-disable-sysrepod-autostart.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/clientlib/client_library.c -+++ b/src/clientlib/client_library.c -@@ -396,13 +396,13 @@ sr_connect(const char *app_name, const sr_conn_options_t opts, sr_conn_ctx_t **c - if (opts & SR_CONN_DAEMON_REQUIRED) { - if ((opts & SR_CONN_DAEMON_START) && (0 == getuid())) { - /* sysrepo daemon start requested and process is running under root privileges */ -- SR_LOG_DBG_MSG("Sysrepo daemon not detected, starting it."); -- ret = system("sysrepod"); -- if (0 == ret) { -- SR_LOG_INF_MSG("Sysrepo daemon has been started."); -- } else { -- SR_LOG_WRN("Unable to start sysrepo daemon, error code=%d.", ret); -- } -+ //SR_LOG_DBG_MSG("Sysrepo daemon not detected, starting it."); -+ //ret = system("sysrepod"); -+ //if (0 == ret) { -+ // SR_LOG_INF_MSG("Sysrepo daemon has been started."); -+ //} else { -+ // SR_LOG_WRN("Unable to start sysrepo daemon, error code=%d.", ret); -+ //} - /* retry to connect again in any case */ - rc = cl_socket_connect(connection, SR_DAEMON_SOCKET); - CHECK_RC_LOG_GOTO(rc, cleanup, "Unable to connect to sysrepod: %s.", sr_strerror(rc)); diff --git a/net/sysrepo/patches/005-fix-struct-ucred-define.patch b/net/sysrepo/patches/005-fix-struct-ucred-define.patch deleted file mode 100644 index 4c5966de15..0000000000 --- a/net/sysrepo/patches/005-fix-struct-ucred-define.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/src/common/sr_utils.c -+++ b/src/common/sr_utils.c -@@ -506,14 +506,24 @@ sr_fd_set_nonblock(int fd) - - #if defined(SO_PEERCRED) - -+#if defined(__GLIBC__) - #if !defined(SCM_CREDENTIALS) --/* struct ucred is ifdefined behind __USE_GNU, but __USE_GNU is not defined */ - struct ucred { - pid_t pid; /* process ID of the sending process */ - uid_t uid; /* user ID of the sending process */ - gid_t gid; /* group ID of the sending process */ - }; - #endif /* !defined(SCM_CREDENTIALS) */ -+#else -+#if !defined(_GNU_SOURCE) -+struct ucred { -+ pid_t pid; /* process ID of the sending process */ -+ uid_t uid; /* user ID of the sending process */ -+ gid_t gid; /* group ID of the sending process */ -+}; -+/* struct ucred is ifdefined behind __USE_GNU, but __USE_GNU is not defined */ -+#endif /* !defined(__GNU_SOURCE) */ -+#endif /* defined(__GLIBC__) */ - - int - sr_get_peer_eid(int fd, uid_t *uid, gid_t *gid) -- 2.30.2