git for linux/osx version moved to vcpkgTools.xml

This commit is contained in:
Alexander Karatarakis 2018-05-04 18:14:54 -07:00
parent 9265fe76bf
commit ab58f531cc
2 changed files with 22 additions and 8 deletions

View File

@ -28,6 +28,18 @@
<sha512>a34575ab1b4f553e62535e38492904b512df4d6a837cf4abf205dbcdd05edf1eef450cc5b15a4f63f901424d5f3cd1f78b6b22437d0d4f8cd9ce4e42e82617b9</sha512>
<archiveName>MinGit-2.17.0-32-bit.zip</archiveName>
</tool>
<tool name="git" os="linux">
<version>2.7.4</version>
<exeRelativePath></exeRelativePath>
<url></url>
<sha512></sha512>
</tool>
<tool name="git" os="osx">
<version>2.7.4</version>
<exeRelativePath></exeRelativePath>
<url></url>
<sha512></sha512>
</tool>
<tool name="vswhere" os="windows">
<version>2.4.1</version>
<exeRelativePath>vswhere.exe</exeRelativePath>

View File

@ -83,7 +83,8 @@ namespace vcpkg::Commands::Fetch
right_delim,
XML_PATH.generic_string());
return *result.get();
auto r = *result.get();
return Strings::trim(std::move(r));
};
static const std::regex XML_VERSION_REGEX{R"###(<tools[\s]+version="([^"]+)">)###"};
@ -255,8 +256,8 @@ namespace vcpkg::Commands::Fetch
const std::string download_path_part = download_path.u8string() + ".part";
std::error_code ec;
fs.remove(download_path_part, ec);
const auto code = System::cmd_execute(Strings::format(
R"(curl -L '%s' --create-dirs --output '%s')", url, download_path_part));
const auto code = System::cmd_execute(
Strings::format(R"(curl -L '%s' --create-dirs --output '%s')", url, download_path_part));
Checks::check_exit(VCPKG_LINE_INFO, code == 0, "Could not download %s", url);
verify_hash(paths, url, download_path_part, sha512);
@ -267,8 +268,13 @@ namespace vcpkg::Commands::Fetch
static fs::path fetch_tool(const VcpkgPaths& paths, const std::string& tool_name, const ToolData& tool_data)
{
const std::array<int, 3>& version = tool_data.version;
const std::string version_as_string = Strings::format("%d.%d.%d", version[0], version[1], version[2]);
Checks::check_exit(VCPKG_LINE_INFO,
!tool_data.url.empty(),
"A suitable version of %s was not found (required v%s) and unable to automatically "
"download a portable one. Please install a newer version of git.",
tool_name,
version_as_string);
System::println("A suitable version of %s was not found (required v%s). Downloading portable %s v%s...",
tool_name,
version_as_string,
@ -401,11 +407,7 @@ namespace vcpkg::Commands::Fetch
static fs::path get_git_path(const VcpkgPaths& paths)
{
#if defined(_WIN32)
static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "git");
#else
static const ToolData TOOL_DATA = ToolData{{2, 7, 4}, ""};
#endif
static const std::string VERSION_CHECK_ARGUMENTS = "--version";
std::vector<fs::path> candidate_paths;