Skip to content

Commit

Permalink
Merge pull request #22 from fledge-iot/1.9.0RC
Browse files Browse the repository at this point in the history
1.9.0RC
  • Loading branch information
YashTatkondawar authored Feb 24, 2021
2 parents ccfd37d + 6882ff5 commit 0231d07
Show file tree
Hide file tree
Showing 19 changed files with 598 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
# Build
packages/Debian/build/
packages/RPM/build/
others/paho.mqtt.c/
others/jansson

# Archived packages
plugins/archive
service/archive
others/archive
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion make_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
310 changes: 310 additions & 0 deletions others/README.rst

Large diffs are not rendered by default.

136 changes: 136 additions & 0 deletions others/make_deb
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/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, gcp
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}"
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..."
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
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
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
cd "${archive}/${architecture}"
echo "Building the ${package_name} package..."
dpkg-deb --build ${package_name}
echo "Building Complete."
10 changes: 10 additions & 0 deletions others/packages/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: __NAME__
Version: __VERSION__
Section: devel
Priority: optional
Architecture: __ARCH__
Depends: __REQUIRES__
Conflicts:
Maintainer: Dianomic Systems, Inc. <info@dianomic.com>
Homepage: http://www.dianomic.com
Description: __DESCRIPTION__
28 changes: 28 additions & 0 deletions others/packages/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions others/scripts/gcp/Description
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions others/scripts/gcp/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fledge_gcp_version=1.9.0
fledge_version>=1.9
41 changes: 41 additions & 0 deletions others/scripts/gcp/requirements.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions others/scripts/mqtt/Description
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Paho MQTT C Client additional libraries.
2 changes: 2 additions & 0 deletions others/scripts/mqtt/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fledge_mqtt_version=1.9.0
fledge_version>=1.9
32 changes: 32 additions & 0 deletions others/scripts/mqtt/requirements.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 12 additions & 1 deletion plugins/make_deb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
set -e

# Default branch to package
BRANCH_NAME=master
BRANCH_NAME=main
USAGE="$(basename "$0") [-h] [-a] [-b <branch>] repository ...
This script is used to create the Debian package for a Fledge plugin
Expand Down Expand Up @@ -191,6 +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 [ -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
Expand Down
9 changes: 6 additions & 3 deletions plugins/make_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
set -e

# Default branch to package
branch=master
branch=main

usage="$(basename "$0") [-a] [-c] [-h] [-b <branch>] repository ...
This script is used to create the RPM package for a Fledge plugin
Expand Down Expand Up @@ -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}"

Expand Down
6 changes: 5 additions & 1 deletion service/make_deb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
set -e

# Default branch to package
BRANCH_NAME=master
BRANCH_NAME=main

USAGE="$(basename "$0") [-h] [-a] [-b <branch>] repository ...
This script is used to create the Debian package for a Fledge service
Expand Down Expand Up @@ -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."
Expand Down
Loading

0 comments on commit 0231d07

Please sign in to comment.