diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2022-04-16 18:25:14 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2022-04-16 18:25:14 -0300 |
commit | a405d1a5f6c9eb7249a9271ca23ff1f701f91cfe (patch) | |
tree | 7552ad663ebe0f7a14de8e5b92daa74d0799276a | |
parent | bcdeb6f411c8f62fa7c2c1546bf600e516448590 (diff) | |
download | luarocks-a405d1a5f6c9eb7249a9271ca23ff1f701f91cfe.tar.gz luarocks-a405d1a5f6c9eb7249a9271ca23ff1f701f91cfe.tar.bz2 luarocks-a405d1a5f6c9eb7249a9271ca23ff1f701f91cfe.zip |
deps: be more lenient in library version check
-rw-r--r-- | src/luarocks/deps.lua | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 25905ae3..0ea105f9 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -742,22 +742,32 @@ function deps.check_lua_libdir(vars) | |||
742 | local save_LUA_INCDIR = vars.LUA_INCDIR | 742 | local save_LUA_INCDIR = vars.LUA_INCDIR |
743 | local ok = check_external_dependency("LUA", { library = libnames }, vars, "build", cache) | 743 | local ok = check_external_dependency("LUA", { library = libnames }, vars, "build", cache) |
744 | vars.LUA_INCDIR = save_LUA_INCDIR | 744 | vars.LUA_INCDIR = save_LUA_INCDIR |
745 | local err | ||
745 | if ok then | 746 | if ok then |
746 | local filename = dir.path(vars.LUA_LIBDIR, vars.LUA_LIBDIR_FILE) | 747 | local filename = dir.path(vars.LUA_LIBDIR, vars.LUA_LIBDIR_FILE) |
747 | local fd = io.open(filename, "r") | 748 | local fd = io.open(filename, "r") |
748 | if fd then | 749 | if fd then |
749 | local txt = fd:read("*a") | 750 | if not vars.LUA_LIBDIR_FILE:match((cfg.lua_version:gsub("%.", "%%.?"))) then |
750 | fd:close() | 751 | -- if filename isn't versioned, check file contents |
751 | if txt:match("Lua " .. cfg.lua_version, 1, true) then | 752 | local txt = fd:read("*a") |
752 | vars.LUALIB = vars.LUA_LIBDIR_FILE | 753 | ok = txt:match("Lua " .. cfg.lua_version, 1, true) |
753 | return true | 754 | or txt:match("lua" .. (cfg.lua_version:gsub("%.", "")), 1, true) |
754 | else | 755 | if not ok then |
755 | return nil, "Lua library at " .. filename .. " does not match Lua version " .. cfg.lua_version .. ". You may want to override this by configuring LUA_INCDIR.", "dependency" | 756 | err = "Lua library at " .. filename .. " does not match Lua version " .. cfg.lua_version .. ". You may want to override this by configuring LUA_INCDIR." |
757 | end | ||
756 | end | 758 | end |
759 | |||
760 | fd:close() | ||
757 | end | 761 | end |
762 | end | ||
763 | |||
764 | if ok then | ||
765 | vars.LUALIB = vars.LUA_LIBDIR_FILE | ||
758 | return true | 766 | return true |
767 | else | ||
768 | err = err or "Failed finding Lua library. You may need to configure LUA_LIBDIR." | ||
769 | return nil, err, "dependency" | ||
759 | end | 770 | end |
760 | return nil, "Failed finding Lua library. You may need to configure LUA_LIBDIR.", "dependency" | ||
761 | end | 771 | end |
762 | 772 | ||
763 | function deps.get_deps_mode(args) | 773 | function deps.get_deps_mode(args) |