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