forked from RackHD/on-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HWIMO-BUILD
executable file
·57 lines (43 loc) · 1.46 KB
/
HWIMO-BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Copyright 2015, 2016, EMC, Inc.
# debian packages expected...
# apt-get install git pbuilder dh-make ubuntu-dev-tools devscripts
# apt-get install nodejs nodejs-legacy npm
# Input (environment variables):
# * PKG_VERSION: The version of debian package,
# such as: 1.3.1 (official release);
#
set -e
set -x
rm -rf packagebuild
git clone . packagebuild
pushd packagebuild
cp ../package.json .
rsync -ar ../debianstatic/on-http/ debian
rm -rf node_modules
npm install --cache=`pwd`
npm run apidoc
npm run taskdoc
npm prune --production
git log -n 1 --pretty=format:%h.%ai.%s > commitstring.txt
export DEBEMAIL="hwimo robots <hwimo@hwimo.lab.emc.com>"
export DEBFULLNAME="The HWIMO Robots"
# If PKG_VERSION is not set as an environment variable
# compute it as below:
if [ -z "$PKG_VERSION" ];then
GIT_COMMIT_DATE=$(git show -s --pretty="format:%ci")
DATE_STRING=$(date -d "$GIT_COMMIT_DATE" -u +"%Y%m%dUTC")
GIT_COMMIT_HASH=$(git show -s --pretty="format:%h")
CHANGELOG_VERSION=$(dpkg-parsechangelog --show-field Version)
PKG_VERSION="$CHANGELOG_VERSION-$DATE_STRING-$GIT_COMMIT_HASH"
fi
if [[ $PKG_VERSION =~ ^([0-9]+\.){2}[0-9]+$ ]];then
# If version looks like 1.2.3, the build is official build.
# So update the distribution of changelog from "UNRELEASED" to "unstable"
dch -r ""
else
COMMIT_STR=`git log -n 1 --oneline`
dch -v $PKG_VERSION -u low $COMMIT_STR -b
fi
debuild --no-lintian --no-tgz-check -us -uc
popd