Skip to content

Commit

Permalink
Mount to tmp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed May 11, 2023
1 parent 15d1c3b commit 68a3aff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
24 changes: 16 additions & 8 deletions ports/intel-mkl/copy-from-dmg.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
find_program(HDIUTIL NAMES hdiutil REQUIRED)
set(dmg_path "NOTFOUND" CACHE FILEPATH "Where to find the DMG")
set(mount_point "mount-intel-mkl" CACHE FILEPATH "Where to mount the DMG")
set(output_dir "output_dir" CACHE FILEPATH "Where to put the packages")

if(NOT EXISTS "${dmg_path}")
message(FATAL_ERROR "'dmg_path' (${dmg_path}) does not exist.")
endif()
if(NOT IS_DIRECTORY "${mount_point}")
message(FATAL_ERROR "'mount_point' (${mount_point}) is not a directory.")
endif()
if(NOT IS_DIRECTORY "${output_dir}")
message(FATAL_ERROR "'output_dir' (${output_dir}) is not a directory.")
endif()

execute_process(
COMMAND "${HDIUTIL}" attach "${dmg_path}" -mountpoint "${mount_point}"
COMMAND mktemp -d
RESULT_VARIABLE mktemp_result
OUTPUT_VARIABLE mount_point
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT mktemp_result STREQUAL "0")
message(FATAL_ERROR "mktemp -d failed: ${mktemp_result}")
elseif(NOT IS_DIRECTORY "${mount_point}")
message(FATAL_ERROR "'mount_point' (${mount_point}) is not a directory.")
endif()

execute_process(
COMMAND "${HDIUTIL}" attach "${dmg_path}" -mountpoint "${mount_point}" -readonly
RESULT_VARIABLE mount_result
)
if(mount_result STREQUAL "0")
Expand All @@ -37,9 +45,9 @@ execute_process(
)

if(NOT mount_result STREQUAL "0")
message(FATAL_ERROR "Mounting ${dmg_path} failed.")
message(FATAL_ERROR "Mounting ${dmg_path} failed: ${mount_result}")
elseif(NOT copy_result STREQUAL "0")
message(FATAL_ERROR "Coyping packages failed.")
message(FATAL_ERROR "Coyping packages failed: ${copy_result}")
elseif(NOT unmount_result STREQUAL "0")
message(FATAL_ERROR "Unounting ${dmg_path} failed.")
message(FATAL_ERROR "Unounting ${dmg_path} failed: ${unmount_result}")
endif()
2 changes: 0 additions & 2 deletions ports/intel-mkl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ else()
file(RENAME "${extract_0_dir}/l_onemkl_p_2023.0.0.25398_offline/packages" "${extract_0_dir}/packages")
elseif(VCPKG_TARGET_IS_OSX)
find_program(HDIUTIL NAMES hdiutil REQUIRED)
file(MAKE_DIRECTORY "${extract_0_dir}/mount-intel-mkl")
file(MAKE_DIRECTORY "${extract_0_dir}/packages")
message(STATUS "... Don't interrupt.")
vcpkg_execute_required_process(
COMMAND "${CMAKE_COMMAND}" "-Ddmg_path=${installer_path}"
"-Dmount_point=${extract_0_dir}/mount-intel-mkl"
"-Doutput_dir=${extract_0_dir}/packages"
"-DHDIUTIL=${HDIUTIL}"
-P "${CMAKE_CURRENT_LIST_DIR}/copy-from-dmg.cmake"
Expand Down
2 changes: 1 addition & 1 deletion versions/i-/intel-mkl.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"versions": [
{
"git-tree": "bf467a3d5cd28e6a65545323a20b6121b66418f8",
"git-tree": "285fa0de9d6f05022ce06e53f7c8c21048ff586f",
"version": "2023.0.0",
"port-version": 1
},
Expand Down

0 comments on commit 68a3aff

Please sign in to comment.