~nskaggs/juju-release-tools/generate-release-notes

335.1.1 by Nicholas Skaggs
Add make-pr-tarball script for use with new github <-> jenkins PR building workflow
1
#!/bin/bash
2
3
# Assemble a source tree using git to checkout the revision,
4
# then go to get the package deps, then godeps to pin the versions/
5
# Lastly create a release tarball from the tree.
6
set -e
7
8
unset GOPATH
9
unset GOBIN
10
11
DEFAULT_GIT_JUJU_CORE="https://github.com/juju/juju.git"
12
PACKAGE="github.com/juju/juju"
13
14
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd )
15
16
usage() {
17
    echo "usage: $0 <GIT_PR> [GIT_REPO]"
18
    echo "  GIT_PR: The juju core PR number to build"
19
    echo "  GIT_REPO: The juju core git repo; defaults to $DEFAULT_GIT_JUJU_CORE"
20
    exit 1
21
}
22
335.1.3 by Nicholas Skaggs
Add breakouts and common script points; add echos to original script
23
# check build dependencies
335.1.4 by Nicholas Skaggs
use source instead of .
24
source "$SCRIPT_DIR/check-source-depends.bash"
335.1.1 by Nicholas Skaggs
Add make-pr-tarball script for use with new github <-> jenkins PR building workflow
25
26
GIT_PR=$1
27
JUJU_CORE_REPO=${2:-$DEFAULT_GIT_JUJU_CORE}
28
29
HERE=$(pwd)
30
TMP_DIR=$(mktemp -d --tmpdir=$HERE)
31
mkdir $TMP_DIR/RELEASE
32
WORK=$TMP_DIR/RELEASE
33
WORKPACKAGE=$WORK/src/$PACKAGE
34
35
echo "Getting juju core from $JUJU_CORE_REPO."
36
mkdir -p $WORKPACKAGE
37
git clone $JUJU_CORE_REPO $WORKPACKAGE
38
cd $WORKPACKAGE
39
echo "Checking out PR revision."
40
git fetch --tags $JUJU_CORE_REPO +refs/pull/$GIT_PR/merge:refs/remotes/origin-pull/pull/$GIT_PR/merge
41
MERGE_COMMIT=$(git rev-parse refs/remotes/origin-pull/pull/$GIT_PR/merge^{commit})
42
git checkout -f $MERGE_COMMIT
43
335.1.3 by Nicholas Skaggs
Add breakouts and common script points; add echos to original script
44
# Build juju in directory
338 by Nicholas Skaggs
Fix missing .bash
45
source "$SCRIPT_DIR/build-juju-source.bash"
335.1.1 by Nicholas Skaggs
Add make-pr-tarball script for use with new github <-> jenkins PR building workflow
46
47
# Tar it up.
48
echo "Creating build tarball"
49
cd $TMP_DIR
335.1.2 by Nicholas Skaggs
Fix path
50
TARFILE=$HERE/juju-core_${VERSION}.tar.gz
335.1.1 by Nicholas Skaggs
Add make-pr-tarball script for use with new github <-> jenkins PR building workflow
51
tar cfz $TARFILE --exclude .hg --exclude .git --exclude .bzr juju-core_${VERSION}
52
53
echo "Successfully created tarball: $TARFILE"