From 7eb0bab486b359be459d28674cd9ee5d47f99bb2 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Mon, 27 Jun 2022 09:39:29 -0700 Subject: [PATCH 1/2] Switched `tinycbor` to use `GIT_REPOSITORY` and `GIT_TAG` instead of `URL` and `URL_HASH` in `ExternalProject_Add`. `tinycbor` is already downloaded from GitHub, so we can just use the built-in `git` support. This makes upgrading `tinycbor` versions easier. Also, we can use either git tags/branches or commit hashes. I used a commit hash here so we keep the integrity checks (which are SHA-1 now vs. MD5), but we could use git tags for more flexibility. This also has the advantage over raw tarball hashes in being more stable, as GitHub can (and has) changed the compression slightly, resulting in a different hash. Using the commit hash is from the source and thus should be completely stable. --- c2rust-ast-exporter/src/CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/c2rust-ast-exporter/src/CMakeLists.txt b/c2rust-ast-exporter/src/CMakeLists.txt index ec5901bba4..64bc53c22a 100644 --- a/c2rust-ast-exporter/src/CMakeLists.txt +++ b/c2rust-ast-exporter/src/CMakeLists.txt @@ -4,17 +4,22 @@ project(ASTExporter) ################################################# # TinyCBOR # ################################################# -set(TINYCBOR_URL "https://github.com/intel/tinycbor/archive/v0.6.0.tar.gz" - CACHE STRING "tinycbor download URL") -set(TINYCBOR_MD5 "3663e683dbf03f49cb7057ed316a7563" CACHE STRING "tinycbor archive md5 sum") + +set(TINYCBOR_REPO "https://github.com/intel/tinycbor.git" CACHE STRING "tinycbor git repo URL") + +# v0.6.3 tag, but using the commit hash instead (of the tarball hash) for integrity checks +# unlike a .tar.gz MD5 hash, this SHA-1 commit hash should stay stable regardless of compression/archiving +# (GitHub has changed this), and still retains the integrity check +set(TINYCBOR_TAG "d393c16f3eb30d0c47e6f9d92db62272f0ec4dc7" CACHE STRING "tinycbor git tag/branch/commit hash") + set(TINYCBOR_PREFIX "${CMAKE_BINARY_DIR}/tinycbor" CACHE STRING "tinycbor install prefix") include(ExternalProject) ExternalProject_Add(tinycbor_build PREFIX ${TINYCBOR_PREFIX} INSTALL_DIR ${CMAKE_BINARY_DIR} - URL ${TINYCBOR_URL} - URL_HASH MD5=${TINYCBOR_MD5} + GIT_REPOSITORY ${TINYCBOR_REPO} + GIT_TAG ${TINYCBOR_TAG} # the fd redirection here fails when the build run inside Cargo. # patch from upstream: # https://github.com/intel/tinycbor/commit/6176e0a28d7c5ef3a5e9cbd02521999c412de72c From 4e7e2e7d24a4359b32ef0634ba21155e52aa8c23 Mon Sep 17 00:00:00 2001 From: Khyber Sen Date: Mon, 27 Jun 2022 10:14:13 -0700 Subject: [PATCH 2/2] Added `git` installation for Fedora. Needs a docker push. --- scripts/provision_dnf.sh | 1 + scripts/provision_yum.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/provision_dnf.sh b/scripts/provision_dnf.sh index 367eb8065e..65685034d8 100644 --- a/scripts/provision_dnf.sh +++ b/scripts/provision_dnf.sh @@ -16,6 +16,7 @@ dnf install --quiet --assumeyes \ clang-devel \ cmake \ diffutils \ + git \ libquadmath-devel \ llvm-devel \ make \ diff --git a/scripts/provision_yum.sh b/scripts/provision_yum.sh index 8c63853f3e..4740e1fa85 100644 --- a/scripts/provision_yum.sh +++ b/scripts/provision_yum.sh @@ -13,7 +13,7 @@ fi # required to install ninja-build yum install --quiet --assumeyes epel-release # NOTE: CentOS version of cmake is too old -yum install --quiet --assumeyes which ninja-build make cmake libquadmath-devel strace +yum install --quiet --assumeyes which git ninja-build make cmake libquadmath-devel strace yum install --quiet --assumeyes luarocks