Skip to content

Commit

Permalink
add a hash check for cellar (#5759)
Browse files Browse the repository at this point in the history
  • Loading branch information
RensDofferhoff authored Dec 16, 2024
1 parent cbc0e80 commit f19860e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Tools/CMake/JASP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,34 @@ message(STATUS "CRAN mirror: ${R_REPOSITORY}")

#this handles the cellar download.
if(R_PKG_CELLAR_DOWNLOAD_REMOTE AND R_PKG_CELLAR_PATH STREQUAL "${CMAKE_BINARY_DIR}/_cache/cellar/" AND NOT EXISTS "${CMAKE_BINARY_DIR}/_cache/cellar/")
SET(DEFAULT_REMOTE_CELLAR OFF)
#set appropriate default remote if needed
if(R_PKG_CELLAR_REMOTE STREQUAL "")
SET(DEFAULT_REMOTE_CELLAR ON)
SET(CELLAR_HASH "0")
if(APPLE)
SET(R_PKG_CELLAR_REMOTE "https://static.jasp-stats.org/development/cellars/cellar_macOS_x86_64_latest.tar.gz")
SET(CELLAR_HASH "5dd0e03f0f45246d0a23c5c6d7387fe23947c001929f8a178cf6a3345d931a00")
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
SET(R_PKG_CELLAR_REMOTE "https://static.jasp-stats.org/development/cellars/cellar_macOS_arm64_latest.tar.gz")
SET(CELLAR_HASH "7dfeb8ae52fe9a370234ec59ee9fd5f630d28900d97a07bdbe5e650fa323a4c8")
endif()
elseif(WIN32)
SET(R_PKG_CELLAR_REMOTE "https://static.jasp-stats.org/development/cellars/cellar_Windows_x86_64_latest.tar.gz")
SET(CELLAR_HASH "697703474fda077300e402195e03e3783d84ec7c0bc73418bff713c9c66d9dee")
endif()
endif()

#download and extract the cellar
if(NOT R_PKG_CELLAR_REMOTE STREQUAL "")
message(STATUS "Remote cellar: ${R_PKG_CELLAR_REMOTE}")
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/cellar/")
file(DOWNLOAD "${R_PKG_CELLAR_REMOTE}" "${CMAKE_BINARY_DIR}/_cache/cellar.tar.gz" TLS_VERIFY ON)
file(ARCHIVE_EXTRACT INPUT "${CMAKE_BINARY_DIR}/_cache/cellar.tar.gz" DESTINATION "${CMAKE_BINARY_DIR}/_cache/")
if(DEFAULT_REMOTE_CELLAR)
file(DOWNLOAD "${R_PKG_CELLAR_REMOTE}" "${CMAKE_BINARY_DIR}/_cache/cellar.tar.gz" TLS_VERIFY ON EXPECTED_HASH SHA256=CELLAR_HASH)
else()
file(DOWNLOAD "${R_PKG_CELLAR_REMOTE}" "${CMAKE_BINARY_DIR}/_cache/cellar.tar.gz" TLS_VERIFY ON)
endif()
file(ARCHIVE_EXTRACT INPUT "${CMAKE_BINARY_DIR}/_cache/cellar.tar.gz" DESTINATION "${CMAKE_BINARY_DIR}/_cache/")
endif()
endif()

Expand Down

0 comments on commit f19860e

Please sign in to comment.