Brian O'Connor | d730b22 | 2016-03-01 18:32:38 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # -------------------------------------------------------- |
| 3 | # Creates a tempdir for release and checks out the code |
| 4 | # -------------------------------------------------------- |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | GERRIT_USER=${GERRIT_USER:-$USER} |
| 9 | BRANCH=${2:-master} |
| 10 | |
| 11 | export ONOS_VERSION=${1:-$ONOS_VERSION} |
| 12 | if [ -z "$ONOS_VERSION" ]; then |
| 13 | echo "USAGE: onos-prepare-release <version number>" |
| 14 | echo " Alternatively, ONOS_VERSION must be set" |
| 15 | exit -1 |
| 16 | fi |
| 17 | |
| 18 | DIR=$(mktemp -d /tmp/onos-release.XXXXX) && |
| 19 | echo "Created tempdir for release: $DIR" || |
| 20 | { echo "Failed to create temp file"; exit 1; } |
| 21 | |
| 22 | cd $DIR |
| 23 | git init |
| 24 | git remote add origin ssh://$GERRIT_USER@gerrit.onosproject.org:29418/onos.git |
| 25 | git fetch origin |
| 26 | git checkout $BRANCH |
| 27 | |
| 28 | # Check existance of version |
Brian O'Connor | a317872 | 2016-03-10 15:44:27 -0800 | [diff] [blame] | 29 | git tag -l | grep -q "$ONOS_VERSION\$" && |
| 30 | { echo "ERROR: Version already exists"; exit -1; } |
Brian O'Connor | d730b22 | 2016-03-01 18:32:38 -0800 | [diff] [blame] | 31 | |
| 32 | export ONOS_ROOT=$DIR |
Brian O'Connor | c5996b2 | 2016-03-01 18:55:05 -0800 | [diff] [blame] | 33 | . $ONOS_ROOT/tools/build/envDefaults |
Brian O'Connor | d730b22 | 2016-03-01 18:32:38 -0800 | [diff] [blame] | 34 | exec bash -i |
| 35 | |
Brian O'Connor | 3be8165 | 2016-03-02 13:55:11 -0800 | [diff] [blame] | 36 | # TODO on exit, print "leaving directory" |