From 492f8e84e916d477014666f247ccae4eefa7805e Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Thu, 1 Oct 2020 09:10:30 +0530 Subject: [PATCH 1/9] RPM packaging name fixes if plugin_package_name env is set in plugin Signed-off-by: ashish-jabble --- plugins/make_rpm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/make_rpm b/plugins/make_rpm index 82d0b8e..5237725 100755 --- a/plugins/make_rpm +++ b/plugins/make_rpm @@ -130,8 +130,11 @@ do fi echo Version is $version BUILD_ROOT="${GIT_ROOT}/packages/build" - pkg_name="fledge-${plugin_type}-${plugin_name}" - + if [ "${plugin_package_name}" ]; then + pkg_name=${plugin_package_name} + else + pkg_name="fledge-${plugin_type}-${plugin_name}" + fi # Final package name package_name="${pkg_name}-${version}" From 0b196f4de908f3e130aafca3956b49d103d7d2e7 Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Wed, 6 Jan 2021 15:19:33 +0530 Subject: [PATCH 2/9] notification delivery & rule plugins empty directories added with notification service packaging Signed-off-by: ashish-jabble --- service/make_deb | 4 ++++ service/make_rpm | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/service/make_deb b/service/make_deb index 5b20798..41f4c4b 100755 --- a/service/make_deb +++ b/service/make_deb @@ -190,6 +190,10 @@ do # Debian file structure mkdir -p usr/local/fledge cd usr/local/fledge + if [ "${service_name}" = "notification" ]; then + mkdir -p plugins/notificationDelivery + mkdir -p plugins/notificationRule + fi mkdir -p ${install_dir} cp "${GIT_ROOT}/build/C/${install_dir}/${service_name}/${exec_name}" "${install_dir}/${exec_name}" echo "Done." diff --git a/service/make_rpm b/service/make_rpm index b8c7867..af0b5c4 100755 --- a/service/make_rpm +++ b/service/make_rpm @@ -218,6 +218,10 @@ EOF mkdir -p usr/local/fledge cd usr/local/fledge + if [ "${service_name}" = "notification" ]; then + mkdir -p plugins/notificationDelivery + mkdir -p plugins/notificationRule + fi mkdir -p ${install_dir} cp -R --preserve=links ${GIT_ROOT}/build/C/${install_dir}/notification/fledge* "${install_dir}/" echo "Done." From fbcab9af19438284a0dffffb42cdac3e7c56e03e Mon Sep 17 00:00:00 2001 From: YashTatkondawar Date: Fri, 8 Jan 2021 16:57:36 +0530 Subject: [PATCH 3/9] Replaced master with main --- README.rst | 2 +- docker/Dockerfile | 2 +- docker/README.md | 2 +- make_rpm | 2 +- plugins/make_deb | 2 +- plugins/make_rpm | 2 +- service/make_deb | 2 +- service/make_rpm | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 4aa953a..3645e7c 100644 --- a/README.rst +++ b/README.rst @@ -141,7 +141,7 @@ The make_rpm Script Building a RPM Package ====================== -``make_rpm`` script automatically do Fledge clone repo with branch master (by default) and then ``sudo make install`` followed by some prerequisite +``make_rpm`` script automatically do Fledge clone repo with branch main (by default) and then ``sudo make install`` followed by some prerequisite You may override the branch with ``-b`` or skip Fledge build with ``-s``. For more info just see its help ``-h`` diff --git a/docker/Dockerfile b/docker/Dockerfile index 788b512..3011cfa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:18.04 MAINTAINER Vaibhav Singhal "vaibhav@dianomic.com" -ARG FLEDGE_BRANCH=master +ARG FLEDGE_BRANCH=main ENV FLEDGE_BRANCH ${FLEDGE_BRANCH} RUN apt-get update && apt-get -y upgrade RUN apt-get install -y git rsyslog diff --git a/docker/README.md b/docker/README.md index e41361d..f6790fc 100644 --- a/docker/README.md +++ b/docker/README.md @@ -25,7 +25,7 @@ https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ docker build --tag fledge --build-arg FLEDGE_BRANCH=develop . ``` -where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, master, 1.5.2 ,etc) +where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, main, 1.5.2 ,etc) ### Run container diff --git a/make_rpm b/make_rpm index 3f608b7..6cde349 100755 --- a/make_rpm +++ b/make_rpm @@ -23,7 +23,7 @@ set -e PKG_ROOT=`pwd` # The script must be executed from the root git directory repo_name="fledge" # Name of the Git repository -branch="master" # Default Git branch to use +branch="main" # Default Git branch to use pkg_name="fledge" # Name of the package to build architecture="x86_64" # The architecture for which the rpm should be created rhpg_pkg="rh-postgresql96" # Name of the Red Hat package for postgres diff --git a/plugins/make_deb b/plugins/make_deb index ab5eccb..645cbba 100755 --- a/plugins/make_deb +++ b/plugins/make_deb @@ -22,7 +22,7 @@ set -e # Default branch to package -BRANCH_NAME=master +BRANCH_NAME=main USAGE="$(basename "$0") [-h] [-a] [-b ] repository ... This script is used to create the Debian package for a Fledge plugin diff --git a/plugins/make_rpm b/plugins/make_rpm index 5237725..6971179 100755 --- a/plugins/make_rpm +++ b/plugins/make_rpm @@ -22,7 +22,7 @@ set -e # Default branch to package -branch=master +branch=main usage="$(basename "$0") [-a] [-c] [-h] [-b ] repository ... This script is used to create the RPM package for a Fledge plugin diff --git a/service/make_deb b/service/make_deb index 5b20798..2d546f3 100755 --- a/service/make_deb +++ b/service/make_deb @@ -22,7 +22,7 @@ set -e # Default branch to package -BRANCH_NAME=master +BRANCH_NAME=main USAGE="$(basename "$0") [-h] [-a] [-b ] repository ... This script is used to create the Debian package for a Fledge service diff --git a/service/make_rpm b/service/make_rpm index b8c7867..8851eed 100755 --- a/service/make_rpm +++ b/service/make_rpm @@ -22,7 +22,7 @@ set -e # Default branch to package -BRANCH_NAME=master +BRANCH_NAME=main USAGE="$(basename "$0") [-h] [-a] [-b ] repository ... This script is used to create the RPM package for a Fledge service From d17205e0ed22803ddd84f9d7c49fbde717935e1e Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Mon, 11 Jan 2021 17:55:38 +0530 Subject: [PATCH 4/9] additional libraries centralized scripts added in other directory Signed-off-by: ashish-jabble --- .gitignore | 2 + others/README.rst | 310 ++++++++++++++++++++++++++++ others/make_deb | 129 ++++++++++++ others/packages/DEBIAN/control | 10 + others/packages/DEBIAN/postinst | 28 +++ others/scripts/mqtt/Description | 1 + others/scripts/mqtt/VERSION | 2 + others/scripts/mqtt/requirements.sh | 32 +++ 8 files changed, 514 insertions(+) create mode 100644 others/README.rst create mode 100755 others/make_deb create mode 100644 others/packages/DEBIAN/control create mode 100755 others/packages/DEBIAN/postinst create mode 100644 others/scripts/mqtt/Description create mode 100644 others/scripts/mqtt/VERSION create mode 100755 others/scripts/mqtt/requirements.sh diff --git a/.gitignore b/.gitignore index 5f596f5..936fd6b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,9 @@ # Build packages/Debian/build/ packages/RPM/build/ +others/paho.mqtt.c/ # Archived packages plugins/archive service/archive +others/archive diff --git a/others/README.rst b/others/README.rst new file mode 100644 index 0000000..a0daed0 --- /dev/null +++ b/others/README.rst @@ -0,0 +1,310 @@ +********************************** +Packaging for Additional libraries +********************************** + +This directory contains the deb scripts used to create a additional library package. + +Internal Structure +================== + +The directory contains the following set of files: + +- File name ``make_deb`` is the shell script used to build the package. +- The **packages** folder contains *DEBIAN* structure + - Inside the *packages/DEBIAN* folder, which contains all the Debian-based files, i.e. control, postinst, needed for the creation of the package. + +- The **archive** folder contains the debian package + - Actual debian files and package exists in the *archive/DEBIAN/architecture_name/{additional_lib_name}* + +- The **scripts** folder contains the internal files for additional package + - In the *scripts/{additional_lib_name}/Description* which contains the description of a package. + - In the *scripts/{additional_lib_name}/VERSION* which contains the version info for the additional and the fledge core version. + - In the *scripts/{additional_lib_name}/requirements.sh* which is shell script to obtain the actual additional libraries. + + +The make_deb Script +=================== + +.. code-block:: console + + $ ./make_deb -h + make_deb [-h] [-a] ... + This script is used to create the Debian package for to support other additional libraries as separately such as mqtt + + Arguments: + -h - Display this help text + -a - Remove all the archive versions + $ + +Building a Debian Package +========================= + +.. code-block:: console + + $ ./make_deb mqtt + Cloning into 'paho.mqtt.c'... + remote: Enumerating objects: 10055, done. + remote: Total 10055 (delta 0), reused 0 (delta 0), pack-reused 10055 + Receiving objects: 100% (10055/10055), 7.82 MiB | 2.80 MiB/s, done. + Resolving deltas: 100% (7112/7112), done. + [sudo] password for aj: + Reading package lists... Done + Building dependency tree + Reading state information... Done + pkg-config is already the newest version (0.29.1-0ubuntu2). + libssl-dev is already the newest version (1.1.1-1ubuntu2.1~18.04.7). + The following packages were automatically installed and are no longer required: + libatlas-base-dev libatlas3-base libboost-filesystem-dev libboost-program-options-dev libgfortran4 linux-hwe-5.4-headers-5.4.0-42 + linux-hwe-5.4-headers-5.4.0-47 linux-hwe-5.4-headers-5.4.0-48 linux-hwe-5.4-headers-5.4.0-51 linux-hwe-5.4-headers-5.4.0-52 + linux-hwe-5.4-headers-5.4.0-54 + Use 'sudo apt autoremove' to remove them. + 0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded. + -- The C compiler identification is GNU 7.5.0 + -- Check for working C compiler: /usr/bin/cc + -- Check for working C compiler: /usr/bin/cc -- works + -- Detecting C compiler ABI info + -- Detecting C compiler ABI info - done + -- Detecting C compile features + -- Detecting C compile features - done + -- CMake version: 3.10.2 + -- CMake system name: Linux + -- Timestamp is 2021-01-11T11:14:26Z + -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1") + -- Configuring done + -- Generating done + -- Build files have been written to: /home/aj/Development/fledge-pkg/others/paho.mqtt.c/build + Scanning dependencies of target common_obj + [ 1%] Building C object src/CMakeFiles/common_obj.dir/MQTTTime.c.o + [ 2%] Building C object src/CMakeFiles/common_obj.dir/MQTTProtocolClient.c.o + [ 3%] Building C object src/CMakeFiles/common_obj.dir/Clients.c.o + [ 4%] Building C object src/CMakeFiles/common_obj.dir/utf-8.c.o + [ 5%] Building C object src/CMakeFiles/common_obj.dir/MQTTPacket.c.o + [ 6%] Building C object src/CMakeFiles/common_obj.dir/MQTTPacketOut.c.o + [ 7%] Building C object src/CMakeFiles/common_obj.dir/Messages.c.o + [ 8%] Building C object src/CMakeFiles/common_obj.dir/Tree.c.o + [ 9%] Building C object src/CMakeFiles/common_obj.dir/Socket.c.o + [ 10%] Building C object src/CMakeFiles/common_obj.dir/Log.c.o + [ 11%] Building C object src/CMakeFiles/common_obj.dir/MQTTPersistence.c.o + [ 12%] Building C object src/CMakeFiles/common_obj.dir/Thread.c.o + [ 13%] Building C object src/CMakeFiles/common_obj.dir/MQTTProtocolOut.c.o + [ 15%] Building C object src/CMakeFiles/common_obj.dir/MQTTPersistenceDefault.c.o + [ 16%] Building C object src/CMakeFiles/common_obj.dir/SocketBuffer.c.o + [ 17%] Building C object src/CMakeFiles/common_obj.dir/LinkedList.c.o + [ 18%] Building C object src/CMakeFiles/common_obj.dir/MQTTProperties.c.o + [ 19%] Building C object src/CMakeFiles/common_obj.dir/MQTTReasonCodes.c.o + [ 20%] Building C object src/CMakeFiles/common_obj.dir/Base64.c.o + [ 21%] Building C object src/CMakeFiles/common_obj.dir/SHA1.c.o + [ 22%] Building C object src/CMakeFiles/common_obj.dir/WebSocket.c.o + [ 23%] Building C object src/CMakeFiles/common_obj.dir/StackTrace.c.o + [ 24%] Building C object src/CMakeFiles/common_obj.dir/Heap.c.o + [ 24%] Built target common_obj + Scanning dependencies of target paho-mqtt3a + [ 25%] Building C object src/CMakeFiles/paho-mqtt3a.dir/MQTTAsync.c.o + [ 26%] Building C object src/CMakeFiles/paho-mqtt3a.dir/MQTTAsyncUtils.c.o + [ 27%] Linking C shared library libpaho-mqtt3a.so + [ 27%] Built target paho-mqtt3a + Scanning dependencies of target paho-mqtt3c + [ 29%] Building C object src/CMakeFiles/paho-mqtt3c.dir/MQTTClient.c.o + [ 30%] Linking C shared library libpaho-mqtt3c.so + [ 30%] Built target paho-mqtt3c + Scanning dependencies of target common_ssl_obj + [ 31%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTTime.c.o + [ 31%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTProtocolClient.c.o + [ 32%] Building C object src/CMakeFiles/common_ssl_obj.dir/Clients.c.o + [ 33%] Building C object src/CMakeFiles/common_ssl_obj.dir/utf-8.c.o + [ 34%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTPacket.c.o + [ 35%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTPacketOut.c.o + [ 36%] Building C object src/CMakeFiles/common_ssl_obj.dir/Messages.c.o + [ 37%] Building C object src/CMakeFiles/common_ssl_obj.dir/Tree.c.o + [ 38%] Building C object src/CMakeFiles/common_ssl_obj.dir/Socket.c.o + [ 39%] Building C object src/CMakeFiles/common_ssl_obj.dir/Log.c.o + [ 40%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTPersistence.c.o + [ 41%] Building C object src/CMakeFiles/common_ssl_obj.dir/Thread.c.o + [ 43%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTProtocolOut.c.o + [ 44%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTPersistenceDefault.c.o + [ 45%] Building C object src/CMakeFiles/common_ssl_obj.dir/SocketBuffer.c.o + [ 46%] Building C object src/CMakeFiles/common_ssl_obj.dir/LinkedList.c.o + [ 47%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTProperties.c.o + [ 48%] Building C object src/CMakeFiles/common_ssl_obj.dir/MQTTReasonCodes.c.o + [ 49%] Building C object src/CMakeFiles/common_ssl_obj.dir/Base64.c.o + [ 50%] Building C object src/CMakeFiles/common_ssl_obj.dir/SHA1.c.o + [ 51%] Building C object src/CMakeFiles/common_ssl_obj.dir/WebSocket.c.o + [ 52%] Building C object src/CMakeFiles/common_ssl_obj.dir/StackTrace.c.o + [ 53%] Building C object src/CMakeFiles/common_ssl_obj.dir/Heap.c.o + [ 53%] Built target common_ssl_obj + Scanning dependencies of target paho-mqtt3cs + [ 54%] Building C object src/CMakeFiles/paho-mqtt3cs.dir/MQTTClient.c.o + [ 55%] Building C object src/CMakeFiles/paho-mqtt3cs.dir/SSLSocket.c.o + [ 56%] Linking C shared library libpaho-mqtt3cs.so + [ 56%] Built target paho-mqtt3cs + Scanning dependencies of target MQTTVersion + [ 58%] Building C object src/CMakeFiles/MQTTVersion.dir/MQTTVersion.c.o + [ 59%] Linking C executable MQTTVersion + [ 59%] Built target MQTTVersion + Scanning dependencies of target paho-mqtt3as + [ 60%] Building C object src/CMakeFiles/paho-mqtt3as.dir/MQTTAsync.c.o + [ 61%] Building C object src/CMakeFiles/paho-mqtt3as.dir/MQTTAsyncUtils.c.o + [ 62%] Building C object src/CMakeFiles/paho-mqtt3as.dir/SSLSocket.c.o + [ 63%] Linking C shared library libpaho-mqtt3as.so + [ 63%] Built target paho-mqtt3as + Scanning dependencies of target test_connect_destroy + [ 64%] Building C object test/CMakeFiles/test_connect_destroy.dir/test_connect_destroy.c.o + [ 65%] Linking C executable test_connect_destroy + [ 65%] Built target test_connect_destroy + Scanning dependencies of target test4 + [ 66%] Building C object test/CMakeFiles/test4.dir/test4.c.o + [ 67%] Linking C executable test4 + [ 67%] Built target test4 + Scanning dependencies of target test1 + [ 67%] Building C object test/CMakeFiles/test1.dir/test1.c.o + [ 68%] Linking C executable test1 + [ 68%] Built target test1 + Scanning dependencies of target test6 + [ 69%] Building C object test/CMakeFiles/test6.dir/test6.c.o + [ 70%] Linking C executable test6 + [ 70%] Built target test6 + Scanning dependencies of target test2 + [ 72%] Building C object test/CMakeFiles/test2.dir/test2.c.o + [ 73%] Linking C executable test2 + [ 73%] Built target test2 + Scanning dependencies of target test11 + [ 74%] Building C object test/CMakeFiles/test11.dir/test11.c.o + [ 75%] Linking C executable test11 + [ 75%] Built target test11 + Scanning dependencies of target test15 + [ 76%] Building C object test/CMakeFiles/test15.dir/test15.c.o + [ 77%] Linking C executable test15 + [ 77%] Built target test15 + Scanning dependencies of target thread + [ 78%] Building C object test/CMakeFiles/thread.dir/thread.c.o + [ 79%] Building C object test/CMakeFiles/thread.dir/__/src/Thread.c.o + [ 80%] Linking C executable thread + [ 80%] Built target thread + Scanning dependencies of target test45 + [ 81%] Building C object test/CMakeFiles/test45.dir/test45.c.o + [ 82%] Linking C executable test45 + [ 82%] Built target test45 + Scanning dependencies of target test5 + [ 83%] Building C object test/CMakeFiles/test5.dir/test5.c.o + [ 84%] Linking C executable test5 + [ 84%] Built target test5 + Scanning dependencies of target test8 + [ 86%] Building C object test/CMakeFiles/test8.dir/test8.c.o + [ 87%] Linking C executable test8 + [ 87%] Built target test8 + Scanning dependencies of target test3 + [ 88%] Building C object test/CMakeFiles/test3.dir/test3.c.o + [ 89%] Linking C executable test3 + [ 89%] Built target test3 + Scanning dependencies of target test9 + [ 90%] Building C object test/CMakeFiles/test9.dir/test9.c.o + [ 91%] Linking C executable test9 + [ 91%] Built target test9 + Scanning dependencies of target test_sync_session_present + [ 92%] Building C object test/CMakeFiles/test_sync_session_present.dir/test_sync_session_present.c.o + [ 93%] Linking C executable test_sync_session_present + [ 93%] Built target test_sync_session_present + Scanning dependencies of target test95 + [ 94%] Building C object test/CMakeFiles/test95.dir/test95.c.o + [ 95%] Linking C executable test95 + [ 95%] Built target test95 + Scanning dependencies of target test10 + [ 96%] Building C object test/CMakeFiles/test10.dir/test10.c.o + [ 97%] Linking C executable test10 + [ 97%] Built target test10 + Scanning dependencies of target test_issue373 + [ 98%] Building C object test/CMakeFiles/test_issue373.dir/test_issue373.c.o + [100%] Linking C executable test_issue373 + [100%] Built target test_issue373 + [ 24%] Built target common_obj + [ 27%] Built target paho-mqtt3a + [ 30%] Built target paho-mqtt3c + [ 53%] Built target common_ssl_obj + [ 56%] Built target paho-mqtt3cs + [ 59%] Built target MQTTVersion + [ 63%] Built target paho-mqtt3as + [ 65%] Built target test_connect_destroy + [ 67%] Built target test4 + [ 68%] Built target test1 + [ 70%] Built target test6 + [ 73%] Built target test2 + [ 75%] Built target test11 + [ 77%] Built target test15 + [ 80%] Built target thread + [ 82%] Built target test45 + [ 84%] Built target test5 + [ 87%] Built target test8 + [ 89%] Built target test3 + [ 91%] Built target test9 + [ 93%] Built target test_sync_session_present + [ 95%] Built target test95 + [ 97%] Built target test10 + [100%] Built target test_issue373 + Install the project... + -- Install configuration: "" + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/MQTTAsync_publish.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/MQTTAsync_publish_time.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/MQTTAsync_subscribe.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/MQTTClient_publish.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/MQTTClient_publish_async.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/MQTTClient_subscribe.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/paho_c_pub.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/paho_c_sub.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/paho_cs_pub.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/paho_cs_sub.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/samples/pubsub_opts.c + -- Installing: /usr/local/share/doc/Eclipse Paho C/CONTRIBUTING.md + -- Installing: /usr/local/share/doc/Eclipse Paho C/epl-v20 + -- Installing: /usr/local/share/doc/Eclipse Paho C/edl-v10 + -- Installing: /usr/local/share/doc/Eclipse Paho C/README.md + -- Installing: /usr/local/share/doc/Eclipse Paho C/notice.html + -- Installing: /usr/local/lib/libpaho-mqtt3c.so.1.3.8 + -- Installing: /usr/local/lib/libpaho-mqtt3c.so.1 + -- Up-to-date: /usr/local/lib/libpaho-mqtt3c.so + -- Installing: /usr/local/lib/libpaho-mqtt3a.so.1.3.8 + -- Installing: /usr/local/lib/libpaho-mqtt3a.so.1 + -- Up-to-date: /usr/local/lib/libpaho-mqtt3a.so + -- Installing: /usr/local/bin/MQTTVersion + -- Set runtime path of "/usr/local/bin/MQTTVersion" to "" + -- Installing: /usr/local/include/MQTTAsync.h + -- Installing: /usr/local/include/MQTTClient.h + -- Installing: /usr/local/include/MQTTClientPersistence.h + -- Installing: /usr/local/include/MQTTProperties.h + -- Installing: /usr/local/include/MQTTReasonCodes.h + -- Installing: /usr/local/include/MQTTSubscribeOpts.h + -- Installing: /usr/local/include/MQTTExportDeclarations.h + -- Installing: /usr/local/lib/libpaho-mqtt3cs.so.1.3.8 + -- Installing: /usr/local/lib/libpaho-mqtt3cs.so.1 + -- Up-to-date: /usr/local/lib/libpaho-mqtt3cs.so + -- Installing: /usr/local/lib/libpaho-mqtt3as.so.1.3.8 + -- Installing: /usr/local/lib/libpaho-mqtt3as.so.1 + -- Up-to-date: /usr/local/lib/libpaho-mqtt3as.so + -- Installing: /usr/local/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfig.cmake + -- Installing: /usr/local/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfig-noconfig.cmake + -- Installing: /usr/local/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfigVersion.cmake + Additional mqtt Package version is : 1.8.2 + The Fledge required version is : >=1.8 + The architecture is set as : x86_64 + The package will be built in : /home/aj/Development/fledge-pkg/others/archive/DEBIAN/x86_64 + The package name is : fledge-mqtt-1.8.2-x86_64 + + Populating the package and updating version file...Done. + Building the fledge-mqtt-1.8.2-x86_64 package... + dpkg-deb: building package 'fledge-mqtt' in 'fledge-mqtt-1.8.2-x86_64.deb'. + Building Complete. + $ + +The result will be: + +.. code-block:: console + + $ ls -la archive/DEBIAN/x86_64/ + total 216 + drwxr-xr-x 4 aj aj 4096 Jan 11 16:44 fledge-mqtt-1.8.2-x86_64 + -rw-r--r-- 1 aj aj 208116 Jan 11 16:44 fledge-mqtt-1.8.2-x86_64.deb + $ + +Cleaning the Package Folder +=========================== + +Use the ``-a`` option to remove all the packages and the files which we used to make the package. diff --git a/others/make_deb b/others/make_deb new file mode 100755 index 0000000..35dcb63 --- /dev/null +++ b/others/make_deb @@ -0,0 +1,129 @@ +#!/bin/bash + +##-------------------------------------------------------------------- +## Copyright (c) 2021 Dianomic Systems Inc. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +##-------------------------------------------------------------------- +## +## Author: Ashish Jabble +## + +set -e + +USAGE="$(basename "$0") [-h] [-a] ... +This script is used to create the Debian package for to support other additional libraries as separately such as mqtt + +Arguments: + -h - Display this help text + -a - Remove all the archive versions" + +while getopts ":ha" opt; do + case "$opt" in + a) + if [ -d "./archive" ]; then + echo -n "Cleaning the package archive folder..." + rm -rf ./archive/* + echo "Done." + else + echo "No archive folder, skipping cleanall" + fi + exit 0 + ;; + h) + echo "${USAGE}" + exit 0 + ;; + \?) + echo "Invalid option -$OPTARG" + exit 1 + ;; + :) + echo "-$OPTARG requires an argument" + exit 1 + esac +done +shift $((OPTIND -1)) + +ADDITIONAL_LIB_NAME=$1 +if [ "${ADDITIONAL_LIB_NAME}" = "" ]; then + echo You must specify additional library name to package + exit 1 +fi + +# VERSION +if [ -f scripts/${ADDITIONAL_LIB_NAME}/VERSION ]; then + version=`cat scripts/${ADDITIONAL_LIB_NAME}/VERSION | tr -d ' ' | grep "fledge_${ADDITIONAL_LIB_NAME}_version" | head -1 | sed -e 's/\(.*\)=\(.*\)/\2/g'` + fledge_version=`cat scripts/${ADDITIONAL_LIB_NAME}/VERSION | tr -d ' ' | grep 'fledge_version' | head -1 | sed -e 's/\(.*\)version\(.*\)/\2/g'` +else + echo VERSION file is missing for ${ADDITIONAL_LIB_NAME} in "others/scripts/" directory + exit 1 +fi + +# Description +if [ -f scripts/${ADDITIONAL_LIB_NAME}/Description ]; then + description=`cat "scripts/${ADDITIONAL_LIB_NAME}/Description"` +else + echo Description file is missing for ${ADDITIONAL_LIB_NAME} in "others/scripts/" directory + exit 1 +fi + +# requirements.sh +if [ -f scripts/${ADDITIONAL_LIB_NAME}/requirements.sh ]; then + ./scripts/${ADDITIONAL_LIB_NAME}/requirements.sh +else + echo Requirement script is missing for ${ADDITIONAL_LIB_NAME} "others/scripts/" directory + exit 1 +fi + +architecture=`arch` +PKG_ROOT=`pwd` +archive=${PKG_ROOT}/archive/DEBIAN +pkg_name="fledge-${ADDITIONAL_LIB_NAME}" +arch_name=$(dpkg --print-architecture) +package_name="${pkg_name}-${version}-${architecture}" + +if [ ! -d "${archive}/${architecture}" ]; then + mkdir -p "${archive}/${architecture}/${package_name}" +fi + +# Print the summary of findings +echo "Additional ${ADDITIONAL_LIB_NAME} Package version is : ${version}" +echo "The Fledge required version is : ${fledge_version}" +echo "The architecture is set as : ${architecture}" +echo "The package will be built in : ${archive}/${architecture}" +echo "The package name is : ${package_name}" +echo + +echo -n "Populating the package and updating version file..." +cd "${archive}/${architecture}/${package_name}" +mkdir -p DEBIAN +cp -R ${PKG_ROOT}/packages/DEBIAN/* DEBIAN +sed -i "s/__VERSION__/${version}/g" DEBIAN/control +sed -i "s/__NAME__/${pkg_name}/g" DEBIAN/control +sed -i "s/__ARCH__/${arch_name}/g" DEBIAN/control +sed -i "s/__REQUIRES__/fledge (${fledge_version})/g" DEBIAN/control +sed -i "s/__DESCRIPTION__/${description}/g" DEBIAN/control + +# Debian file structure +mkdir -p usr/local/lib +if [ "${ADDITIONAL_LIB_NAME}" == "mqtt" ]; then + cp -R --preserve=links /usr/local/lib/libpaho* usr/local/lib +fi +echo "Done." + +# Build the package +cd "${archive}/${architecture}" +echo "Building the ${package_name} package..." +dpkg-deb --build ${package_name} +echo "Building Complete." diff --git a/others/packages/DEBIAN/control b/others/packages/DEBIAN/control new file mode 100644 index 0000000..fffebf3 --- /dev/null +++ b/others/packages/DEBIAN/control @@ -0,0 +1,10 @@ +Package: __NAME__ +Version: __VERSION__ +Section: devel +Priority: optional +Architecture: __ARCH__ +Depends: __REQUIRES__ +Conflicts: +Maintainer: Dianomic Systems, Inc. +Homepage: http://www.dianomic.com +Description: __DESCRIPTION__ diff --git a/others/packages/DEBIAN/postinst b/others/packages/DEBIAN/postinst new file mode 100755 index 0000000..b4c02ba --- /dev/null +++ b/others/packages/DEBIAN/postinst @@ -0,0 +1,28 @@ +#!/bin/sh + +##-------------------------------------------------------------------- +## Copyright (c) 2021 Dianomic Systems Inc. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +##-------------------------------------------------------------------- + +##-------------------------------------------------------------------- +## +## @postinst DEBIAN/postinst +## This script is used to execute post installation tasks. +## +## Author: Ashish Jabble +## +##-------------------------------------------------------------------- + +set -e diff --git a/others/scripts/mqtt/Description b/others/scripts/mqtt/Description new file mode 100644 index 0000000..0e0e4cd --- /dev/null +++ b/others/scripts/mqtt/Description @@ -0,0 +1 @@ +The Paho MQTT C Client additional libraries. \ No newline at end of file diff --git a/others/scripts/mqtt/VERSION b/others/scripts/mqtt/VERSION new file mode 100644 index 0000000..a7aa93a --- /dev/null +++ b/others/scripts/mqtt/VERSION @@ -0,0 +1,2 @@ +fledge_mqtt_version=1.8.2 +fledge_version>=1.8 diff --git a/others/scripts/mqtt/requirements.sh b/others/scripts/mqtt/requirements.sh new file mode 100755 index 0000000..8574fad --- /dev/null +++ b/others/scripts/mqtt/requirements.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +##-------------------------------------------------------------------- +## Copyright (c) 2021 Dianomic Systems +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +##-------------------------------------------------------------------- + +## +## Author: Ashish Jabble +## + +set -e + +git clone https://github.com/eclipse/paho.mqtt.c.git +sudo apt-get install libssl-dev pkg-config +cd paho.mqtt.c +mkdir build +cd build +cmake -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_WITH_SSL=TRUE .. +make +sudo make install From 6d546659bdf213d62e9861631c94ad8a938e942f Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Wed, 13 Jan 2021 14:49:32 +0530 Subject: [PATCH 5/9] additional lib name & version supported in plugins make_deb script Signed-off-by: ashish-jabble --- plugins/make_deb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/make_deb b/plugins/make_deb index 645cbba..2e7203e 100755 --- a/plugins/make_deb +++ b/plugins/make_deb @@ -135,6 +135,11 @@ do service_notification_version=`cat ${GIT_ROOT}/service_notification.version | tr -d ' ' | grep 'service_notification_version' | head -1 | sed -e 's/\(.*\)version\(.*\)/\2/g'` echo "The Service notification required version : ${service_notification_version}" fi + if [ -f "${GIT_ROOT}/additional_lib.version" ]; then + additional_lib_name=`cat additional_lib.version | cut -d ":" -f1` + additional_lib_version=`cat additional_lib.version | cut -d ":" -f2` + echo "The Additional ${additional_lib_name} Library required version : ${additional_lib_version}" + fi echo # Create the package directory. If a directory with the same name exists, @@ -190,6 +195,9 @@ do sed -i "s/__DESCRIPTION__/${desc}/g" ${deb_path}/control if [ ! -z "${service_notification_version}" ] ; then sed -i "s/fledge-service-notification/fledge-service-notification (${service_notification_version})/" ${deb_path}/control + fi + if [ ! -z "${additional_lib_version}" ] ; then + sed -i "s/fledge-${additional_lib_name}/fledge-${additional_lib_name} (${additional_lib_version})/" ${deb_path}/control fi # install notes if [ -f "${GIT_ROOT}/install_notes.txt" ]; then From 5e4a82230a8d2e33fdfadfbb66754e037e61aa05 Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Fri, 15 Jan 2021 17:53:03 +0530 Subject: [PATCH 6/9] GCP additional folder added Signed-off-by: ashish-jabble --- others/scripts/gcp/Description | 1 + others/scripts/gcp/VERSION | 2 ++ others/scripts/gcp/requirements.sh | 41 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 others/scripts/gcp/Description create mode 100644 others/scripts/gcp/VERSION create mode 100755 others/scripts/gcp/requirements.sh diff --git a/others/scripts/gcp/Description b/others/scripts/gcp/Description new file mode 100644 index 0000000..e9f37a7 --- /dev/null +++ b/others/scripts/gcp/Description @@ -0,0 +1 @@ +libjwt which allows you to encode and decode JSON Web Tokens (JWT) and Jansson for encoding, decoding and manipulating JSON data are the additional libraries which will be used in GCP plugins. diff --git a/others/scripts/gcp/VERSION b/others/scripts/gcp/VERSION new file mode 100644 index 0000000..a4ad6ef --- /dev/null +++ b/others/scripts/gcp/VERSION @@ -0,0 +1,2 @@ +fledge_gcp_version=1.8.2 +fledge_version>=1.8 \ No newline at end of file diff --git a/others/scripts/gcp/requirements.sh b/others/scripts/gcp/requirements.sh new file mode 100755 index 0000000..eb3acc4 --- /dev/null +++ b/others/scripts/gcp/requirements.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +##-------------------------------------------------------------------- +## Copyright (c) 2021 Dianomic Systems +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +##-------------------------------------------------------------------- + +## +## Author: Ashish Jabble +## + +set -e + +# Jansson for encoding, decoding and manipulating JSON data +rm -rf jansson; git clone https://github.com/akheron/jansson.git +cd jansson +mkdir build +cd build +cmake .. +make +sudo make install +cd - + +# libjwt which allows you to encode and decode JSON Web Tokens (JWT) +rm -rf libjwt; git clone https://github.com/benmcollins/libjwt.git +cd libjwt +autoreconf -i +./configure +make +sudo make install From be15ed7ebe7ee494ab6e1c283f0b4c74677cda15 Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Fri, 15 Jan 2021 17:54:25 +0530 Subject: [PATCH 7/9] others debains script updatedas per additional GCP package support Signed-off-by: ashish-jabble --- .gitignore | 1 + others/make_deb | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 936fd6b..95ff5b9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ packages/Debian/build/ packages/RPM/build/ others/paho.mqtt.c/ +others/jansson # Archived packages plugins/archive diff --git a/others/make_deb b/others/make_deb index 35dcb63..ac2774d 100755 --- a/others/make_deb +++ b/others/make_deb @@ -22,7 +22,7 @@ set -e USAGE="$(basename "$0") [-h] [-a] ... -This script is used to create the Debian package for to support other additional libraries as separately such as mqtt +This script is used to create the Debian package for to support other additional libraries as separately such as mqtt, gcp Arguments: -h - Display this help text @@ -94,7 +94,7 @@ arch_name=$(dpkg --print-architecture) package_name="${pkg_name}-${version}-${architecture}" if [ ! -d "${archive}/${architecture}" ]; then - mkdir -p "${archive}/${architecture}/${package_name}" + mkdir -p "${archive}/${architecture}" fi # Print the summary of findings @@ -106,6 +106,9 @@ echo "The package name is : ${package_name}" echo echo -n "Populating the package and updating version file..." +if [ ! -d "${archive}/${architecture}/${package_name}" ]; then + mkdir -p "${archive}/${architecture}/${package_name}" +fi cd "${archive}/${architecture}/${package_name}" mkdir -p DEBIAN cp -R ${PKG_ROOT}/packages/DEBIAN/* DEBIAN @@ -120,6 +123,10 @@ mkdir -p usr/local/lib if [ "${ADDITIONAL_LIB_NAME}" == "mqtt" ]; then cp -R --preserve=links /usr/local/lib/libpaho* usr/local/lib fi +if [ "${ADDITIONAL_LIB_NAME}" == "gcp" ]; then + cp -R --preserve=links /usr/local/lib/libjwt* usr/local/lib + cp -R --preserve=links /usr/local/lib/libjansson* usr/local/lib +fi echo "Done." # Build the package From 67568419d4bad257c96bed1edf0fbe715042ed81 Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Fri, 15 Jan 2021 17:55:45 +0530 Subject: [PATCH 8/9] plugins make debian script updated as per multiple additional libraries Signed-off-by: ashish-jabble --- plugins/make_deb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/make_deb b/plugins/make_deb index 2e7203e..656f669 100755 --- a/plugins/make_deb +++ b/plugins/make_deb @@ -135,11 +135,6 @@ do service_notification_version=`cat ${GIT_ROOT}/service_notification.version | tr -d ' ' | grep 'service_notification_version' | head -1 | sed -e 's/\(.*\)version\(.*\)/\2/g'` echo "The Service notification required version : ${service_notification_version}" fi - if [ -f "${GIT_ROOT}/additional_lib.version" ]; then - additional_lib_name=`cat additional_lib.version | cut -d ":" -f1` - additional_lib_version=`cat additional_lib.version | cut -d ":" -f2` - echo "The Additional ${additional_lib_name} Library required version : ${additional_lib_version}" - fi echo # Create the package directory. If a directory with the same name exists, @@ -196,9 +191,17 @@ do if [ ! -z "${service_notification_version}" ] ; then sed -i "s/fledge-service-notification/fledge-service-notification (${service_notification_version})/" ${deb_path}/control fi - if [ ! -z "${additional_lib_version}" ] ; then - sed -i "s/fledge-${additional_lib_name}/fledge-${additional_lib_name} (${additional_lib_version})/" ${deb_path}/control + if [ -f "${GIT_ROOT}/additional_lib.version" ]; then + while read line ; do + if [ ! -z "$line" ]; then + additional_lib_name=`echo ${line} | cut -d ":" -f1` + additional_lib_version=`echo ${line} | cut -d ":" -f2` + echo "The Additional ${additional_lib_name} Library required version: ${additional_lib_version}" + sed -i "s/fledge-${additional_lib_name}/fledge-${additional_lib_name} (${additional_lib_version})/" ${deb_path}/control + fi + done < "${GIT_ROOT}/additional_lib.version" fi + # install notes if [ -f "${GIT_ROOT}/install_notes.txt" ]; then cat > /tmp/sed.script.$$ << EOF From 6882ff5bb462ac00ad9f9d4d538d2bbf003d6c10 Mon Sep 17 00:00:00 2001 From: YashTatkondawar Date: Mon, 1 Feb 2021 21:23:33 +0530 Subject: [PATCH 9/9] Updated the version of other packages --- others/scripts/gcp/VERSION | 4 ++-- others/scripts/mqtt/VERSION | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/others/scripts/gcp/VERSION b/others/scripts/gcp/VERSION index a4ad6ef..c91db61 100644 --- a/others/scripts/gcp/VERSION +++ b/others/scripts/gcp/VERSION @@ -1,2 +1,2 @@ -fledge_gcp_version=1.8.2 -fledge_version>=1.8 \ No newline at end of file +fledge_gcp_version=1.9.0 +fledge_version>=1.9 \ No newline at end of file diff --git a/others/scripts/mqtt/VERSION b/others/scripts/mqtt/VERSION index a7aa93a..e5a490b 100644 --- a/others/scripts/mqtt/VERSION +++ b/others/scripts/mqtt/VERSION @@ -1,2 +1,2 @@ -fledge_mqtt_version=1.8.2 -fledge_version>=1.8 +fledge_mqtt_version=1.9.0 +fledge_version>=1.9