From 387a03e1d3fd622dde78b2e4e66abb109f7c40cd Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 7 Oct 2020 22:54:12 +0200
Subject: core.modulemanager: Add compat for LuaRocks 2.x

---
 core/modulemanager.lua | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index ea5a1324..b89c82d7 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -206,6 +206,13 @@ local function do_load_module(host, module_name, state)
 		local luarocks_path = custom_plugins.."/lib/luarocks/rocks-"..lua_version;
 		local manifest_filename = luarocks_path.."/manifest";
 		local load_manifest, err = envload.envloadfile(manifest_filename, manifest);
+		if not load_manifest then
+			-- COMPAT Luarocks 2.x
+			log("debug", "Could not load LuaRocks 3.x manifest, trying 2.x", err);
+			luarocks_path = custom_plugins.."/lib/luarocks/rocks-"..lua_version;
+			manifest_filename = luarocks_path.."/manifest";
+			load_manifest, err = envload.envloadfile(manifest_filename, manifest);
+		end
 		if not load_manifest then
 			log("error", "Could not load manifest of installed plugins: %s", err, load_manifest);
 		else
-- 
cgit v1.2.3