diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-01-04 02:17:36 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-01-04 02:25:39 +0100 |
commit | e2250001be27c40d0153735a48a7062bf636a927 (patch) | |
tree | da769ecf043881977a1434aec475081e9cc3bd96 /create_all_tarballs | |
parent | b0a915240f92352cf9675146940d045f76ee7746 (diff) | |
download | scripts-e2250001be27c40d0153735a48a7062bf636a927.tar.gz scripts-e2250001be27c40d0153735a48a7062bf636a927.zip |
Added scripts for creating tarballs
(cherry picked from commit b430a3e49e7337ee8ad27dab865893c0cc5f406c)
Diffstat (limited to 'create_all_tarballs')
-rwxr-xr-x | create_all_tarballs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/create_all_tarballs b/create_all_tarballs new file mode 100755 index 0000000..825d784 --- /dev/null +++ b/create_all_tarballs @@ -0,0 +1,65 @@ +#!/bin/bash + +# Set the current target version +export TARGET=${TARGET:-"3.5.13.2"} + +# When $SUFFIX = true then the package tarball name will be $package-trinity. +# When $SUFFIX != true then the package tarball name will be trinity-$package. +# Choose the option that satisfies any distro package name rules. +export SUFFIX=${SUFFIX:-"true"} + +# Setting base path for tarballs. Tarballs for indivitual modules +# will be created into folders in same structure, as is in 'tde'. +# The default is 'tde-tarballs' in parent directory. +TARBALLS_BASE=${TARBALLS_BASE:-"$(dirname $PWD)/tde-tarballs/$TARGET"} + +# List of modules to be omitted during creating tarballs. +SKIP_MODULES=" +common +defaultsettins +experimental +infrastructure +metapackages +scripts +tde-construct +thirdparty +" +skip_module() { + for skip in $SKIP_MODULES; do + [ "/${1/$skip//}/" != "/$1/" ] && return 0 + done + return 1 +} + +# Check git-dir +if [[ ! -e .git ]] || + [[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then + echo "This script can only be run from a top level git directory. Exiting..." + exit 1 +fi + +# Check remote branch +branch=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-` +if [[ -z "$branch" ]] || + [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then + echo "There is not active upstream branch. Exiting..." + exit 1 +fi + +# Create tarballs for submodules +if [[ -e .gitmodules ]]; then + create_tarball=$(dirname $(readlink -f "$0"))/create_tarball + sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <.gitmodules | \ + while read submodule; do + skip_module "$submodule" && continue + if [[ ! -e "$submodule/.git" ]]; then + git submodule init -- "$submodule" + git submodule update -- "$submodule" + fi + export TARBALL_DIR=$TARBALLS_BASE/$(dirname "$submodule") + if [[ ! -d "$TARBALL_DIR" ]]; then + mkdir -p "$TARBALL_DIR" + fi + (cd "$submodule" && "$create_tarball") + done +fi |