From b0f468882333adaa3e450422e8aa6fe0f897935a Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 13 Jul 2023 11:55:29 +0300 Subject: Fix tar extraction in mingw windows --- xmake/core/base/os.lua | 5 +++-- xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 2 +- xmake/modules/utils/archive/extract.lua | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index bb2ebec53..e4dc6ebf6 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -1002,8 +1002,9 @@ end -- get the system null device function os.nuldev(input) + -- mingw and cygwin have /dev/null if input then - if os.host() == "windows" then + if os.host() == "windows" and not os.is_subhost("msys", "cygwin") then -- init the input nuldev if xmake._NULDEV_INPUT == nil then -- create an empty file @@ -1023,7 +1024,7 @@ function os.nuldev(input) end return xmake._NULDEV_INPUT else - if os.host() == "windows" then + if os.host() == "windows" and not os.is_subhost("msys", "cygwin") then -- @note cannot cache this file path to avoid multi-processes writing to the same file at the same time return os.tmpfile() else diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index dad9dbdd4..a4e3c2849 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -227,7 +227,7 @@ function sandbox_lib_detect_find_program._find(name, paths, opt) if envpaths then table.join2(syspaths, path.splitenv(envpaths)) end]] - if os.host() ~= "windows" then + if os.host() ~= "windows" or os.is_subhost("msys", "cygwin") then table.insert(syspaths, "/usr/local/bin") table.insert(syspaths, "/usr/bin") end diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index 620c84d69..4a91e1a78 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -33,7 +33,7 @@ import("extension", {alias = "get_archive_extension"}) function _extract_using_tar(archivefile, outputdir, extension, opt) -- the tar of windows can only extract "*.tar" - if os.host() == "windows" and extension ~= ".tar" then + if os.host() == "windows" and not os.is_subhost("msys", "cygwin") and extension ~= ".tar" then return false end @@ -45,7 +45,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) -- init argv local argv = {} - if is_host("windows") then + if is_host("windows") and not os.is_subhost("msys", "cygwin") then -- force "x:\\xx" as local file local force_local = _g.force_local if force_local == nil then @@ -70,7 +70,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) end -- set outputdir - if not is_host("windows") then + if not is_host("windows") or os.is_subhost("msys", "cygwin") then table.insert(argv, "-C") table.insert(argv, outputdir) end @@ -84,7 +84,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) end -- extract it - if is_host("windows") then + if is_host("windows") and not os.is_subhost("msys", "cygwin") then os.vrunv(program, argv, {curdir = outputdir}) else os.vrunv(program, argv) -- cgit v1.3.1 From a8c6fb67c0f01e743cb474c501b261a45fa40f0b Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:18:16 +0300 Subject: Keep --force-local handling --- xmake/modules/utils/archive/extract.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index 4a91e1a78..cd5d8eec6 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -45,7 +45,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) -- init argv local argv = {} - if is_host("windows") and not os.is_subhost("msys", "cygwin") then + if is_host("windows") then -- force "x:\\xx" as local file local force_local = _g.force_local if force_local == nil then -- cgit v1.3.1 From d09a4327e317bf30370fad134be4c11cd23fb51b Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:36:57 +0300 Subject: Remove msys checks for tar due to incompatibilities --- xmake/core/base/os.lua | 2 +- xmake/modules/utils/archive/extract.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index e4dc6ebf6..4327d9333 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -1004,7 +1004,7 @@ function os.nuldev(input) -- mingw and cygwin have /dev/null if input then - if os.host() == "windows" and not os.is_subhost("msys", "cygwin") then + if os.host() == "windows" then -- init the input nuldev if xmake._NULDEV_INPUT == nil then -- create an empty file diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index cd5d8eec6..b32734836 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -33,7 +33,7 @@ import("extension", {alias = "get_archive_extension"}) function _extract_using_tar(archivefile, outputdir, extension, opt) -- the tar of windows can only extract "*.tar" - if os.host() == "windows" and not os.is_subhost("msys", "cygwin") and extension ~= ".tar" then + if os.host() == "windows" and extension ~= ".tar" then return false end @@ -84,7 +84,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) end -- extract it - if is_host("windows") and not os.is_subhost("msys", "cygwin") then + if is_host("windows") then os.vrunv(program, argv, {curdir = outputdir}) else os.vrunv(program, argv) -- cgit v1.3.1 From 3a9712b107411c445007fa1ef1230d92e97eeac3 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Fri, 14 Jul 2023 00:12:58 +0300 Subject: use tmpfile on msys --- xmake/core/base/os.lua | 2 +- xmake/modules/utils/archive/extract.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 4327d9333..a8659d4f2 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -1024,7 +1024,7 @@ function os.nuldev(input) end return xmake._NULDEV_INPUT else - if os.host() == "windows" and not os.is_subhost("msys", "cygwin") then + if os.host() == "windows" then -- @note cannot cache this file path to avoid multi-processes writing to the same file at the same time return os.tmpfile() else diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index b32734836..620c84d69 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -70,7 +70,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) end -- set outputdir - if not is_host("windows") or os.is_subhost("msys", "cygwin") then + if not is_host("windows") then table.insert(argv, "-C") table.insert(argv, outputdir) end -- cgit v1.3.1 From 4abf3c141a2cd43a78a96d05604b6d95550569e6 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Fri, 14 Jul 2023 00:20:48 +0300 Subject: Update os.lua --- xmake/core/base/os.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index a8659d4f2..bb2ebec53 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -1002,7 +1002,6 @@ end -- get the system null device function os.nuldev(input) - -- mingw and cygwin have /dev/null if input then if os.host() == "windows" then -- init the input nuldev -- cgit v1.3.1