github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/scripts/build-release-tarball/build-release-tarball.bash (about)

     1  #!/usr/bin/env bash -e
     2  
     3  # if someone invokes this with bash
     4  set -e
     5  
     6  unset GOPATH
     7  
     8  # build release tarball from a bzr branch
     9  
    10  usage() {
    11  	echo usage: $0 TAG
    12  	exit 2
    13  }
    14  
    15  test $# -eq 1 ||  usage
    16  TAG=$1
    17  TMP_DIR=$(mktemp -d)
    18  mkdir $TMP_DIR/RELEASE
    19  WORK=$TMP_DIR/RELEASE
    20  
    21  echo "Getting juju-core and all its dependencies."
    22  GOPATH=$WORK go get -v -d github.com/juju/juju/...
    23  
    24  echo "Setting juju-core tree to $TAG."
    25  (cd "${WORK}/src/github.com/juju/juju/" && bzr revert -r $TAG)
    26  
    27  echo "Updating juju-core dependencies to the required versions."
    28  GOPATH=$WORK godeps -u "${WORK}/src/github.com/juju/juju/dependencies.tsv"
    29  
    30  # Smoke test
    31  GOPATH=$WORK go build -v github.com/juju/juju/...
    32  
    33  # Change the generic release to the proper juju-core version.
    34  VERSION=$(sed -n 's/^const version = "\(.*\)"/\1/p' \
    35      $WORK/src/github.com/juju/version/version.go)
    36  mv $WORK $TMP_DIR/juju-core_${VERSION}/
    37  
    38  # Tar it up.
    39  TARFILE=`pwd`/juju-core_${VERSION}.tar.gz
    40  cd $TMP_DIR
    41  tar cfz $TARFILE --exclude .hg --exclude .git --exclude .bzr juju-core_${VERSION}
    42  
    43  echo "release tarball: ${TARFILE}"