Skip to content
Snippets Groups Projects
Unverified Commit 32360831 authored by Sebastian Schmitt's avatar Sebastian Schmitt Committed by GitHub
Browse files

Shell script to create a dep-free tar ball (#1368)

parent 98c6e95a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
# creates a tar ball of Arbor for e.g. releases
#
# checks out repo at a specific branch/commit/tag
# strips version control,
# but leaves (empty) .git directories of submodules (CMake checks for it)
set -Eeuo pipefail
if [[ "$#" -ne 3 ]]; then
echo "usage: create_tarball.sh path_to_repo branch/commit/tag path_to_output_tarball"
exit 1
fi
trap cleanup SIGINT SIGTERM ERR EXIT
cleanup() {
trap - SIGINT SIGTERM ERR EXIT
rm -rf "$TMP_DIR"
}
TMP_DIR=$(mktemp -d)
REPO=$1
CHECKOUT=$2
OUT_TARBALL=$3
if [[ ! "$TMP_DIR" || ! -d "$TMP_DIR" ]]; then
echo "Could not create temporary directory"
exit 1
fi
REPO_NAME=arbor
cd "$TMP_DIR"
git clone "$REPO" $REPO_NAME
cd "$REPO_NAME"
git checkout "$CHECKOUT"
git submodule init
git submodule update
# remove all version control files but not the .git directories themselves
rm -vrf -- **/.git/*
# remove main .git, only submodule .gits are still present
rm -vrf .git
# create tar ball
cd ..
tar vcfz "$OUT_TARBALL" $REPO_NAME
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment