From c88f263e47994305271dbc9d54b2bae39cf80da2 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 3 Dec 2024 12:14:18 -0500 Subject: [PATCH 1/9] use 7zip instead of 7zr --- src/vcpkg/archives.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 0aee082352..5eb564f8b0 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -179,7 +179,7 @@ namespace vcpkg case ExtractionType::Nupkg: win32_extract_nupkg(tools, status_sink, archive, to_path); break; case ExtractionType::Msi: win32_extract_msi(archive, to_path); break; case ExtractionType::SevenZip: - win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP_R, status_sink), archive, to_path); + win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); break; case ExtractionType::Zip: win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); From 1599f3c996ca00a28924868b424d5b6a5a565260 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 3 Dec 2024 14:06:03 -0500 Subject: [PATCH 2/9] add new extraction type for self extracting 7zip --- include/vcpkg/archives.h | 3 ++- src/vcpkg-test/archives.cpp | 1 + src/vcpkg/archives.cpp | 24 ++++++++++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/vcpkg/archives.h b/include/vcpkg/archives.h index dbecf5a84d..97b67b0531 100644 --- a/include/vcpkg/archives.h +++ b/include/vcpkg/archives.h @@ -21,7 +21,8 @@ namespace vcpkg SevenZip, Nupkg, Msi, - Exe + Exe, + SelfExtracting7z }; // Extract `archive` to `to_path` using `tar_tool`. diff --git a/src/vcpkg-test/archives.cpp b/src/vcpkg-test/archives.cpp index 76338403b8..4879832caf 100644 --- a/src/vcpkg-test/archives.cpp +++ b/src/vcpkg-test/archives.cpp @@ -15,4 +15,5 @@ TEST_CASE ("Testing guess_extraction_type", "[z-extract]") REQUIRE(guess_extraction_type(Path("/path/to/archive.xz")) == ExtractionType::Tar); REQUIRE(guess_extraction_type(Path("/path/to/archive.exe")) == ExtractionType::Exe); REQUIRE(guess_extraction_type(Path("/path/to/archive.unknown")) == ExtractionType::Unknown); + REQUIRE(guess_extraction_type(Path("/path/to/archive.7z.exe")) == ExtractionType::SelfExtracting7z); } diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 5eb564f8b0..92c2337c85 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -134,6 +134,7 @@ namespace vcpkg { const auto ext = archive.extension(); + const auto stem = archive.stem(); if (Strings::case_insensitive_ascii_equals(ext, ".nupkg")) { return ExtractionType::Nupkg; @@ -156,7 +157,16 @@ namespace vcpkg } else if (Strings::case_insensitive_ascii_equals(ext, ".exe")) { - return ExtractionType::Exe; + // Special case to differentiate between self-extracting 7z archives and other exe files + Path stem_path(stem); + if (Strings::case_insensitive_ascii_equals(stem_path.extension(), ".7z")) + { + return ExtractionType::SelfExtracting7z; + } + else + { + return ExtractionType::Exe; + } } else { @@ -175,19 +185,17 @@ namespace vcpkg #if defined(_WIN32) switch (ext_type) { - case ExtractionType::Unknown: break; + case ExtractionType::Unknown: + break; case ExtractionType::Nupkg: win32_extract_nupkg(tools, status_sink, archive, to_path); break; case ExtractionType::Msi: win32_extract_msi(archive, to_path); break; case ExtractionType::SevenZip: - win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); - break; case ExtractionType::Zip: - win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); - break; case ExtractionType::Tar: - extract_tar(tools.get_tool_path(Tools::TAR, status_sink), archive, to_path); - break; case ExtractionType::Exe: + win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); + break; + case ExtractionType::SelfExtracting7z: const Path filename = archive.filename(); const Path stem = filename.stem(); const Path to_archive = Path(archive.parent_path()) / stem; From aead1f9a34cfb958fb03757625cd4ab8b4f07c1a Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 3 Dec 2024 14:07:20 -0500 Subject: [PATCH 3/9] minor change --- src/vcpkg/archives.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 92c2337c85..6b965969dd 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -158,8 +158,7 @@ namespace vcpkg else if (Strings::case_insensitive_ascii_equals(ext, ".exe")) { // Special case to differentiate between self-extracting 7z archives and other exe files - Path stem_path(stem); - if (Strings::case_insensitive_ascii_equals(stem_path.extension(), ".7z")) + if (Strings::case_insensitive_ascii_equals(Path(stem).extension(), ".7z")) { return ExtractionType::SelfExtracting7z; } From 13215d80bac6a729aeede9e6414cb5300e1db760 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 3 Dec 2024 14:33:43 -0500 Subject: [PATCH 4/9] fix format --- src/vcpkg/archives.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 6b965969dd..11602b5b61 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -184,8 +184,7 @@ namespace vcpkg #if defined(_WIN32) switch (ext_type) { - case ExtractionType::Unknown: - break; + case ExtractionType::Unknown: break; case ExtractionType::Nupkg: win32_extract_nupkg(tools, status_sink, archive, to_path); break; case ExtractionType::Msi: win32_extract_msi(archive, to_path); break; case ExtractionType::SevenZip: From 6e46b0470cfa9f435947327ac316922d346ee05a Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 3 Dec 2024 14:54:44 -0500 Subject: [PATCH 5/9] point to registry changes --- vcpkg-init/vcpkg-scripts-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg-init/vcpkg-scripts-sha.txt b/vcpkg-init/vcpkg-scripts-sha.txt index c643ac7793..0b758f5cf5 100644 --- a/vcpkg-init/vcpkg-scripts-sha.txt +++ b/vcpkg-init/vcpkg-scripts-sha.txt @@ -1 +1 @@ -d033613d9021107e4a7b52c5fac1f87ae8a6fcc6 +a1dc361588c31b746e20d0146649e67f01646bad From 141274b85ef22e21184a6193c3730a6cea2fc0e5 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 3 Dec 2024 15:21:25 -0500 Subject: [PATCH 6/9] use 7zr for 7z --- src/vcpkg/archives.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 11602b5b61..42eb4a289c 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -134,7 +134,6 @@ namespace vcpkg { const auto ext = archive.extension(); - const auto stem = archive.stem(); if (Strings::case_insensitive_ascii_equals(ext, ".nupkg")) { return ExtractionType::Nupkg; @@ -158,6 +157,7 @@ namespace vcpkg else if (Strings::case_insensitive_ascii_equals(ext, ".exe")) { // Special case to differentiate between self-extracting 7z archives and other exe files + const auto stem = archive.stem(); if (Strings::case_insensitive_ascii_equals(Path(stem).extension(), ".7z")) { return ExtractionType::SelfExtracting7z; @@ -188,6 +188,8 @@ namespace vcpkg case ExtractionType::Nupkg: win32_extract_nupkg(tools, status_sink, archive, to_path); break; case ExtractionType::Msi: win32_extract_msi(archive, to_path); break; case ExtractionType::SevenZip: + win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP_R, status_sink), archive, to_path); + break; case ExtractionType::Zip: case ExtractionType::Tar: case ExtractionType::Exe: From 8cbc7551a79f2f9aaf9e1e1151019337fec93f6e Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Tue, 3 Dec 2024 16:16:02 -0500 Subject: [PATCH 7/9] use 7z for exe, zip, and 7z archives --- src/vcpkg/archives.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 42eb4a289c..b57b7faf1c 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -191,7 +191,11 @@ namespace vcpkg win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP_R, status_sink), archive, to_path); break; case ExtractionType::Zip: + win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); + break; case ExtractionType::Tar: + extract_tar(tools.get_tool_path(Tools::TAR, status_sink), archive, to_path); + break; case ExtractionType::Exe: win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); break; From 0532990e6c1123b0c9a4dcb1dc688994f44a3029 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 9 Dec 2024 15:07:30 -0500 Subject: [PATCH 8/9] Update vcpkg-scripts-sha.txt --- vcpkg-init/vcpkg-scripts-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg-init/vcpkg-scripts-sha.txt b/vcpkg-init/vcpkg-scripts-sha.txt index 0b758f5cf5..b84a089582 100644 --- a/vcpkg-init/vcpkg-scripts-sha.txt +++ b/vcpkg-init/vcpkg-scripts-sha.txt @@ -1 +1 @@ -a1dc361588c31b746e20d0146649e67f01646bad +d17e80c0d121e550dbcb50797a2c6930f853af4b From e505e5648ddf89d64c8982692cd7e405c9d12db2 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 9 Dec 2024 15:31:18 -0500 Subject: [PATCH 9/9] update vcpkg-scripts-sha.txt --- vcpkg-init/vcpkg-scripts-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg-init/vcpkg-scripts-sha.txt b/vcpkg-init/vcpkg-scripts-sha.txt index b84a089582..7ecebbfbfe 100644 --- a/vcpkg-init/vcpkg-scripts-sha.txt +++ b/vcpkg-init/vcpkg-scripts-sha.txt @@ -1 +1 @@ -d17e80c0d121e550dbcb50797a2c6930f853af4b +0c4cf19224a049cf82f4521e29e39f7bd680440c