Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Verible LSP to CentOS #471

Merged
merged 8 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lua/mason-core/platform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
42 changes: 30 additions & 12 deletions lua/mason-registry/verible/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down