Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support release: build debian package with version like: 1.2.3-20111012UTC-b2f2da(nigthly release) or 1.2.3(official release) #185

Merged
merged 3 commits into from
Dec 5, 2016
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 @@ -18,18 +23,30 @@ rm -rf node_modules
npm install --production --cache=`pwd`
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 -m
fi

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