diff options
author | chriseth <c@ethdev.com> | 2017-01-04 20:21:41 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-01-04 20:21:41 +0800 |
commit | e45510d02ff0c543038802359d4920b3e500d517 (patch) | |
tree | be7839822883bf8116b1deb8c4716a06a4e4efde /scripts/create_source_tarball.sh | |
parent | 43d3f048e6df045697a3a77989c3e8a7f91603e9 (diff) | |
download | dexon-solidity-e45510d02ff0c543038802359d4920b3e500d517.tar.gz dexon-solidity-e45510d02ff0c543038802359d4920b3e500d517.tar.zst dexon-solidity-e45510d02ff0c543038802359d4920b3e500d517.zip |
Create source tarballs for releases.
Diffstat (limited to 'scripts/create_source_tarball.sh')
-rwxr-xr-x | scripts/create_source_tarball.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/create_source_tarball.sh b/scripts/create_source_tarball.sh new file mode 100755 index 00000000..350f6b4d --- /dev/null +++ b/scripts/create_source_tarball.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env sh +# + +set -e + +REPO_ROOT="$(dirname "$0")"/.. +( + cd "$REPO_ROOT" + version=`grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt` + commithash=`git rev-parse --short=8 HEAD` + committimestamp=`git show --format=%ci HEAD | head -n 1` + commitdate=`git show --format=%ci HEAD | head -n 1 | cut - -b1-10 | sed -e 's/-0?/./' | sed -e 's/-0?/./'` + + # file exists and has zero size -> not a prerelease + if [ -e prerelease.txt -a ! -s prerelease.txt ] + then + versionstring="$version" + else + versionstring="$version-develop-$commitdate-$commithash" + fi + + TEMPDIR=$(mktemp -d) + SOLDIR="$TEMPDIR/solidity_$versionstring/" + mkdir "$SOLDIR" + # Store the current source + git checkout-index -a --prefix="$SOLDIR" + git submodule foreach 'git checkout-index -a --prefix="'"$SOLDIR"'/$path/"' + # Store the commit hash + echo "$commithash" > "$SOLDIR/commit_hash.txt" + # Add dependencies + mkdir -p "$SOLDIR/deps/downloads/" 2>/dev/null || true + wget -O "$SOLDIR/deps/downloads/jsoncpp-1.7.7.tar.gz" https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz + tar czf "$REPO_ROOT/solidity_$versionstring.tar.gz" -C "$TEMPDIR" "solidity_$versionstring" + rm -r "$TEMPDIR" +) |