aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-09-17 17:28:26 +0800
committerGitHub <noreply@github.com>2016-09-17 17:28:26 +0800
commit62f13ad8bf1f7f33bc90bb5c1e1b1e001032501d (patch)
treec221dc8bdfbd0dd5bcc615eeb2fc03d6e6b9d84e
parent6a80511ffb63a69589252e26be62d18d6281c8ae (diff)
parent3b6e131d852eab0c74260d9ca5c7a11501265da1 (diff)
downloaddexon-solidity-62f13ad8bf1f7f33bc90bb5c1e1b1e001032501d.tar.gz
dexon-solidity-62f13ad8bf1f7f33bc90bb5c1e1b1e001032501d.tar.zst
dexon-solidity-62f13ad8bf1f7f33bc90bb5c1e1b1e001032501d.zip
Merge pull request #1097 from ethereum/forceeight
Force commit hash to 8 digits.
-rw-r--r--cmake/scripts/buildinfo.cmake13
-rwxr-xr-xscripts/release_ppa.sh2
-rwxr-xr-xscripts/travis-emscripten/publish_binary.sh2
3 files changed, 10 insertions, 7 deletions
diff --git a/cmake/scripts/buildinfo.cmake b/cmake/scripts/buildinfo.cmake
index f0e39906..8e1615f6 100644
--- a/cmake/scripts/buildinfo.cmake
+++ b/cmake/scripts/buildinfo.cmake
@@ -34,7 +34,7 @@ if (EXISTS ${ETH_SOURCE_DIR}/commit_hash.txt)
string(STRIP ${SOL_COMMIT_HASH} SOL_COMMIT_HASH)
else()
execute_process(
- COMMAND git --git-dir=${ETH_SOURCE_DIR}/.git --work-tree=${ETH_SOURCE_DIR} rev-parse HEAD
+ COMMAND git --git-dir=${ETH_SOURCE_DIR}/.git --work-tree=${ETH_SOURCE_DIR} rev-parse --short=8 HEAD
OUTPUT_VARIABLE SOL_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
)
execute_process(
@@ -48,14 +48,17 @@ if (SOL_COMMIT_HASH)
string(SUBSTRING ${SOL_COMMIT_HASH} 0 8 SOL_COMMIT_HASH)
endif()
-if (SOL_COMMIT_HASH AND SOL_LOCAL_CHANGES)
- set(SOL_COMMIT_HASH "${SOL_COMMIT_HASH}.mod")
-endif()
-
if (NOT SOL_COMMIT_HASH)
message(FATAL_ERROR "Unable to determine commit hash. Either compile from within git repository or "
"supply a file called commit_hash.txt")
endif()
+if (NOT SOL_COMMIT_HASH MATCHES [a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])
+ message(FATAL_ERROR "Malformed commit hash \"${SOL_COMMIT_HASH}\". It has to consist of exactly 8 hex digits.")
+endif()
+
+if (SOL_COMMIT_HASH AND SOL_LOCAL_CHANGES)
+ set(SOL_COMMIT_HASH "${SOL_COMMIT_HASH}.mod")
+endif()
set(SOL_VERSION_BUILDINFO "commit.${SOL_COMMIT_HASH}.${ETH_BUILD_PLATFORM}")
diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh
index 23c374e1..6a30faf5 100755
--- a/scripts/release_ppa.sh
+++ b/scripts/release_ppa.sh
@@ -52,7 +52,7 @@ mv solidity solc
# Determine version
cd solc
version=`grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? CMakeLists.txt`
-commithash=`git rev-parse --short HEAD`
+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?/./'`
diff --git a/scripts/travis-emscripten/publish_binary.sh b/scripts/travis-emscripten/publish_binary.sh
index bfdf9906..d372995c 100755
--- a/scripts/travis-emscripten/publish_binary.sh
+++ b/scripts/travis-emscripten/publish_binary.sh
@@ -33,7 +33,7 @@ set -e
VER=$(cat CMakeLists.txt | grep 'set(PROJECT_VERSION' | sed -e 's/.*set(PROJECT_VERSION "\(.*\)".*/\1/')
test -n "$VER"
VER="v$VER"
-COMMIT=$(git rev-parse --short HEAD)
+COMMIT=$(git rev-parse --short=8 HEAD)
DATE=$(date --date="$(git log -1 --date=iso --format=%ad HEAD)" --utc +%Y.%-m.%-d)
# remove leading zeros in components - they are not semver-compatible