Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions HWIMO-BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# 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

Expand All @@ -23,18 +28,30 @@ npm prune --production

git log -n 1 --pretty=format:%h.%ai.%s > commitstring.txt

GITCOMMITDATE=$(git show -s --pretty="format:%ci")
DATESTRING=$(date -d "$GITCOMMITDATE" -u +"%Y-%m-%d-%H%M%SZ")
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")

PKG_VERSION="$DATESTRING"
if [ -n "$BUILD_NUMBER" ]
then
PKG_VERSION="${PKG_VERSION}-${BUILD_NUMBER}"
CHANGELOG_VERSION=$(dpkg-parsechangelog --show-field Version)

PKG_VERSION="$CHANGELOG_VERSION-$DATE_STRING-$GIT_COMMIT_HASH"
fi

export DEBEMAIL="hwimo robots <hwimo@hwimo.lab.emc.com>"
export DEBFULLNAME="The HWIMO Robots"
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

dch -v ${PKG_VERSION} autobuild
debuild --no-lintian --no-tgz-check -us -uc
popd