From df5cf4ccf0e27ba805c348d21de77e0991b2cd34 Mon Sep 17 00:00:00 2001 From: Martin Trojer Date: Wed, 30 Sep 2020 08:45:31 -0700 Subject: [PATCH] change how installed clang hashes are stored on disk Summary: Change the hash stored to be the same as output of "--clang-hash". This change simplifies future work with building clang from alternative sources. Also remove outdated src/checksums.txt Reviewed By: jvillard Differential Revision: D24016467 fbshipit-source-id: 3c24ff029 --- facebook-clang-plugins/clang/setup.sh | 16 +++++++--- .../clang/src/checksums.txt | 31 ------------------- 2 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 facebook-clang-plugins/clang/src/checksums.txt diff --git a/facebook-clang-plugins/clang/setup.sh b/facebook-clang-plugins/clang/setup.sh index 738bea3a8..2ab130629 100755 --- a/facebook-clang-plugins/clang/setup.sh +++ b/facebook-clang-plugins/clang/setup.sh @@ -10,7 +10,6 @@ set -e set -o pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -SCRIPT_RELATIVE_PATH="$(basename "${BASH_SOURCE[0]}")" CLANG_RELATIVE_SRC="src/download/llvm" CLANG_SRC="$SCRIPT_DIR/$CLANG_RELATIVE_SRC" CLANG_PREBUILD_PATCHES=( @@ -49,15 +48,22 @@ clang_hash () { check_installed () { pushd "$SCRIPT_DIR" > /dev/null - $SHASUM -c "$CLANG_INSTALLED_VERSION_FILE" >& /dev/null - local result=$? + HASH=$(clang_hash) + RESULT=1 + if [ -f "$CLANG_INSTALLED_VERSION_FILE" ]; then + FILE_HASH=$(cat "$CLANG_INSTALLED_VERSION_FILE") + if [ "$HASH" == "$FILE_HASH" ]; then + RESULT=0 + fi + fi popd > /dev/null - return $result + return $RESULT } record_installed () { pushd "$SCRIPT_DIR" > /dev/null - $SHASUM setup.sh src/prepare_clang_src.sh > "$CLANG_INSTALLED_VERSION_FILE" + HASH=$(clang_hash) + echo $HASH > "$CLANG_INSTALLED_VERSION_FILE" popd > /dev/null } diff --git a/facebook-clang-plugins/clang/src/checksums.txt b/facebook-clang-plugins/clang/src/checksums.txt deleted file mode 100644 index d526160f1..000000000 --- a/facebook-clang-plugins/clang/src/checksums.txt +++ /dev/null @@ -1,31 +0,0 @@ -= LLVM+Clang 9.0.0 -- official release - -Downloaded from http://releases.llvm.org/download.html#9.0.0 - -Included components: -$ sha256sum *.tar.xz -7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610 cfe-9.0.0.src.tar.xz -56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e compiler-rt-9.0.0.src.tar.xz -3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c libcxx-9.0.0.src.tar.xz -675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9 libcxxabi-9.0.0.src.tar.xz -d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84 llvm-9.0.0.src.tar.xz -9979eb1133066376cc0be29d1682bc0b0e7fb541075b391061679111ae4d3b5b openmp-9.0.0.src.tar.xz - -Script to build the archive: - -tar xf llvm-9.0.0.src.tar.xz -cd llvm-9.0.0.src/tools/ -tar xf ../../cfe-9.0.0.src.tar.xz -mv cfe-9.0.0.src/ clang -cd ../projects/ -tar xf ../../compiler-rt-9.0.0.src.tar.xz -mv compiler-rt-9.0.0.src/ compiler-rt -tar xf ../../libcxx-9.0.0.src.tar.xz -mv libcxx-9.0.0.src/ libcxx -tar xf ../../libcxxabi-9.0.0.src.tar.xz -mv libcxxabi-9.0.0.src/ libcxxabi -tar xf ../../openmp-9.0.0.src.tar.xz -mv openmp-9.0.0.src/ openmp -cd ../.. -mv llvm-9.0.0.src llvm -tar cJ llvm > llvm_clang_compiler-rt_libcxx_libcxxabi_openmp-9.0.0.tar.xz