aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/netconf-pnp-simulator/engine/patches
diff options
context:
space:
mode:
authorebo <eliezio.oliveira@est.tech>2020-02-27 14:04:23 +0000
committerebo <eliezio.oliveira@est.tech>2020-02-28 11:28:56 +0000
commit3ecb7b39473c5ea6835fcbdd57b91acb74781a52 (patch)
tree29ca00e16f35cf418a95ce0b3644b79164432b83 /test/mocks/netconf-pnp-simulator/engine/patches
parent9babb59ffd0e65b1e4acdb13f4b25205ae1bfdda (diff)
Add NETCONF PNF Simulator Engine
Issue-ID: INT-1124 Signed-off-by: ebo <eliezio.oliveira@est.tech> Change-Id: Ifb50a749992cbd662d579e1cb861bd8f55b3f808
Diffstat (limited to 'test/mocks/netconf-pnp-simulator/engine/patches')
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/patches/Netopeer2/01-fix-grep-count.patch35
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/01-configurable-PYTHON_MODULE_PATH.patch14
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/02-fix-missing-include-dir.patch11
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/03-fix-missing-pthread_rwlockattr_setkind_np.patch20
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/patches/libyang/01-configurable-PYTHON_MODULE_PATH.patch17
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/patches/sysrepo/01-configurable-PYTHON_MODULE_PATH.patch21
6 files changed, 118 insertions, 0 deletions
diff --git a/test/mocks/netconf-pnp-simulator/engine/patches/Netopeer2/01-fix-grep-count.patch b/test/mocks/netconf-pnp-simulator/engine/patches/Netopeer2/01-fix-grep-count.patch
new file mode 100644
index 000000000..00bc93085
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/patches/Netopeer2/01-fix-grep-count.patch
@@ -0,0 +1,35 @@
+diff --git a/keystored/scripts/model-install.sh b/keystored/scripts/model-install.sh
+index a350950..671dd16 100755
+--- a/keystored/scripts/model-install.sh
++++ b/keystored/scripts/model-install.sh
+@@ -13,7 +13,7 @@ local_path=$(dirname $0)
+ is_yang_module_installed() {
+ module=$1
+
+- $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
++ $SYSREPOCTL -l | grep -c "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
+ }
+
+ install_yang_module() {
+diff --git a/server/scripts/model-install.sh.in b/server/scripts/model-install.sh.in
+index 589d639..760ce42 100755
+--- a/server/scripts/model-install.sh.in
++++ b/server/scripts/model-install.sh.in
+@@ -13,7 +13,7 @@ shopt -s failglob
+ is_yang_module_installed() {
+ module=$1
+
+- $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
++ $SYSREPOCTL -l | grep -c "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
+ }
+
+ install_yang_module() {
+@@ -31,7 +31,7 @@ enable_yang_module_feature() {
+ module=$1
+ feature=$2
+
+- if ! $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|.* $feature.*$" > /dev/null; then
++ if ! $SYSREPOCTL -l | grep -c "^$module [^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|.* $feature.*$" > /dev/null; then
+ echo "- Enabling feature $feature in $module..."
+ $SYSREPOCTL -m $module -e $feature
+ else
diff --git a/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/01-configurable-PYTHON_MODULE_PATH.patch b/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/01-configurable-PYTHON_MODULE_PATH.patch
new file mode 100644
index 000000000..3deb95c29
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/01-configurable-PYTHON_MODULE_PATH.patch
@@ -0,0 +1,14 @@
+--- a/python/CMakeLists.txt 2020-02-19 12:25:07.000000000 +0000
++++ b/python/CMakeLists.txt 2020-02-20 14:56:26.810463000 +0000
+@@ -22,7 +22,9 @@
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile.in ${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile)
+ add_custom_target(pyapi ALL COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} ${DEBUG})
+ add_custom_target(pyapidoc COMMAND make -f ${CMAKE_CURRENT_SOURCE_DIR}/docs/Makefile html)
+- execute_process(COMMAND ${PYTHON} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))"
+- OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
++ if(NOT DEFINED PYTHON_MODULE_PATH)
++ execute_process(COMMAND ${PYTHON} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))"
++ OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
++ endif()
+ install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} build -b ${PYAPI_BUILD_DIR} install --install-lib=\$ENV{DESTDIR}/${PYTHON_MODULE_PATH})")
+ endif()
diff --git a/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/02-fix-missing-include-dir.patch b/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/02-fix-missing-include-dir.patch
new file mode 100644
index 000000000..556b9fd84
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/02-fix-missing-include-dir.patch
@@ -0,0 +1,11 @@
+--- a/python/setup.py.in 2020-02-20 20:04:33.000000000 +0000
++++ b/python/setup.py.in 2020-02-20 20:04:57.000000000 +0000
+@@ -13,7 +13,7 @@
+ "${CMAKE_CURRENT_COURCE_DIR}/rpc.h"
+ ],
+ libraries=["netconf2"],
+- extra_compile_args=["-Wall", "-I${CMAKE_CURRENT_BINARY_DIR}" @SSH_DEFINE@ @TLS_DEFINE@],
++ extra_compile_args=["-Wall", "-I${CMAKE_CURRENT_BINARY_DIR}", "-I${LIBYANG_INCLUDE_DIR}", "-I${LIBSSH_INCLUDE_DIR}" @SSH_DEFINE@ @TLS_DEFINE@],
+ extra_link_args=["-L${CMAKE_CURRENT_BINARY_DIR}/.."],
+ )
+
diff --git a/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/03-fix-missing-pthread_rwlockattr_setkind_np.patch b/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/03-fix-missing-pthread_rwlockattr_setkind_np.patch
new file mode 100644
index 000000000..65537a017
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/03-fix-missing-pthread_rwlockattr_setkind_np.patch
@@ -0,0 +1,20 @@
+diff --git a/src/session_server.c b/src/session_server.c
+index 636b1a2..57f2854 100644
+--- a/src/session_server.c
++++ b/src/session_server.c
+@@ -560,6 +560,7 @@ nc_server_init(struct ly_ctx *ctx)
+ errno=0;
+
+ if (pthread_rwlockattr_init(&attr) == 0) {
++#ifdef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+ if (pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) == 0) {
+ if (pthread_rwlock_init(&server_opts.endpt_lock, &attr) != 0) {
+ ERR("%s: failed to init rwlock(%s).", __FUNCTION__, strerror(errno));
+@@ -570,6 +571,7 @@ nc_server_init(struct ly_ctx *ctx)
+ } else {
+ ERR("%s: failed set attribute (%s).", __FUNCTION__, strerror(errno));
+ }
++#endif
+ pthread_rwlockattr_destroy(&attr);
+ } else {
+ ERR("%s: failed init attribute (%s).", __FUNCTION__, strerror(errno));
diff --git a/test/mocks/netconf-pnp-simulator/engine/patches/libyang/01-configurable-PYTHON_MODULE_PATH.patch b/test/mocks/netconf-pnp-simulator/engine/patches/libyang/01-configurable-PYTHON_MODULE_PATH.patch
new file mode 100644
index 000000000..167297f06
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/patches/libyang/01-configurable-PYTHON_MODULE_PATH.patch
@@ -0,0 +1,17 @@
+--- a/swig/python/CMakeLists.txt 2020-02-19 12:24:05.000000000 +0000
++++ b/swig/python/CMakeLists.txt 2020-02-20 14:54:59.279634000 +0000
+@@ -20,9 +20,11 @@
+
+ file(COPY "examples" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
+-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))"
+- OUTPUT_VARIABLE PYTHON_MODULE_PATH
+- OUTPUT_STRIP_TRAILING_WHITESPACE )
++if(NOT DEFINED PYTHON_MODULE_PATH)
++ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))"
++ OUTPUT_VARIABLE PYTHON_MODULE_PATH
++ OUTPUT_STRIP_TRAILING_WHITESPACE )
++endif()
+
+ install( TARGETS _${PYTHON_SWIG_BINDING} DESTINATION ${PYTHON_MODULE_PATH})
+ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_SWIG_BINDING}.py" DESTINATION ${PYTHON_MODULE_PATH})
diff --git a/test/mocks/netconf-pnp-simulator/engine/patches/sysrepo/01-configurable-PYTHON_MODULE_PATH.patch b/test/mocks/netconf-pnp-simulator/engine/patches/sysrepo/01-configurable-PYTHON_MODULE_PATH.patch
new file mode 100644
index 000000000..3c6fa7b87
--- /dev/null
+++ b/test/mocks/netconf-pnp-simulator/engine/patches/sysrepo/01-configurable-PYTHON_MODULE_PATH.patch
@@ -0,0 +1,21 @@
+diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt
+index 7d00a8b7..dc06da00 100644
+--- a/swig/python/CMakeLists.txt
++++ b/swig/python/CMakeLists.txt
+@@ -24,10 +24,12 @@ swig_link_libraries(${PYTHON_SWIG_BINDING} ${PYTHON_LIBRARIES} Sysrepo-cpp)
+
+ file(COPY "examples" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
+
+-execute_process(COMMAND
+- ${PYTHON_EXECUTABLE} -c
+- "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
+-OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
++if(NOT DEFINED PYTHON_MODULE_PATH)
++ execute_process(COMMAND
++ ${PYTHON_EXECUTABLE} -c
++ "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
++ OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
++endif()
+
+ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/_${PYTHON_SWIG_BINDING}.so" DESTINATION ${PYTHON_MODULE_PATH} )
+ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_SWIG_BINDING}.py" DESTINATION ${PYTHON_MODULE_PATH} )