Skip to content

Commit

Permalink
Merge pull request #72 from fledge-iot/2.1.0RC
Browse files Browse the repository at this point in the history
2.1.0RC
  • Loading branch information
Mohit04tomar authored Jan 4, 2023
2 parents 82f7be9 + c0589e0 commit 5f0b879
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 34 deletions.
44 changes: 25 additions & 19 deletions make_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@

set -e

PKG_ROOT=`pwd` # The script must be executed from the root git directory
PKG_ROOT=$(pwd) # The script must be executed from the root git directory
repo_name="fledge" # Name of the Git repository
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-postgresql13" # Name of the Red Hat package for postgres
rhgcc_pkg="devtoolset-7" # Name of the Red Hat package for the newer g++
skip_build=0 # 1=skip Git repo extraction and Fledge build

# Check OS Name and OS Version
os_name=$(grep -o '^NAME=.*' /etc/os-release | cut -f2 -d\" | sed 's/"//g')
os_version=$(grep -o '^VERSION_ID=.*' /etc/os-release | cut -f2 -d\" | sed 's/"//g')

usage="$(basename "$0") [-h] [-c] [-a] [-s] [-b <branch>]
This script is used to create the RPM package of Fledge
Expand Down Expand Up @@ -121,27 +123,31 @@ if [[ $skip_build == 0 ]]; then

cd ${FLEDGE_ROOT}
sudo ./requirements.sh
# Use Red Hat packages and scl_source for postgres and newer g++ only if OS is RedHat/CentOS 7
if [[ ( $os_name == *"Red Hat"* || $os_name == *"CentOS"* ) && $os_version == *"7"* ]]
then
rhpg_pkg="rh-postgresql13" # Name of the Red Hat package for postgres
rhgcc_pkg="devtoolset-7" # Name of the Red Hat package for the newer g++

# Enables/verifies the environment for the build
source scl_source enable ${rhpg_pkg}
status_rh_postgresql=$?
if [[ $status_rh_postgresql != 0 ]]; then
echo "ERROR : it is not possible to enable the ${rhpg_pkg} environment"
exit 1
fi

# Enables/verifies the environment for the build
source scl_source enable ${rhpg_pkg}
status_rh_postgresql=$?

source scl_source enable ${rhgcc_pkg}
status_devtoolset=$?
source scl_source enable ${rhgcc_pkg}
status_devtoolset=$?
if [[ $status_devtoolset != 0 ]]; then
echo "ERROR : it is not possible to enable the ${rhgcc_pkg} environment"
exit 1
fi
fi

command -v pg_isready > /dev/null
status_pg_isready=$?

if [[ $status_rh_postgresql != 0 ]]; then
echo "ERROR : it is not possible to enable the ${rhpg_pkg} environment"
exit 1
fi

if [[ $status_devtoolset != 0 ]]; then
echo "ERROR : it is not possible to enable the ${rhgcc_pkg} environment"
exit 1
fi

if [[ $status_pg_isready != 0 ]]; then
echo "ERROR : the command pg_isready is not available"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions others/scripts/gcp/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fledge_gcp_version=2.0.1
fledge_version>=2.0
fledge_gcp_version=2.1.0
fledge_version>=2.1
4 changes: 2 additions & 2 deletions others/scripts/iec/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fledge_iec_version=2.0.1
fledge_version>=2.0
fledge_iec_version=2.1.0
fledge_version>=2.1
4 changes: 2 additions & 2 deletions others/scripts/mqtt/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fledge_mqtt_version=2.0.1
fledge_version>=2.0
fledge_mqtt_version=2.1.0
fledge_version>=2.1
4 changes: 2 additions & 2 deletions others/scripts/s2opcua/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fledge_s2opcua_version=2.0.1
fledge_version>=2.0
fledge_s2opcua_version=2.1.0
fledge_version>=2.1
32 changes: 26 additions & 6 deletions packages/RPM/SPECS/fledge.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ VCS: __VCS__
%define install_path /usr/local

Prefix: /usr/local
%if 0%{?centos} < 9 || 0%{?rhel} < 9
Requires: dbus-devel, glib2-devel, boost, openssl, rh-python36, yum-utils, gcc, autoconf, curl, libtool, rsyslog, wget, zlib, libuuid, avahi, sudo, krb5-workstation, curl-devel
%else
Requires: dbus-devel, glib2-devel, boost, openssl, python3, yum-utils, gcc, autoconf, curl, libtool, rsyslog, wget, zlib, libuuid, avahi, sudo, krb5-workstation, curl-devel
%endif
AutoReqProv: no

%description
Expand Down Expand Up @@ -211,6 +215,7 @@ fi
set -e

PKG_NAME="fledge"
OS_VERSION=$(cat /etc/os-release | grep 'VERSION_ID=' | cut -f2 -d= | sed 's/"//g')

get_fledge_script () {
fledge_script=$(rpm -ql ${PKG_NAME} | grep 'fledge/bin/fledge$')
Expand Down Expand Up @@ -324,7 +329,12 @@ copy_fledge_sudoer_file() {
}

copy_service_file() {
cp /usr/local/fledge/extras/scripts/fledge.service /etc/init.d/fledge
if [[ ${OS_VERSION} == *"7"* ]]
then
cp /usr/local/fledge/extras/scripts/fledge.service /etc/init.d/fledge
else
cp /usr/local/fledge/extras/scripts/fledge.service /etc/rc.d/init.d/fledge
fi
}

enable_fledge_service() {
Expand Down Expand Up @@ -400,14 +410,24 @@ install_pip3_packages () {
then
echo "# " >> /home/${SUDO_USER}/.bashrc
echo "# ${foglam_test}" >> /home/${SUDO_USER}/.bashrc
echo "source scl_source enable rh-python36" >> /home/${SUDO_USER}/.bashrc
if [[ ${OS_VERSION} == *"7"* ]]
then
echo "source scl_source enable rh-python36" >> /home/${SUDO_USER}/.bashrc
fi
fi
if [[ ${OS_VERSION} == *"7"* ]]
then
source scl_source enable rh-python36
fi
source scl_source enable rh-python36

# TODO: we may need with --no-cache-dir
pip3 install -Ir /usr/local/fledge/python/requirements.txt

sudo bash -c 'source scl_source enable rh-python36; python3 -m pip install dbus-python numpy==1.19.5'
python3 -m pip install -Ir /usr/local/fledge/python/requirements.txt
if [[ ${OS_VERSION} == *"7"* ]]
then
sudo bash -c 'source scl_source enable rh-python36; python3 -m pip install dbus-python numpy==1.19.5'
else
sudo bash -c 'python3 -m pip install dbus-python numpy==1.19.5'
fi
set -e
}

Expand Down
2 changes: 2 additions & 0 deletions plugins/make_deb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ EOF
if [ -f requirements.sh ]; then
./requirements.sh
fi
# version replaced in VERSION file
echo ${version} > VERSION;
mkdir -p build; cd build; cmake ..; make)
mkdir -p "plugins/${plugin_type_install}/${plugin_install_dirname}"
if [ -f "${GIT_ROOT}/extras_install.sh" ]; then
Expand Down
2 changes: 2 additions & 0 deletions plugins/make_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ EOF
if [ -f requirements.sh ]; then
./requirements.sh
fi
# version replaced in VERSION file
echo ${version} > VERSION;
if [ -f build.sh ]; then
./build.sh
else
Expand Down
2 changes: 1 addition & 1 deletion plugins/packages/DEBIAN/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if [ -f /usr/local/fledge/python/extras_install___PLUGIN_NAME__.sh ]; then
fi
# Install Python pip dependencies; if any
if [ -f /usr/local/fledge/__INSTALL_DIR__/requirements.txt ]; then
pip3 install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt
python3 -m pip install -Ir /usr/local/fledge/__INSTALL_DIR__/requirements.txt
fi

# For C based plugins
Expand Down

0 comments on commit 5f0b879

Please sign in to comment.