Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a hash check for cellar #5759

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading