lua-luafilesystem: update source URL and improve rockspec detection (#36692)

* lua-luafilesystem: updated sources to new URL. Changed versioning to dot-separated versions.

* lua-luafilesystem: override install phase to find correct rockspec

* lua-luafilesystem: improved rockspec detection

* lua-luafilesystem: added lua version constraint for older versions
This commit is contained in:
Sean Koyama 2023-06-01 18:15:42 -05:00 committed by GitHub
parent a44fde9dc9
commit d90e4fcc3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,9 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import spack.build_systems.lua
from spack.package import *
@ -16,9 +19,28 @@ class LuaLuafilesystem(LuaPackage):
LuaFileSystem is free software and uses the same license as Lua 5.1
"""
homepage = "http://keplerproject.github.io/luafilesystem"
url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_3.tar.gz"
homepage = "https://lunarmodules.github.io/luafilesystem/"
version("1_8_0", sha256="16d17c788b8093f2047325343f5e9b74cccb1ea96001e45914a58bbae8932495")
version("1_7_0_2", sha256="23b4883aeb4fb90b2d0f338659f33a631f9df7a7e67c54115775a77d4ac3cc59")
version("1_6_3", sha256="11c7b1fc2e560c0a521246b84e6257138d97dddde5a19e405714dbabcb9436ca")
def url_for_version(self, version):
url = "https://github.com/lunarmodules/luafilesystem/archive/refs/tags/v{0}.tar.gz"
return url.format(version.underscored)
version("1.8.0", sha256="16d17c788b8093f2047325343f5e9b74cccb1ea96001e45914a58bbae8932495")
version("1.7.0-2", sha256="23b4883aeb4fb90b2d0f338659f33a631f9df7a7e67c54115775a77d4ac3cc59")
version("1.6.3", sha256="11c7b1fc2e560c0a521246b84e6257138d97dddde5a19e405714dbabcb9436ca")
depends_on("lua-lang@:5.3", when="@:1.7")
class LuaBuilder(spack.build_systems.lua.LuaBuilder):
def install(self, pkg, spec, prefix):
rocks_args = self.luarocks_args()
if spec.satisfies("@:1.7.0-2"):
rock = "rockspecs/luafilesystem-{0}.rockspec".format(self.spec.version)
if not os.path.isfile(rock):
rock = "rockspecs/luafilesystem-{0}-1.rockspec".format(self.spec.version)
if not os.path.isfile(rock):
# fall back on default luarocks behavior for finding rockspec
rock = ""
rocks_args.append(rock)
self.pkg.luarocks("--tree=" + prefix, "make", *rocks_args)