diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-07-04 20:11:00 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-07-04 20:11:00 +0000 |
| commit | 1054ccbb8cec3e53d4cb5228905b779a3086d403 (patch) | |
| tree | 868da23b995af256ad747520172a09216c632ce9 /tools | |
| parent | feb582632299bc7dd70846f1db5ecdf4645bf524 (diff) | |
| parent | 7b4eedb563f7a70230a8032c16d72161db8d71aa (diff) | |
| download | kolla-1054ccbb8cec3e53d4cb5228905b779a3086d403.tar.gz kolla-1054ccbb8cec3e53d4cb5228905b779a3086d403.zip | |
Merge "Add new script to fetch tarballs for source installation"
Diffstat (limited to 'tools')
| -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 |
