aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-03-09 03:51:19 -0800
committerRobert Schumacher <roschuma@microsoft.com>2018-03-11 23:42:53 -0700
commit81b58d1868a0f7edf324b2f366426e2973ac80b7 (patch)
tree46274746fd208b33dc0c0cfbabb644abfe3aa762
parentf56a5e4e94a1151bc09f073b3597ff3b40e9d4b8 (diff)
downloadvcpkg-81b58d1868a0f7edf324b2f366426e2973ac80b7.tar.gz
vcpkg-81b58d1868a0f7edf324b2f366426e2973ac80b7.zip
[vcpkg] Use unzip/zip on non-windows
-rw-r--r--toolsrc/src/vcpkg/build.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index aa84b6cf5..408dde798 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -438,10 +438,15 @@ namespace vcpkg::Build
auto files = fs.get_files_non_recursive(pkg_path);
Checks::check_exit(VCPKG_LINE_INFO, files.empty(), "unable to clear path: %s", pkg_path.u8string());
+#if defined(_WIN32)
auto&& _7za = paths.get_7za_exe();
System::cmd_execute_clean(Strings::format(
R"("%s" x "%s" -o"%s" -y >nul)", _7za.u8string(), archive_path.u8string(), pkg_path.u8string()));
+#else
+ System::cmd_execute_clean(Strings::format(
+ R"(unzip -qq "%s" "-d%s")", archive_path.u8string(), pkg_path.u8string()));
+#endif
auto maybe_bcf = Paragraphs::try_load_cached_control_package(paths, spec);
bcf = std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
@@ -538,6 +543,7 @@ namespace vcpkg::Build
!fs.exists(tmp_archive_path),
"Could not remove file: %s",
tmp_archive_path.u8string());
+#if defined(_WIN32)
auto&& _7za = paths.get_7za_exe();
System::cmd_execute_clean(Strings::format(
@@ -545,7 +551,12 @@ namespace vcpkg::Build
_7za.u8string(),
tmp_archive_path.u8string(),
paths.package_dir(spec).u8string()));
-
+#else
+ System::cmd_execute_clean(Strings::format(
+ R"(cd '%s' && zip --quiet -r '%s' *)",
+ paths.package_dir(spec).u8string(),
+ tmp_archive_path.u8string()));
+#endif
fs.create_directories(archives_dir, ec);
fs.rename(tmp_archive_path, archive_path);