diff options
author | Jon Medhurst <tixy@linaro.org> | 2012-05-04 14:39:28 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2012-05-23 09:07:42 +0100 |
commit | 2934a4eeb47b768fd30a4aa061c8d1deaa5499dd (patch) | |
tree | dc2dae19fe30abaed10408d3646d6e6fbfd2e31c /tools/gator/debian/scripts/do-packaging | |
parent | c1e8d232d14e7e751d5ba50796aa840e7f825865 (diff) |
gator: ubuntu: Add packaging
Files and scripts for creating Debian packages for
Gator and ARM DS-5 target.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'tools/gator/debian/scripts/do-packaging')
-rwxr-xr-x | tools/gator/debian/scripts/do-packaging | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tools/gator/debian/scripts/do-packaging b/tools/gator/debian/scripts/do-packaging new file mode 100755 index 00000000000..9562f2a685b --- /dev/null +++ b/tools/gator/debian/scripts/do-packaging @@ -0,0 +1,86 @@ +#!/bin/bash + +set -e + +while [ $1 ] +do + OPT=$1 + shift + if [ "$OPT" == "--commit" ] + then + OPT_COMMIT=y + continue + fi + if [ "$OPT" == "--sign" ] + then + OPT_SIGN=y + continue + fi + echo $0: Unknown option: "$OPT" 1>&2 + exit 1 +done + + +# +# Clean working dirctory +# + +git reset --hard HEAD +git clean -dfx .. + + +# +# Update changelog +# + +if [ "$DEBEMAIL" == "" -o "$DEBFULLNAME" == "" ] +then + export DEBEMAIL='jon.medhurst@linaro.org' + export DEBFULLNAME='Jon Medhurst (Tixy)' +fi +dch -i -c debian/changelog CHANGE_MSG + +TIMESTAMP="$(date -u +%Y%m%d%H%M%S)" +sed -i -e "1 s/ubuntu1/-$TIMESTAMP/" debian/changelog + +GIT_COMMIT="$(git rev-parse HEAD)" +GIT_REMOTE_AND_BRANCH="$(git show-ref | sed -n 's,'$GIT_COMMIT'.*refs/remotes/\(.*\),\1,p' | sed -n 1p)" +GIT_REMOTE=$(echo $GIT_REMOTE_AND_BRANCH | awk -F/ '{print $1}') +GIT_BRANCH=$(echo $GIT_REMOTE_AND_BRANCH | awk -F/ '{print $2}') +GIT_URL="$(git remote -v show $GIT_REMOTE | sed -n 's/.*Fetch URL: \(.*\)/\1/p')" +GIT_TAG="$(git describe --exact-match --tags $GIT_COMMIT 2>/dev/null || echo "")" + +CHANGE_MSG="Automatically packaged from git repository:\n" +CHANGE_MSG="$CHANGE_MSG URL: $GIT_URL\n" +CHANGE_MSG="$CHANGE_MSG Tag: $GIT_TAG\n" +CHANGE_MSG="$CHANGE_MSG Branch: $GIT_BRANCH\n" +CHANGE_MSG="$CHANGE_MSG Commit: $GIT_COMMIT" +sed -i -e "s%CHANGE_MSG%$CHANGE_MSG%" debian/changelog + +echo $CHANGE_MSG + +VERSION="$(sed -n '1s/.*(\(.*\)).*/\1/p' debian/changelog)" + + +# +# Commit changes +# + +if [ $OPT_COMMIT ] +then + git add debian/changelog + git commit -s -m "gator-$VERSION: Automated packaging" +fi + + +# +# Build packages +# + +if [ ! $OPT_SIGN ] +then + DEBUILD_SIGN="-us -uc" +fi + +debuild $DEBUILD_SIGN -aarmhf -b +debuild --no-tgz-check $DEBUILD_SIGN -S |