diff options
| author | Paul Bourke <paul.bourke@oracle.com> | 2015-07-02 11:53:01 +0000 |
|---|---|---|
| committer | Paul Bourke <paul.bourke@oracle.com> | 2015-07-03 17:20:57 +0000 |
| commit | 7b4eedb563f7a70230a8032c16d72161db8d71aa (patch) | |
| tree | 4632f48e8b7fbc608af6ee1bf264939e0cf5b177 | |
| parent | 5dafe4e77959f96094842082d9bd69e626c3560a (diff) | |
| download | kolla-7b4eedb563f7a70230a8032c16d72161db8d71aa.tar.gz kolla-7b4eedb563f7a70230a8032c16d72161db8d71aa.zip | |
Add new script to fetch tarballs for source installation
This script will be sourced from the build scripts to provide alternate
ways to fetch/generate a source tarball. This tarball can then be
provided to a Dockerfile for source installation.
Change-Id: I0212a83d098b8d83446f69b92c2b07ef39a93c10
Partially-Implements: blueprint install-from-source
| -rw-r--r-- | tools/gen-source-tar.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/gen-source-tar.sh b/tools/gen-source-tar.sh new file mode 100644 index 000000000..66c04caf0 --- /dev/null +++ b/tools/gen-source-tar.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +set -e + +: ${SOURCE_INSTALL_METHOD:=git} +: ${GIT_REF:=master} +: ${LOCAL_SOURCE:=/tmp/${COMPONENT}} + +function fetch_source_from_uri { + curl ${TARBALL_URI} -o ${TMPDIR}/${COMPONENT}.tar +} + +function fetch_source_from_git { + # NOTE(pbourke): do a shallow clone to master only, unless a specific ref is + # required + if [ -z ${GIT_REF} ]; then + git clone --depth=1 ${CLONE_FROM} ${TMPDIR}/${COMPONENT} + else + git clone ${CLONE_FROM} ${TMPDIR}/${COMPONENT} + git --git-dir ${TMPDIR}/${COMPONENT}/.git checkout ${GIT_REF} + fi + tar -cf ${TMPDIR}/${COMPONENT}.tar -C ${TMPDIR} ${COMPONENT} +} + +function fetch_source_from_local { + tar -cf ${TMPDIR}/${COMPONENT}.tar \ + -C $(dirname ${LOCAL_SOURCE}) ${COMPONENT} +} + +case ${SOURCE_INSTALL_METHOD} in + curl) + fetch_source_from_uri + ;; + git) + fetch_source_from_git + ;; + local) + fetch_source_from_local + ;; + *) + cat << EOF +Unknown install method '${SOURCE_INSTALL_METHOD}'. Please check the value of +\$SOURCE_INSTALL_METHOD in .buildconf +EOF + exit 1 + ;; +esac |
