Skip to content

Commit

Permalink
Merge pull request #67 from HQebupt/deb-build
Browse files Browse the repository at this point in the history
[RAC-5774]add deb build in on-tftp's TravisCI .
  • Loading branch information
anhou authored Aug 15, 2017
2 parents c00a8db + aec08d1 commit 6971182
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions extra/make-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash
set -ex

# Ensure we're always in the right directory.
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $SCRIPT_DIR/..

# Use the TRAVIS_BRANCH var if defined as travis vm
# doesn't run the git symbolic-ref command.
if [ -z "$TRAVIS_BRANCH" ]; then
BRANCH=$(git symbolic-ref --short -q HEAD)
else
BRANCH=${TRAVIS_BRANCH}
fi

# this appends a datestring formatting specifically to be increasing
# based on the last date of the commit in this branch to provide increasing
# DCH version numbers for building debian packages for bintray.
GITCOMMITDATE=$(git show -s --pretty="format:%ci")
DATESTRING=$(date -d "$GITCOMMITDATE" -u +"%Y%m%d%H%M%SZ")

if [ -z "$DEBFULLNAME" ]; then
export DEBFULLNAME=`git log -n 1 --pretty=format:%an`
fi

if [ -z "$DEBEMAIL" ]; then
export DEBEMAIL=`git log -n 1 --pretty=format:%ae`
fi

if [ -z "$DEBBRANCH" ]; then
export DEBBRANCH=`echo "${BRANCH}-${DATESTRING}" | sed 's/[\/\_]/-/g'`
fi

if [ -z "$DEBPKGVER" ]; then
export DEBPKGVER=`git log -n 1 --pretty=oneline --abbrev-commit`
fi

if [ -z "$DCHOPTS" ]; then
export DCHOPTS="-l ${DEBBRANCH} -u low ${DEBPKGVER}"
fi

echo "DEBDIR: $DEBDIR"
echo "DEBFULLNAME: $DEBFULLNAME"
echo "DEBEMAIL: $DEBEMAIL"
echo "DEBBRANCH: $DEBBRANCH"
echo "DEBPKGVER: $DEBPKGVER"
echo "DCHOPTS: $DCHOPTS"


if [ -d packagebuild ]; then
rm -rf packagebuild
fi
mkdir packagebuild
rsync -ar --exclude=packagebuild . packagebuild
pushd packagebuild
rm -rf node_modules
npm install --production
git log -n 1 --pretty=format:%h.%ai.%s > commitstring.txt
dch ${DCHOPTS}
debuild --no-lintian --no-tgz-check -us -uc
popd
if [ ! -d deb ]; then
mkdir deb
fi

cp -a *.deb deb/

0 comments on commit 6971182

Please sign in to comment.