Skip to content

Commit

Permalink
modify version number of deb build in travis
Browse files Browse the repository at this point in the history
  • Loading branch information
changev committed Jan 12, 2017
1 parent 03cb298 commit ad90cd2
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .bintray-deb.json.in 100755 → 100644
@@ -1,6 +1,6 @@
{
"package": {
"name": "on-image",
"name": "on-imagebuilder",
"repo": "debian",
"subject": "rackhd",
"vcs_url": "https://github.com/RackHD/on-imagebuilder.git",
Expand Down
5 changes: 2 additions & 3 deletions debian/changelog
@@ -1,6 +1,5 @@
on-imagebuilder (1.1-1) UNRELEASED; urgency=low
on-imagebuilder (0.9.0) UNRELEASED; urgency=low

[ Alan Wei ]
* Initial release

-- Alan Wei <alan.wei@emc.com> Fri, 14 Oct 2016 03:52:50 +0000
-- rackhd <rackhd@emc.com> Fri, 14 Oct 2016 03:52:50 +0000
49 changes: 0 additions & 49 deletions extra/gen-debbranch.sh

This file was deleted.

24 changes: 24 additions & 0 deletions extra/gen-debversion.sh
@@ -0,0 +1,24 @@
#!/bin/bash
set -ex

#
# This script will generate var DEBRANCH
# DEBRANCH format is ${SYMBOL}-${DATESTRING}
#

DEBDIR="./debian"
if [ ! -d "${DEBDIR}" ]; then
echo "Debian directory ${DEBDIR} doesn't exist"
exit 1
fi

# Version in changelog will be assigned when branch created
# The version in pushed tag will be exactly the same with that in changelog
VERSION=$(dpkg-parsechangelog | grep ^Version | cut -d' ' -f2 | cut -d' ' -f1)
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")
if [ -z "$DEBVERSION" ]; then
DEBVERSION=${VERSION}-${DATE_STRING}-${GIT_COMMIT_HASH}
fi
echo $DEBVERSION
11 changes: 3 additions & 8 deletions extra/make-cfg.sh
Expand Up @@ -8,12 +8,7 @@ cd $SCRIPT_DIR/..

#Modify bintray cfg
#Use different COMPONENT to differ the apt source of release and ci-builds
DEBBRANCH=$(./extra/gen-debbranch.sh)
if [[ $DEBBRANCH =~ ^[0-9.]+$ ]]; then
COMPONENT=release
else
COMPONENT=main
fi
sed -e "s/#REVERSION#/${DEBBRANCH}/g" \
-e "s/#COMPONENT#/${COMPONENT}/g" \
VERSION=$(./extra/gen-debversion.sh)

sed -e "s/#REVERSION#/${VERSION}/g" \
.bintray-deb.json.in > .bintray-deb.json
18 changes: 5 additions & 13 deletions extra/make-deb.sh
Expand Up @@ -17,30 +17,22 @@ if [ -z "$DEBEMAIL" ]; then
export DEBEMAIL=`git log -n 1 --pretty=format:%ae`
fi

if [ -z "$DEBBRANCH" ]; then
export DEBBRANCH=$(./extra/gen-debbranch.sh)
if [ -z "$DEBVERSION" ]; then
export DEBVERSION=$(./extra/gen-debversion.sh)
fi

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

if [ -z "$DCHOPTS" ]; then
if [[ $DEBBRANCH =~ ^[0-9.]+$ ]]; then
#Use "dch -r" do release, "UNRELEASED" in changelog will be set to "unstable"
#or any other predefined distribution, the timestamp will be updated too.
export DCHOPTS="-r \"\""
else
#Use "dch -v -u -b" do ci-builds
export DCHOPTS="-v ${DEBBRANCH} -u low ${DEBPKGVER} -b"
fi

export DCHOPTS="-v ${DEBVERSION} -u low ${DEBPKGVER} -b -m"
fi

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

Expand All @@ -64,4 +56,4 @@ if [ ! -d deb ]; then
mkdir deb
fi

cp -a *.deb deb/
cp -a *.deb deb/

0 comments on commit ad90cd2

Please sign in to comment.