| # -------------------------------------------------------- |
| # Creates a tempdir for release and checks out the code |
| # -------------------------------------------------------- |
| GERRIT_USER=${GERRIT_USER:-$USER} |
| export ONOS_VERSION=${1:-$ONOS_VERSION} |
| if [ -z "$ONOS_VERSION" ]; then |
| echo "USAGE: onos-prepare-release <version number>" |
| echo " Alternatively, ONOS_VERSION must be set" |
| DIR=$(mktemp -d /tmp/onos-release.XXXXX) && |
| echo "Created tempdir for release: $DIR" || |
| { echo "Failed to create temp file"; exit 1; } |
| git remote add origin ssh://$GERRIT_USER@gerrit.onosproject.org:29418/onos.git |
| # Check existance of version |
| git tag -l | grep -q "$ONOS_VERSION\$" && |
| { echo "ERROR: Version already exists"; exit -1; } |
| # Copy local buck configuration to new tree |
| cp $ONOS_ROOT/.buckconfig.local $DIR/ |
| # This is a hack to remove symlinks from the ONOS_ROOT path. To be removed when |
| # the protobuf buck rules can handle symlinks |
| ONOS_ROOT=$(pushd $ONOS_ROOT >/dev/null && pwd -P && popd >/dev/null) |
| . $ONOS_ROOT/tools/build/envDefaults |
| # TODO on exit, print "leaving directory" |