From 46d03df798de2dc8f124bb9869aa50302e7b1a8b Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 24 Aug 2022 15:17:42 +0300 Subject: [PATCH] chore(build): Refactor rockspec to dodge luarocks 3.1.3 bug Setting source.branch works for most cases, but when the branch is actually a tag and not a branch then a Luarocks 3.1.3 bug rears and tries to concatenate a nil. This dodges that bullet by setting source.tag explicitly to not trigger the branch_or_tag concatenation. All the other changes are cosmetic and for readability/maintainability. --- penlight-dev-1.rockspec | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/penlight-dev-1.rockspec b/penlight-dev-1.rockspec index 5b00e113..b572ab7a 100644 --- a/penlight-dev-1.rockspec +++ b/penlight-dev-1.rockspec @@ -1,18 +1,15 @@ -local package_name = "penlight" -local package_version = "dev" -local rockspec_revision = "1" -local github_account_name = "lunarmodules" -local github_repo_name = package_name -local git_checkout = package_version == "dev" and "master" or package_version - +package = "penlight" +local rock_version = "dev" +local rock_release = "1" +local namespace = "lunarmodules" rockspec_format = "3.0" -package = package_name -version = package_version .. "-" .. rockspec_revision +version = ("%s-%s"):format(rock_version, rock_release) source = { - url = "git+https://github.com/"..github_account_name.."/"..github_repo_name..".git", - branch = git_checkout + url = ("git+https://github.com/%s/%s.git"):format(namespace, package), + branch = rock_version == "dev" and "master" or nil, + tag = rock_version ~= "dev" and rock_version or nil, } description = { @@ -24,8 +21,8 @@ description = { Much of the functionality is inspired by the Python standard libraries. ]], license = "MIT/X11", - homepage = "https://"..github_account_name..".github.io/"..github_repo_name, - issues_url = "https://github.com/"..github_account_name.."/"..github_repo_name.."/issues", + homepage = ("https://%s.github.io/%s"):format(namespace, package), + issues_url = ("https://github.com/%s/%s/issues"):format(namespace, package), maintainer = "thijs@thijsschreijer.nl", }