Skip to content

Commit 527dbd4

Browse files
Merge remote-tracking branch 'origin/FOGL-5253.latest' into FOGL-5142
2 parents d20e0c0 + df5db52 commit 527dbd4

File tree

22 files changed

+825
-12
lines changed

22 files changed

+825
-12
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
# Build
1212
packages/Debian/build/
1313
packages/RPM/build/
14+
others/paho.mqtt.c/
15+
others/jansson
1416

1517
# Archived packages
1618
plugins/archive
1719
service/archive
20+
others/archive

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ The make_rpm Script
141141
Building a RPM Package
142142
======================
143143

144-
``make_rpm`` script automatically do Fledge clone repo with branch master (by default) and then ``sudo make install`` followed by some prerequisite
144+
``make_rpm`` script automatically do Fledge clone repo with branch main (by default) and then ``sudo make install`` followed by some prerequisite
145145

146146
You may override the branch with ``-b`` or skip Fledge build with ``-s``. For more info just see its help ``-h``
147147

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
2525
$ docker build --tag fledge:dev --build-arg FLEDGE_BRANCH=develop .
2626
```
2727

28-
where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, master, 1.5.2 ,etc)
28+
where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, main, 1.5.2 ,etc)
2929

3030
### Run container
3131

docker/latest/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Default will be built with latest stable relase.
1818

1919

2020
```
21-
$ docker run -d -v /Users/praveen-garg/Desktop/blah/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 fledge:latest
21+
$ docker run -d -v ~/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:latest
2222
```
2323

2424
-d : run fledge container in detached mode
@@ -33,6 +33,6 @@ Default will be built with latest stable relase.
3333

3434
# Tag and push to registry
3535

36-
$ sudo docker tag fledge:latest 52.3.255.136:5000/fledge:latest
36+
$ sudo docker tag fledge:latest 100.25.163.15:5000/fledge:latest
3737

38-
$ sudo docker push 52.3.255.136:5000/fledge:latest
38+
$ sudo docker push 100.25.163.15:5000/fledge:latest

make_rpm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set -e
2323

2424
PKG_ROOT=`pwd` # The script must be executed from the root git directory
2525
repo_name="fledge" # Name of the Git repository
26-
branch="master" # Default Git branch to use
26+
branch="main" # Default Git branch to use
2727
pkg_name="fledge" # Name of the package to build
2828
architecture="x86_64" # The architecture for which the rpm should be created
2929
rhpg_pkg="rh-postgresql96" # Name of the Red Hat package for postgres

others/README.rst

Lines changed: 310 additions & 0 deletions
Large diffs are not rendered by default.

others/make_deb

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#!/bin/bash
2+
3+
##--------------------------------------------------------------------
4+
## Copyright (c) 2021 Dianomic Systems Inc.
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+
## Author: Ashish Jabble
20+
##
21+
22+
set -e
23+
24+
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, gcp
26+
27+
Arguments:
28+
-h - Display this help text
29+
-a - Remove all the archive versions"
30+
31+
while getopts ":ha" opt; do
32+
case "$opt" in
33+
a)
34+
if [ -d "./archive" ]; then
35+
echo -n "Cleaning the package archive folder..."
36+
rm -rf ./archive/*
37+
echo "Done."
38+
else
39+
echo "No archive folder, skipping cleanall"
40+
fi
41+
exit 0
42+
;;
43+
h)
44+
echo "${USAGE}"
45+
exit 0
46+
;;
47+
\?)
48+
echo "Invalid option -$OPTARG"
49+
exit 1
50+
;;
51+
:)
52+
echo "-$OPTARG requires an argument"
53+
exit 1
54+
esac
55+
done
56+
shift $((OPTIND -1))
57+
58+
ADDITIONAL_LIB_NAME=$1
59+
if [ "${ADDITIONAL_LIB_NAME}" = "" ]; then
60+
echo You must specify additional library name to package
61+
exit 1
62+
fi
63+
64+
# VERSION
65+
if [ -f scripts/${ADDITIONAL_LIB_NAME}/VERSION ]; then
66+
version=`cat scripts/${ADDITIONAL_LIB_NAME}/VERSION | tr -d ' ' | grep "fledge_${ADDITIONAL_LIB_NAME}_version" | head -1 | sed -e 's/\(.*\)=\(.*\)/\2/g'`
67+
fledge_version=`cat scripts/${ADDITIONAL_LIB_NAME}/VERSION | tr -d ' ' | grep 'fledge_version' | head -1 | sed -e 's/\(.*\)version\(.*\)/\2/g'`
68+
else
69+
echo VERSION file is missing for ${ADDITIONAL_LIB_NAME} in "others/scripts/" directory
70+
exit 1
71+
fi
72+
73+
# Description
74+
if [ -f scripts/${ADDITIONAL_LIB_NAME}/Description ]; then
75+
description=`cat "scripts/${ADDITIONAL_LIB_NAME}/Description"`
76+
else
77+
echo Description file is missing for ${ADDITIONAL_LIB_NAME} in "others/scripts/" directory
78+
exit 1
79+
fi
80+
81+
# requirements.sh
82+
if [ -f scripts/${ADDITIONAL_LIB_NAME}/requirements.sh ]; then
83+
./scripts/${ADDITIONAL_LIB_NAME}/requirements.sh
84+
else
85+
echo Requirement script is missing for ${ADDITIONAL_LIB_NAME} "others/scripts/" directory
86+
exit 1
87+
fi
88+
89+
architecture=`arch`
90+
PKG_ROOT=`pwd`
91+
archive=${PKG_ROOT}/archive/DEBIAN
92+
pkg_name="fledge-${ADDITIONAL_LIB_NAME}"
93+
arch_name=$(dpkg --print-architecture)
94+
package_name="${pkg_name}-${version}-${architecture}"
95+
96+
if [ ! -d "${archive}/${architecture}" ]; then
97+
mkdir -p "${archive}/${architecture}"
98+
fi
99+
100+
# Print the summary of findings
101+
echo "Additional ${ADDITIONAL_LIB_NAME} Package version is : ${version}"
102+
echo "The Fledge required version is : ${fledge_version}"
103+
echo "The architecture is set as : ${architecture}"
104+
echo "The package will be built in : ${archive}/${architecture}"
105+
echo "The package name is : ${package_name}"
106+
echo
107+
108+
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
112+
cd "${archive}/${architecture}/${package_name}"
113+
mkdir -p DEBIAN
114+
cp -R ${PKG_ROOT}/packages/DEBIAN/* DEBIAN
115+
sed -i "s/__VERSION__/${version}/g" DEBIAN/control
116+
sed -i "s/__NAME__/${pkg_name}/g" DEBIAN/control
117+
sed -i "s/__ARCH__/${arch_name}/g" DEBIAN/control
118+
sed -i "s/__REQUIRES__/fledge (${fledge_version})/g" DEBIAN/control
119+
sed -i "s/__DESCRIPTION__/${description}/g" DEBIAN/control
120+
121+
# Debian file structure
122+
mkdir -p usr/local/lib
123+
if [ "${ADDITIONAL_LIB_NAME}" == "mqtt" ]; then
124+
cp -R --preserve=links /usr/local/lib/libpaho* usr/local/lib
125+
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
130+
echo "Done."
131+
132+
# Build the package
133+
cd "${archive}/${architecture}"
134+
echo "Building the ${package_name} package..."
135+
dpkg-deb --build ${package_name}
136+
echo "Building Complete."

others/make_rpm

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#!/bin/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+
## Author: Ashish Jabble
20+
##
21+
22+
set -e
23+
24+
USAGE="$(basename "$0") [-h] [-a] ...
25+
This script is used to create the RPM package for to support other additional libraries as separately such as mqtt
26+
27+
Arguments:
28+
-h - Display this help text
29+
-a - Remove all the archive versions"
30+
31+
while getopts ":ha" opt; do
32+
case "$opt" in
33+
a)
34+
if [ -d "./archive" ]; then
35+
echo -n "Cleaning the package archive folder..."
36+
rm -rf ./archive/*
37+
echo "Done."
38+
else
39+
echo "No archive folder, skipping cleanall"
40+
fi
41+
exit 0
42+
;;
43+
h)
44+
echo "${USAGE}"
45+
exit 0
46+
;;
47+
\?)
48+
echo "Invalid option -$OPTARG"
49+
exit 1
50+
;;
51+
:)
52+
echo "-$OPTARG requires an argument"
53+
exit 1
54+
esac
55+
done
56+
shift $((OPTIND -1))
57+
58+
ADDITIONAL_LIB_NAME=$1
59+
if [ "${ADDITIONAL_LIB_NAME}" = "" ]; then
60+
echo "You must specify additional library name to package. For example: mqtt"
61+
exit 1
62+
fi
63+
64+
# VERSION
65+
if [ -f scripts/${ADDITIONAL_LIB_NAME}/VERSION ]; then
66+
VERSION=`cat scripts/${ADDITIONAL_LIB_NAME}/VERSION | tr -d ' ' | grep "fledge_${ADDITIONAL_LIB_NAME}_version" | head -1 | sed -e 's/\(.*\)=\(.*\)/\2/g'`
67+
FLEDGE_VERSION=`cat scripts/${ADDITIONAL_LIB_NAME}/VERSION | tr -d ' ' | grep 'fledge_version' | head -1 | sed -e 's/\(.*\)version\([>=|>|<|<=|=]*\)\(.*\)/\2 \3/g'`
68+
else
69+
echo VERSION file is missing for ${ADDITIONAL_LIB_NAME} in "others/scripts/" directory
70+
exit 1
71+
fi
72+
73+
# Description
74+
if [ -f scripts/${ADDITIONAL_LIB_NAME}/Description ]; then
75+
DESCRIPTION=`cat "scripts/${ADDITIONAL_LIB_NAME}/Description"`
76+
else
77+
echo Description file is missing for ${ADDITIONAL_LIB_NAME} in "others/scripts/" directory
78+
exit 1
79+
fi
80+
81+
# requirements.sh
82+
if [ -f scripts/${ADDITIONAL_LIB_NAME}/requirements.sh ]; then
83+
./scripts/${ADDITIONAL_LIB_NAME}/requirements.sh
84+
else
85+
echo Requirement script is missing for ${ADDITIONAL_LIB_NAME} "others/scripts/" directory
86+
exit 1
87+
fi
88+
89+
GIT_ROOT=`pwd`
90+
ARCHIVE_PATH=${GIT_ROOT}/archive/RPM
91+
PKG_NAME="fledge-${ADDITIONAL_LIB_NAME}"
92+
ARCHITECTURE=`arch`
93+
PACKAGE_NAME="${PKG_NAME}-${VERSION}"
94+
BUILD_ROOT="${GIT_ROOT}/packages/build"
95+
96+
if [ ! -d "${ARCHIVE_PATH}/${ARCHITECTURE}" ]; then
97+
mkdir -p "${ARCHIVE_PATH}/${ARCHITECTURE}"
98+
fi
99+
100+
# Print the summary of findings
101+
echo "Additional ${ADDITIONAL_LIB_NAME} Package version is : ${VERSION}"
102+
echo "The Fledge required version is : ${FLEDGE_VERSION}"
103+
echo "The architecture is set as : ${ARCHITECTURE}"
104+
echo "The package root directory is : ${GIT_ROOT}"
105+
echo "The package will be built in : ${BUILD_ROOT}"
106+
echo "The package name is : ${PACKAGE_NAME}"
107+
echo
108+
109+
# First, create the BUILD_ROOT folder, if necessary
110+
if [ ! -L "${BUILD_ROOT}" -a ! -d "${BUILD_ROOT}" ]; then
111+
mkdir -p ${BUILD_ROOT}
112+
fi
113+
114+
# Check old copy of PACKAGE_NAME; if exists then remove
115+
if [ -d "${BUILD_ROOT}/${PACKAGE_NAME}" ]; then
116+
rm -rf ${BUILD_ROOT}/${PACKAGE_NAME}*
117+
fi
118+
119+
# Populate the package directory with RPM files
120+
echo -n "Populating the package and updating version file..."
121+
cd ${BUILD_ROOT}
122+
mkdir -p ${PACKAGE_NAME}
123+
cd ${PACKAGE_NAME}
124+
cp -R ${GIT_ROOT}/packages/RPM/* SPECS
125+
sed -i "s/__NAME__/${PKG_NAME}/g" SPECS/others.spec
126+
sed -i "s/__VERSION__/${VERSION}/g" SPECS/others.spec
127+
sed -i "s/__ARCH__/${ARCHITECTURE}/g" SPECS/others.spec
128+
sed -i "s/__REQUIRES__/fledge ${FLEDGE_VERSION}/g" SPECS/others.spec
129+
sed -i "s/__DESCRIPTION__/${DESCRIPTION}/g" SPECS/others.spec
130+
echo "Done."
131+
132+
# RPM file structure
133+
echo "Copying artifacts..."
134+
mkdir -p BUILDROOT
135+
cd BUILDROOT
136+
mkdir -p ${PACKAGE_NAME}-1.${ARCHITECTURE}
137+
cd ${PACKAGE_NAME}-1.${ARCHITECTURE}
138+
mkdir -p usr/local/lib64
139+
if [ "${ADDITIONAL_LIB_NAME}" == "mqtt" ]; then
140+
cp -R --preserve=links /usr/local/lib64/libpaho* usr/local/lib64
141+
fi
142+
# TODO: FOGL-3632 - Blocked with its compilation
143+
#if [ "${ADDITIONAL_LIB_NAME}" == "gcp" ]; then
144+
# cp -R --preserve=links /usr/local/lib64/libjwt* usr/local/lib64
145+
# cp -R --preserve=links /usr/local/lib64/libjansson* usr/local/lib64
146+
#fi
147+
echo "Done."
148+
find -L . -type f -exec echo '/'{} \; >> ../../SPECS/others.spec
149+
echo "Building the RPM package..."
150+
cd ${BUILD_ROOT}
151+
rpmbuild --define "_topdir ${BUILD_ROOT}/${PACKAGE_NAME}" --noclean -bb ${BUILD_ROOT}/${PACKAGE_NAME}/SPECS/others.spec
152+
echo "Building Complete."
153+
echo "Artifacts copied to "${ARCHIVE_PATH}/${ARCHITECTURE}
154+
PKG_NAME_WITH_EXT="${PACKAGE_NAME}-1.${ARCHITECTURE}.rpm"
155+
cp ${BUILD_ROOT}/${PACKAGE_NAME}/RPMS/${ARCHITECTURE}/${PKG_NAME_WITH_EXT} ${ARCHIVE_PATH}/${ARCHITECTURE}/${PKG_NAME_WITH_EXT}

others/packages/DEBIAN/control

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Package: __NAME__
2+
Version: __VERSION__
3+
Section: devel
4+
Priority: optional
5+
Architecture: __ARCH__
6+
Depends: __REQUIRES__
7+
Conflicts:
8+
Maintainer: Dianomic Systems, Inc. <[email protected]>
9+
Homepage: http://www.dianomic.com
10+
Description: __DESCRIPTION__

others/packages/DEBIAN/postinst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
##--------------------------------------------------------------------
4+
## Copyright (c) 2021 Dianomic Systems Inc.
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+
##
21+
## @postinst DEBIAN/postinst
22+
## This script is used to execute post installation tasks.
23+
##
24+
## Author: Ashish Jabble
25+
##
26+
##--------------------------------------------------------------------
27+
28+
set -e

0 commit comments

Comments
 (0)