Skip to content
Draft
Show file tree
Hide file tree
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
10 changes: 1 addition & 9 deletions scripts/cmake/vcpkg_find_acquire_program(7Z).cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
set(program_name 7z)
if(CMAKE_HOST_WIN32)
set(tool_subdirectory "24.09")
set(paths_to_search "${DOWNLOADS}/tools/7z/${tool_subdirectory}/7z2409/SourceDir/Files/7-Zip")
set(download_urls "https://github.com/ip7z/7zip/releases/download/24.09/7z2409.exe")
set(download_filename "7z2409.7z.exe")
set(search_names "7z.exe")
set(download_sha512 a39a84b13b383ac5fca20eb6d92ec6b8bc85f1b6a545c441efdbe054d8d12c9ebe97d366235bdf1383bbdb2a9666d18d0145b10b6e589180502c0c2dfa26ef14)
endif()
z_use_vcpkg_fetch(7Z FETCH_NAME 7zip)
16 changes: 1 addition & 15 deletions scripts/cmake/vcpkg_find_acquire_program(GIT).cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
set(program_name git)
if(CMAKE_HOST_WIN32)
set(base_version 2.32.0)
set(program_version 2.32.0.2)
set(tool_subdirectory "git-${program_version}-2-windows")
set(download_urls "https://github.com/git-for-windows/git/releases/download/v${base_version}.windows.2/PortableGit-${program_version}-32-bit.7z.exe")
set(download_filename "PortableGit-${program_version}-32-bit.7z.exe")
set(download_sha512 867d8534972cbaf7a4224e25a14d484f8d17ef186f8d79e9a758afb90cf69541375cb7615a39702311f4809cb8371ef85c2b1a15bfffe9e48f0e597ac011b348)
set(paths_to_search
"${DOWNLOADS}/tools/${tool_subdirectory}/mingw32/bin"
"${DOWNLOADS}/tools/git/${tool_subdirectory}/mingw32/bin")
else()
set(brew_package_name "git")
set(apt_package_name "git")
endif()
z_use_vcpkg_fetch(GIT)
47 changes: 1 addition & 46 deletions scripts/cmake/vcpkg_find_acquire_program(NINJA).cmake
Original file line number Diff line number Diff line change
@@ -1,46 +1 @@
set(program_name ninja)
set(program_version 1.12.1)
set(version_command --version)
if(CMAKE_HOST_WIN32)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(build_arch $ENV{PROCESSOR_ARCHITEW6432})
else()
set(build_arch $ENV{PROCESSOR_ARCHITECTURE})
endif()
if(build_arch MATCHES "^(ARM|arm)64$")
set(download_filename "ninja-winarm64-${program_version}.zip")
set(tool_subdirectory "${program_version}-windows-arm64")
set(download_urls "https://github.com/ninja-build/ninja/releases/download/v${program_version}/ninja-winarm64.zip")
set(download_sha512 b1826c422a677f47f9f7e001672ce831791b092e4f1cd84ddf2ea067781c31aa8246f26e91dd66300c23ffa77a8ea29910c48ccf7e4235ff20bccc2d2b6e247b)
else()
set(download_filename "ninja-win-${program_version}.zip")
set(tool_subdirectory "${program_version}-windows")
set(download_urls "https://github.com/ninja-build/ninja/releases/download/v${program_version}/ninja-win.zip")
set(download_sha512 d6715c6458d798bcb809f410c0364dabd937b5b7a3ddb4cd5aba42f9fca45139b2a8a3e7fd9fbd88fd75d298ed99123220b33c7bdc8966a9d5f2a1c9c230955f)
endif()
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(download_filename "ninja-mac-${program_version}.zip")
set(download_urls "https://github.com/ninja-build/ninja/releases/download/v${program_version}/ninja-mac.zip")
set(tool_subdirectory "${program_version}-osx")
set(paths_to_search "${DOWNLOADS}/tools/ninja-${program_version}-osx")
set(download_sha512 4c11f477359c9d1dcda72529a503a59948ec20b368992132e545d6d4f6e3aabfd1d6b1d0f32cf932626037959b24a7bb375ef901e2d002eabadc83a265cbc351)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
set(paths_to_search "${DOWNLOADS}/tools/${tool_subdirectory}-freebsd")
else()
vcpkg_execute_in_download_mode(COMMAND "uname" "-m" OUTPUT_VARIABLE HOST_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
if(HOST_ARCH MATCHES "x86_64|amd64|AMD64")
set(download_filename "ninja-linux-${program_version}.zip")
set(download_urls "https://github.com/ninja-build/ninja/releases/download/v${program_version}/ninja-linux.zip")
set(tool_subdirectory "${program_version}-linux")
set(paths_to_search "${DOWNLOADS}/tools/ninja-${program_version}-linux")
set(download_sha512 9c2ad534e7e72e67c608de7784cfbae601095bfca96713731a3f1eca268d66a6302f40c138a4ad97f7e8c902cd3fb05994a175e46fe922295dcc2d1334bf9014)
elseif(HOST_ARCH MATCHES "arm64|aarch64|ARM64|AARCH64")
set(download_filename "ninja-linux-aarch64-${program_version}.zip")
set(download_urls "https://github.com/ninja-build/ninja/releases/download/v${program_version}/ninja-linux-aarch64.zip")
set(tool_subdirectory "${program_version}-linux-aarch64")
set(paths_to_search "${DOWNLOADS}/tools/ninja-${program_version}-linux-aarch64")
set(download_sha512 22c46abb7e6d916e11713705f78d093e9b30029cb49cadc65755908ad9f44b3f2548105174cc615a5ef86c4672b366173f18bd04c2d71710a303d952c06db334)
else()
set(version_command "") # somewhat hacky way to skip version check and use system binary
endif()
endif()
z_use_vcpkg_fetch(NINJA)
12 changes: 1 addition & 11 deletions scripts/cmake/vcpkg_find_acquire_program(NUGET).cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
set(program_name nuget)
set(brew_package_name "nuget")
if(CMAKE_HOST_WIN32)
set(download_urls "https://dist.nuget.org/win-x86-commandline/v6.11.1/nuget.exe")
set(download_filename "nuget.6.11.1.exe")
set(download_sha512 8E139D1C4A97F35625E261DF07AC5B3ECB6B931907D303E3B0FCCA26EC537FF667FF49CA15CB57909B30A262EA39EF678C4CBF33C99658162E58A6648D336D52)
set(tool_subdirectory "6.11.1")
set(paths_to_search "${DOWNLOADS}/tools/nuget-${tool_subdirectory}-windows")
set(raw_executable ON)
set(rename_binary_to "nuget.exe")
endif()
z_use_vcpkg_fetch(NUGET)
24 changes: 24 additions & 0 deletions scripts/cmake/vcpkg_find_acquire_program.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ function(z_vcpkg_find_acquire_program_find_internal program)
endif()
endfunction()

function(z_use_vcpkg_fetch program)
cmake_parse_arguments(PARSE_ARGV 1 arg
""
"FETCH_NAME"
""
)
if(NOT arg_FETCH_NAME)
string(TOLOWER "${program}" arg_FETCH_NAME)
endif()
vcpkg_execute_in_download_mode(
COMMAND "$ENV{VCPKG_COMMAND}" fetch "${arg_FETCH_NAME}" --x-stderr-status
RESULT_VARIABLE error_code
OUTPUT_VARIABLE ${program}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah this explains the funny NuGet behavior. fetch needs to be audited to send status messages to stderr.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it is not enough:

still get:

CMake Error at scripts/test_ports/vcpkg-find-acquire-program/portfile.cmake:66 (message):
  The following programs do not exist:

     NUGET: Trying to download 71d7307b-nuget.exe using asset cache https://vcpkgassetcachewus.blob.core.windows.net/cache/71d7307bb89de2df3811419c561efa00618a4c68e6ce481b0bdfc94c7c6c6d126a54eb26a0015686fabf99f109744ca41fead99e97139cdc86dde16a5ec3e7cf?*** SECRET ***

  Download successful! Asset cache hit, did not try authoritative source
  https://dist.nuget.org/win-x86-commandline/v6.10.0/nuget.exe

  D:\downloads\tools\nuget-6.10.0-windows\nuget.exe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still an issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neumann-A @dg0yt Finally have what I hope is a fix for this out for review microsoft/vcpkg-tool#1842

ERROR_VARIABLE error_pipe
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${DOWNLOADS}"
)
set("${program}" "${${program}}" CACHE STRING "" FORCE)
set(z_uses_vcpkg_fetch ON PARENT_SCOPE)
endfunction()

function(vcpkg_find_acquire_program program)
if(${program})
return()
Expand All @@ -119,6 +140,9 @@ function(vcpkg_find_acquire_program program)
set(program_information "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/vcpkg_find_acquire_program(${program}).cmake")
if(program MATCHES "^[A-Z0-9]+\$" AND EXISTS "${program_information}")
include("${program_information}")
if(z_uses_vcpkg_fetch)
return()
endif()
else()
message(FATAL_ERROR "unknown tool ${program} -- unable to acquire.")
endif()
Expand Down
Loading