Skip to content

Commit

Permalink
chore(build): Refactor rockspec to dodge luarocks 3.1.3 bug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alerque committed Aug 26, 2022
1 parent 86f0379 commit 189393c
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions penlight-dev-1.rockspec
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
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"
local repository = package

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, repository),
branch = rock_version == "dev" and "master" or nil,
tag = rock_version ~= "dev" and rock_version or nil,
}

description = {
Expand All @@ -24,8 +22,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, repository),
issues_url = ("https://github.com/%s/%s/issues"):format(namespace, repository),
maintainer = "[email protected]",
}

Expand Down

0 comments on commit 189393c

Please sign in to comment.