Skip to content

Commit 5f976b8

Browse files
committed
README added for service
1 parent 23440af commit 5f976b8

File tree

3 files changed

+141
-14
lines changed

3 files changed

+141
-14
lines changed

service/README.rst

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
*****************************
2+
Packaging for FogLAMP Service
3+
*****************************
4+
5+
This directory contains the deb and rpm scripts used to create a FogLAMP service package.
6+
7+
Internal Structure
8+
==================
9+
10+
The directory contains the following set of files:
11+
12+
- Files named with **make_** prefix, such as ``make_deb``, ``make_rpm``, are the shell scripts used to build the package.
13+
- The **packages** folder contains the list package types to build. It contains *DEBIAN* and *RPM*
14+
15+
- Inside the *packages/DEBIAN* folder, which contains all the Debian-based files, i.e. control, postinst, needed for the creation of the package.
16+
17+
- In the *archive/DEBIAN/architecture_name* folder which contains the build package.
18+
19+
- Inside the *packages/RPM/SPECS* folder, which contains RPM spec-based file, i.e. service.spec needed for the creation of the package.
20+
21+
- In the *archive/Rpm/architecture_name* folder which contains the build package.
22+
23+
24+
The make_deb Script
25+
===================
26+
27+
.. code-block:: console
28+
29+
$ ./make_deb -h
30+
make_deb [-h] [-a] [-b <branch>] repository ...
31+
This script is used to create the Debian package for a FogLAMP service
32+
33+
Arguments:
34+
-h - Display this help text
35+
-a - Remove all the versions
36+
-b - Branch to base package on
37+
$
38+
39+
40+
Building a Debian Package
41+
=========================
42+
43+
First, make sure that FogLAMP_ROOT is set.
44+
Finally, run the ``make_deb`` command:
45+
46+
.. code-block:: console
47+
48+
$ ./make_deb -b develop foglamp-service-notification
49+
Cloning into 'foglamp-service-notification'...
50+
Checking connectivity... done.
51+
The package root directory is : /tmp/foglamp-service-notification
52+
The package build directory is : /tmp/foglamp-service-notification/build
53+
The FogLAMP required version : >=1.6
54+
The architecture is set as : x86_64
55+
The package will be built in : /home/foglamp/Development/foglamp-pkg/service/archive/DEBIAN/x86_64
56+
The package name is : foglamp-service-notification-1.6.0-x86_64
57+
58+
Populating the package and updating version file...Done.
59+
Building the package...
60+
dpkg-deb: building package 'foglamp-service-notification' in 'foglamp-service-notification-1.6.0-x86_64.deb'.
61+
Building Complete.
62+
$
63+
64+
The result will be:
65+
66+
.. code-block:: console
67+
68+
$ ls -l archive/DEBIAN/x86_64/
69+
total 8
70+
drwxrwxr-x 4 foglamp foglamp 4096 foglamp-service-notification-1.6.0-x86_64
71+
-rw-r--r-- 1 foglamp foglamp 3338 foglamp-service-notification-1.6.0-x86_64-1.6.0.deb
72+
$
73+
74+
The make_rpm Script
75+
===================
76+
.. code-block:: console
77+
78+
$ ./make_rpm --help
79+
make_rpm [-a] [-c] [-h] [-b <branch>] repository ...
80+
This script is used to create the RPM package for a FogLAMP service
81+
Arguments:
82+
-h - Display this help text
83+
-c - Remove all the old versions saved in format .XXXX
84+
-a - Remove all the versions, including the last one
85+
-b - Branch to base package on
86+
$
87+
88+
Building a RPM Package
89+
======================
90+
91+
First, make sure that FogLAMP_ROOT is set.
92+
Finally, run the ``make_rpm`` command:
93+
94+
.. code-block:: console
95+
96+
$ ./make_rpm -b develop foglamp-service-notification
97+
Cloning into 'foglamp-service-notification'...
98+
Checking connectivity... done.
99+
The package root directory is : /tmp/foglamp-service-notification
100+
The package build directory is : /tmp/foglamp-service-notification/build
101+
The FogLAMP required version : >= 1.6
102+
The FogLAMP service notification version is : 1.6.0
103+
The architecture is set as : x86_64
104+
The package will be built in : /home/foglamp/Development/foglamp-pkg/service/archive/Rpm/
105+
The package name is : foglamp-service-notification-1.6.0
106+
107+
108+
Building the package...
109+
Processing files: foglamp-service-notification-1.6.0-1.x86_64
110+
Checking for unpackaged file(s): /usr/lib/rpm/check-files /tmp/foglamp-service-notification/build/foglamp-service-notification-1.6.0/BUILDROOT/foglamp-service-notification-1.6.0-1.x86_64
111+
Wrote: /tmp/foglamp-service-notification/build/foglamp-service-notification-1.6.0/RPMS/x86_64/foglamp-service-notification-1.6.0-1.x86_64.rpm
112+
Building Complete.
113+
$
114+
115+
The result will be:
116+
117+
.. code-block:: console
118+
119+
$ ls -l archive/Rpm/x86_64
120+
total 12 -rw-rw-r-- 1 foglamp foglamp 11805 foglamp-service-notification-1.6.0-1.x86_64.rpm
121+
$
122+
123+
Cleaning the Package Folder
124+
===========================
125+
126+
Use the ``-a`` option to remove all the packages and the files used to make the package.

service/make_rpm

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ do
113113
cd /tmp
114114
if [ -d "${REPO_NAME}" ]; then
115115
echo WARNING: Repository ${REPO_NAME} already exists, using the existing copy
116-
(cd ${REPO_NAME}; git pull; git checkout "$branch")
116+
(cd ${REPO_NAME}; git pull; git checkout "${BRANCH_NAME}")
117117
else
118-
git clone -b "$branch" https://github.com/foglamp/${REPO_NAME}.git
118+
git clone -b "${BRANCH_NAME}" https://github.com/foglamp/${REPO_NAME}.git
119119
fi
120120

121121
GIT_ROOT=/tmp/"${REPO_NAME}"
@@ -171,6 +171,18 @@ do
171171
mkdir -p "${BUILD_ROOT}"
172172
fi
173173

174+
(cd ${GIT_ROOT};
175+
if [ -f requirements.sh ]; then
176+
./requirements.sh
177+
fi
178+
179+
if [ -f build.sh ]; then
180+
rm -rf build;
181+
./build.sh
182+
else
183+
rm -rf build; mkdir ./build; cd ./build; cmake ..; make
184+
fi)
185+
174186
cd "${BUILD_ROOT}"
175187
if [ -d "${package_name}" ]; then
176188
rm -rf ${package_name}*
@@ -206,17 +218,6 @@ EOF
206218

207219
mkdir -p usr/local/foglamp
208220
cd usr/local/foglamp
209-
(cd ${GIT_ROOT};
210-
if [ -f requirements.sh ]; then
211-
./requirements.sh
212-
fi
213-
214-
if [ -f build.sh ]; then
215-
rm -rf build;
216-
./build.sh
217-
else
218-
rm -rf build; mkdir ./build; cd ./build; cmake ..; make
219-
fi)
220221
mkdir -p ${install_dir}
221222
cp -R --preserve=links ${GIT_ROOT}/build/C/${install_dir}/notification/foglamp* "${install_dir}/"
222223
echo "Done."

service/packages/RPM/SPECS/service.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Version: __VERSION__
66
Release: 1
77
BuildArch: __ARCH__
88
Summary: FogLAMP, the open source platform for the Internet of Things
9-
License: 2019 Dianomic Systems Inc.
9+
License: Apache License, 2019 Dianomic Systems Inc.
1010
Group: IOT
1111
URL: http://www.dianomic.com
1212

0 commit comments

Comments
 (0)