diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/mason-core/platform.lua | 13 | ||||
| -rw-r--r-- | lua/mason-registry/verible/init.lua | 42 |
2 files changed, 42 insertions, 13 deletions
diff --git a/lua/mason-core/platform.lua b/lua/mason-core/platform.lua index f1a25666..848e7af1 100644 --- a/lua/mason-core/platform.lua +++ b/lua/mason-core/platform.lua @@ -147,9 +147,20 @@ M.os_distribution = _.lazy(function() version_id = version_id, version = { major = major, minor = minor }, } + elseif entries.ID == '"centos"' then + -- Parses the CentOS VERSION_ID into a major version (the only thing available). + local version_id = entries.VERSION_ID:gsub([["]], "") + local major = tonumber(version_id) + + return { + id = "centos", + version_id = version_id, + version = { major = major }, + } else return { id = "linux-generic", + version = {}, } end end @@ -163,7 +174,7 @@ M.os_distribution = _.lazy(function() return parse_linux_dist(result.stdout) end) :recover(function() - return { id = "linux-generic" } + return { id = "linux-generic", version = {} } end) :get_or_throw() end, diff --git a/lua/mason-registry/verible/init.lua b/lua/mason-registry/verible/init.lua index 3303b709..765cf19f 100644 --- a/lua/mason-registry/verible/init.lua +++ b/lua/mason-registry/verible/init.lua @@ -21,20 +21,38 @@ return Pkg.new { local os_dist = platform.os_distribution() local source = github.untarxz_release_file { repo = repo, - asset_file = function(release) - if os_dist.id == "ubuntu" then - local target_file = when( - platform.arch == "x64", - coalesce( - when(os_dist.version.major == 16, "verible-%s-Ubuntu-16.04-xenial-x86_64.tar.gz"), - when(os_dist.version.major == 18, "verible-%s-Ubuntu-18.04-bionic-x86_64.tar.gz"), - when(os_dist.version.major == 20, "verible-%s-Ubuntu-20.04-focal-x86_64.tar.gz"), - when(os_dist.version.major == 22, "verible-%s-Ubuntu-22.04-jammy-x86_64.tar.gz") + asset_file = coalesce( + when( + os_dist.id == "ubuntu" and platform.arch == "x64", + coalesce( + when( + os_dist.version.major == 16, + _.format "verible-%s-Ubuntu-16.04-xenial-x86_64.tar.gz" + ), + when( + os_dist.version.major == 18, + _.format "verible-%s-Ubuntu-18.04-bionic-x86_64.tar.gz" + ), + when( + os_dist.version.major == 20, + _.format "verible-%s-Ubuntu-20.04-focal-x86_64.tar.gz" + ), + when( + os_dist.version.major == 22, + _.format "verible-%s-Ubuntu-22.04-jammy-x86_64.tar.gz" ) ) - return target_file and target_file:format(release) - end - end, + ), + when( + os_dist.id == "centos" and platform.arch == "x64", + coalesce( + when( + os_dist.version.major == 7, + _.format "verible-%s-CentOS-7.9.2009-Core-x86_64.tar.gz" + ) + ) + ) + ), } source.with_receipt() ctx.fs:rename(("verible-%s"):format(source.release), "verible") |
