From 18f828696b79b6dedaa5ae6543a780d104e290f0 Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Thu, 11 Mar 2021 15:49:04 +0100 Subject: [PATCH 1/5] Update available versions --- bin/luaenv-luarocks | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/luaenv-luarocks b/bin/luaenv-luarocks index 3b4a18a..fd24282 100755 --- a/bin/luaenv-luarocks +++ b/bin/luaenv-luarocks @@ -104,7 +104,13 @@ local function known_versions() return t end - return hash({ '2.4.3', '2.4.3', '2.4.1', '2.4.0', '2.3.0', '2.2.2', '2.2.1', '2.2.0' }) + return hash({ + '3.5.0', '3.4.0', '3.3.1', '3.3.0', '3.2.1', '3.2.0', '3.1.3', '3.1.2', + '3.1.1', '3.1.0', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0.0' + '2.4.4', '2.4.3', '2.4.2', '2.4.1', '2.4.0', '2.3.0', '2.2.2', '2.2.1', + '2.2.0', '2.1.2', '2.1.1', '2.0.13', '2.1.0', '2.0.12', '2.0.11', '2.0.10', + '2.0.8', '2.0.7', '2.0.6', '2.0.5', '2.0.4.1', '2.0.4', '2.0.3', '2.0.2' + }) end From 338d1beddf3e8c077b5334e7f78bcae53f8b3c60 Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Thu, 11 Mar 2021 15:50:04 +0100 Subject: [PATCH 2/5] Fix missing comma --- bin/luaenv-luarocks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/luaenv-luarocks b/bin/luaenv-luarocks index fd24282..ee36782 100755 --- a/bin/luaenv-luarocks +++ b/bin/luaenv-luarocks @@ -106,7 +106,7 @@ local function known_versions() return hash({ '3.5.0', '3.4.0', '3.3.1', '3.3.0', '3.2.1', '3.2.0', '3.1.3', '3.1.2', - '3.1.1', '3.1.0', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0.0' + '3.1.1', '3.1.0', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0.0', '2.4.4', '2.4.3', '2.4.2', '2.4.1', '2.4.0', '2.3.0', '2.2.2', '2.2.1', '2.2.0', '2.1.2', '2.1.1', '2.0.13', '2.1.0', '2.0.12', '2.0.11', '2.0.10', '2.0.8', '2.0.7', '2.0.6', '2.0.5', '2.0.4.1', '2.0.4', '2.0.3', '2.0.2' From 75f5bc96b2925dd0e57cbb06f092b3e09379d3bc Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Sun, 24 Oct 2021 02:56:15 +0200 Subject: [PATCH 3/5] Add new luarocks versions --- bin/luaenv-luarocks | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/luaenv-luarocks b/bin/luaenv-luarocks index ee36782..4670e3d 100755 --- a/bin/luaenv-luarocks +++ b/bin/luaenv-luarocks @@ -105,6 +105,7 @@ local function known_versions() end return hash({ + '3.7.0', '3.6.0', '3.5.0', '3.4.0', '3.3.1', '3.3.0', '3.2.1', '3.2.0', '3.1.3', '3.1.2', '3.1.1', '3.1.0', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0.0', '2.4.4', '2.4.3', '2.4.2', '2.4.1', '2.4.0', '2.3.0', '2.2.2', '2.2.1', From 44840a5b45f5b3a23befa0a7467db3f114eabd6e Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Sun, 24 Oct 2021 03:04:42 +0200 Subject: [PATCH 4/5] Update download URL for source packages --- bin/luaenv-luarocks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/luaenv-luarocks b/bin/luaenv-luarocks index 4670e3d..723f019 100755 --- a/bin/luaenv-luarocks +++ b/bin/luaenv-luarocks @@ -139,7 +139,7 @@ Install specified version of LuaRocks for your Lua installtion in luaenv. end local function tarball_url_for_version(version) - return ('https://github.com/luarocks/luarocks/archive/v%s.tar.gz'):format(version) + return ('https://luarocks.github.io/luarocks/releases/luarocks-%s.tar.gz'):format(version) end local function source_dir_for_version(version) From faf13fdb9fee0a57f9610a78f8fdc3736e5b37d7 Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Sun, 24 Oct 2021 03:20:30 +0200 Subject: [PATCH 5/5] Add version reading from website back Add back the code to read available versions from the luarocks website. Default to a hardcoded list of versions if the online list cannot be retrieved (as before). --- bin/luaenv-luarocks | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/bin/luaenv-luarocks b/bin/luaenv-luarocks index 723f019..256ecbe 100755 --- a/bin/luaenv-luarocks +++ b/bin/luaenv-luarocks @@ -104,14 +104,29 @@ local function known_versions() return t end - return hash({ + local releases = vars.CACHE .. '/releases' + sh.download('https://luarocks.github.io/luarocks/releases/', releases) + local f = io.open(releases, 'r') + if not f then + return hash({ '3.7.0', '3.6.0', '3.5.0', '3.4.0', '3.3.1', '3.3.0', '3.2.1', '3.2.0', '3.1.3', '3.1.2', - '3.1.1', '3.1.0', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0.0', - '2.4.4', '2.4.3', '2.4.2', '2.4.1', '2.4.0', '2.3.0', '2.2.2', '2.2.1', - '2.2.0', '2.1.2', '2.1.1', '2.0.13', '2.1.0', '2.0.12', '2.0.11', '2.0.10', - '2.0.8', '2.0.7', '2.0.6', '2.0.5', '2.0.4.1', '2.0.4', '2.0.3', '2.0.2' - }) + '3.1.1', '3.1.0', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0.0', '2.4.4', + '2.4.3', '2.4.2', '2.4.1', '2.4.0', '2.3.0', '2.2.2', '2.2.1', '2.2.0' + }) + end + + local s = f:read('*a') + f:close() + local versions = {} + for v, major, minor in s:gmatch('"luarocks%-((%d+)%.(%d+)%.?%d*)%.tar%.gz"') do + major, minor = tonumber(major), tonumber(minor) + -- requires luarocks >= 2.2.0, because we use --with-lua-bin in configure + if major < 2 or (major == 2 and minor < 2) then break end + versions[#versions + 1] = v + end + + return hash(versions) end