diff options
| author | Luau Project <luau.project@gmail.com> | 2026-01-28 21:39:46 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-28 21:39:46 -0300 |
| commit | e5821e9a6fd94aba56e28f0282f00748cd864903 (patch) | |
| tree | cdb99ab2a4de3b09417153f685d14e17927a27e7 /src | |
| parent | 2dc04f0531dac3b968ab5e8847c43e19db7c3efd (diff) | |
| download | luarocks-e5821e9a6fd94aba56e28f0282f00748cd864903.tar.gz luarocks-e5821e9a6fd94aba56e28f0282f00748cd864903.tar.bz2 luarocks-e5821e9a6fd94aba56e28f0282f00748cd864903.zip | |
fix: use LuaFileSystem in the system only if its version is 1.6.0 or newer. (#1825)
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/fs/lua.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 45324c77..d31a550d 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
| @@ -16,6 +16,11 @@ local pack = table.pack or function(...) return { n = select("#", ...), ... } en | |||
| 16 | local socket_ok, zip_ok, lfs_ok, md5_ok, posix_ok, bz2_ok, _ | 16 | local socket_ok, zip_ok, lfs_ok, md5_ok, posix_ok, bz2_ok, _ |
| 17 | local http, ftp, zip, lfs, md5, posix, bz2 | 17 | local http, ftp, zip, lfs, md5, posix, bz2 |
| 18 | 18 | ||
| 19 | -- Minimum lfs version required to | ||
| 20 | -- install and remove modules | ||
| 21 | local lfs_min_version = '1.6.0' | ||
| 22 | local lfs_at_least_min_ver = false | ||
| 23 | |||
| 19 | if cfg.fs_use_modules then | 24 | if cfg.fs_use_modules then |
| 20 | socket_ok, http = pcall(require, "socket.http") | 25 | socket_ok, http = pcall(require, "socket.http") |
| 21 | _, ftp = pcall(require, "socket.ftp") | 26 | _, ftp = pcall(require, "socket.ftp") |
| @@ -24,6 +29,20 @@ if cfg.fs_use_modules then | |||
| 24 | lfs_ok, lfs = pcall(require, "lfs") | 29 | lfs_ok, lfs = pcall(require, "lfs") |
| 25 | md5_ok, md5 = pcall(require, "md5") | 30 | md5_ok, md5 = pcall(require, "md5") |
| 26 | posix_ok, posix = pcall(require, "posix") | 31 | posix_ok, posix = pcall(require, "posix") |
| 32 | |||
| 33 | if lfs_ok then | ||
| 34 | local lfs_ver = lfs._VERSION | ||
| 35 | if lfs_ver then | ||
| 36 | local v = lfs_ver:match("(%d+%.%d+%.%d+)$") | ||
| 37 | if v then | ||
| 38 | lfs_at_least_min_ver = vers.parse_version(v) >= vers.parse_version(lfs_min_version) | ||
| 39 | end | ||
| 40 | end | ||
| 41 | end | ||
| 42 | |||
| 43 | if not lfs_at_least_min_ver then | ||
| 44 | lfs_ok = false | ||
| 45 | end | ||
| 27 | end | 46 | end |
| 28 | 47 | ||
| 29 | local patch = require("luarocks.tools.patch") | 48 | local patch = require("luarocks.tools.patch") |
