Skip to content

Commit e121334

Browse files
Merge pull request #21 from fledge-iot/FOGL-4900
FOGL-4900 fledge-gcp common package
2 parents de382af + 6756841 commit e121334

File tree

6 files changed

+64
-9
lines changed

6 files changed

+64
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
packages/Debian/build/
1313
packages/RPM/build/
1414
others/paho.mqtt.c/
15+
others/jansson
1516

1617
# Archived packages
1718
plugins/archive

others/make_deb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
set -e
2323

2424
USAGE="$(basename "$0") [-h] [-a] ...
25-
This script is used to create the Debian package for to support other additional libraries as separately such as mqtt
25+
This script is used to create the Debian package for to support other additional libraries as separately such as mqtt, gcp
2626
2727
Arguments:
2828
-h - Display this help text
@@ -94,7 +94,7 @@ arch_name=$(dpkg --print-architecture)
9494
package_name="${pkg_name}-${version}-${architecture}"
9595

9696
if [ ! -d "${archive}/${architecture}" ]; then
97-
mkdir -p "${archive}/${architecture}/${package_name}"
97+
mkdir -p "${archive}/${architecture}"
9898
fi
9999

100100
# Print the summary of findings
@@ -106,6 +106,9 @@ echo "The package name is : ${package_name}"
106106
echo
107107

108108
echo -n "Populating the package and updating version file..."
109+
if [ ! -d "${archive}/${architecture}/${package_name}" ]; then
110+
mkdir -p "${archive}/${architecture}/${package_name}"
111+
fi
109112
cd "${archive}/${architecture}/${package_name}"
110113
mkdir -p DEBIAN
111114
cp -R ${PKG_ROOT}/packages/DEBIAN/* DEBIAN
@@ -120,6 +123,10 @@ mkdir -p usr/local/lib
120123
if [ "${ADDITIONAL_LIB_NAME}" == "mqtt" ]; then
121124
cp -R --preserve=links /usr/local/lib/libpaho* usr/local/lib
122125
fi
126+
if [ "${ADDITIONAL_LIB_NAME}" == "gcp" ]; then
127+
cp -R --preserve=links /usr/local/lib/libjwt* usr/local/lib
128+
cp -R --preserve=links /usr/local/lib/libjansson* usr/local/lib
129+
fi
123130
echo "Done."
124131

125132
# Build the package

others/scripts/gcp/Description

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

others/scripts/gcp/VERSION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fledge_gcp_version=1.8.2
2+
fledge_version>=1.8

others/scripts/gcp/requirements.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
##--------------------------------------------------------------------
4+
## Copyright (c) 2021 Dianomic Systems
5+
##
6+
## Licensed under the Apache License, Version 2.0 (the "License");
7+
## you may not use this file except in compliance with the License.
8+
## You may obtain a copy of the License at
9+
##
10+
## http://www.apache.org/licenses/LICENSE-2.0
11+
##
12+
## Unless required by applicable law or agreed to in writing, software
13+
## distributed under the License is distributed on an "AS IS" BASIS,
14+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
## See the License for the specific language governing permissions and
16+
## limitations under the License.
17+
##--------------------------------------------------------------------
18+
19+
##
20+
## Author: Ashish Jabble
21+
##
22+
23+
set -e
24+
25+
# Jansson for encoding, decoding and manipulating JSON data
26+
rm -rf jansson; git clone https://github.com/akheron/jansson.git
27+
cd jansson
28+
mkdir build
29+
cd build
30+
cmake ..
31+
make
32+
sudo make install
33+
cd -
34+
35+
# libjwt which allows you to encode and decode JSON Web Tokens (JWT)
36+
rm -rf libjwt; git clone https://github.com/benmcollins/libjwt.git
37+
cd libjwt
38+
autoreconf -i
39+
./configure
40+
make
41+
sudo make install

plugins/make_deb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,6 @@ do
135135
service_notification_version=`cat ${GIT_ROOT}/service_notification.version | tr -d ' ' | grep 'service_notification_version' | head -1 | sed -e 's/\(.*\)version\(.*\)/\2/g'`
136136
echo "The Service notification required version : ${service_notification_version}"
137137
fi
138-
if [ -f "${GIT_ROOT}/additional_lib.version" ]; then
139-
additional_lib_name=`cat additional_lib.version | cut -d ":" -f1`
140-
additional_lib_version=`cat additional_lib.version | cut -d ":" -f2`
141-
echo "The Additional ${additional_lib_name} Library required version : ${additional_lib_version}"
142-
fi
143138
echo
144139

145140
# Create the package directory. If a directory with the same name exists,
@@ -196,9 +191,17 @@ do
196191
if [ ! -z "${service_notification_version}" ] ; then
197192
sed -i "s/fledge-service-notification/fledge-service-notification (${service_notification_version})/" ${deb_path}/control
198193
fi
199-
if [ ! -z "${additional_lib_version}" ] ; then
200-
sed -i "s/fledge-${additional_lib_name}/fledge-${additional_lib_name} (${additional_lib_version})/" ${deb_path}/control
194+
if [ -f "${GIT_ROOT}/additional_lib.version" ]; then
195+
while read line ; do
196+
if [ ! -z "$line" ]; then
197+
additional_lib_name=`echo ${line} | cut -d ":" -f1`
198+
additional_lib_version=`echo ${line} | cut -d ":" -f2`
199+
echo "The Additional ${additional_lib_name} Library required version: ${additional_lib_version}"
200+
sed -i "s/fledge-${additional_lib_name}/fledge-${additional_lib_name} (${additional_lib_version})/" ${deb_path}/control
201+
fi
202+
done < "${GIT_ROOT}/additional_lib.version"
201203
fi
204+
202205
# install notes
203206
if [ -f "${GIT_ROOT}/install_notes.txt" ]; then
204207
cat > /tmp/sed.script.$$ << EOF

0 commit comments

Comments
 (0)