Feature request: Support Luarocks with a new package manager #33945
kikito
started this conversation in
Suggest an Idea
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tell us more.
New package manager questionnaire
Did you read our documentation on adding a package manager?
Basics
What's the name of the package manager?
Luarocks
What language(s) does this package manager support?
Lua
How popular is this package manager?
It's the most popular package manager for the Language. Number 1
Does this language have other (competing?) package managers?
What are the big selling points for this package manager?
It is the only one for Lua
Detecting package files
What kind of package files, and names, does this package manager use?
The package files are called "rocks". They usually have the ".rockspec" extension and are usually named like the "package/project" that they correspond to. The filename will often also contain a version number.
Example: https://github.com/kikito/inspect.lua/blob/master/rockspecs/inspect-3.1.3-0.rockspec
They are usually in the root folder, sometimes inside a folder called "rockspecs". The folder can have more than one rockspec inside, in which case the one with the most recent version number is the most recent one. The version number is similar to semver, with one addition - the "prerelease" field is used to denote "versioning of the luarock file itself". (see
"version" in https://github.com/luarocks/luarocks/wiki/Rockspec-format)
Which
fileMatch
pattern(s) should Renovate use?"fileMatch": ["(.+).rockspec$", "rockspecs/(.+).rockspec$"],
Do many users need to extend the
fileMatch
pattern for custom file names?Is the
fileMatch
pattern going to get many "false hits" for files that have nothing to do with package management?No, but it might hit older versions of the rockspec as well as the most recent one. Usually only the most recent one is relevant for dependency management.
Parsing and Extraction
Can package files have "local" links to each other that need to be resolved?
No
Package file parsing method
The package files should be:
(Only one package file needs to be parse)
Which format/syntax does the package file use?
The rockspec file is written in Lua itself, so you actually need a Lua parser in order to read it properly. The result of evaluating the file in Lua should put several Lua tables in the global namespace, for example
rockspec_format
should be a string. The full list of fields is available here: https://github.com/luarocks/luarocks/wiki/Rockspec-formatHow should we parse the package files?
The ideal way to parse rockspec files is by using Lua itself, but there's many different versions of Lua (and LuaJIT) and exactly how to do it changes from version to version. Here's a lua file which should be able to convert any rockspec given to a json file, using any version of Lua/LuaJIT. From there it is possible to export it however is convenient. On the following example we are using the
cjson
library to encode the resulting table. If cjson isn't available, we could justprint
a bunch of stuff.Usage:
lua rockparse.lua inspect-3.1.3-0.rockspec
Output:
Does the package file have different "types" of dependencies?
List all the sources/syntaxes of dependencies that can be extracted
Copy-paste from https://github.com/luarocks/luarocks/wiki/Rockspec-format#dependency-information :
{"lfs >= 1.0, < 2.0"}
. Accepted operators are the relational operators of Lua:==
~=
<
>
<=
>=
, as well as a special operator,~>
, inspired by the "pessimistic operator" of RubyGems ("~> 2"
means">= 2, < 3"
;"~> 2.4"
means">= 2.4, < 2.5"
). The absence of an operator means an implicit==
(i.e.,"lfs 1.0"
is the same as"lfs == 1.0"
). "lua" is an special dependency name; it matches not a rock, but the version of Lua in use. Supports per-platform overrides..<platform>.rock
) or pure-Lua (.all.rock
) rocks. Each string represents a package this rock depends on at build time, containing a package name followed by a comma-separated list of constraints. The syntax in the same as thedependencies
field. Supports per-platform overrides.{ EXPAT = { header = "expat.h" } }
-- on Unix, this will check that EXPAT_DIR/include/expat.h exists and will create variables accordingly. You can also use platform overrides or specify files of external dependencies in a platform-agnostic manner. Supports per-platform overrides.luarocks test
. Each string represents a package this rock depends on at test time, containing a package name followed by a comma-separated list of constraints. The syntax in the same as thedependencies
field. Supports per-platform overrides.Describe which types of dependencies above are supported and which will be implemented in future
I don't understand the question. I have not implemented anything.
Versioning
What versioning scheme does the package file(s) use?
The version number can be assumed to be Semver. As mentioned above, luarocks itself uses an extra number for the rare case where a luarock was uploaded but it was incorrect and needed modifications.
Does this versioning scheme support range constraints, like
^1.0.0
or1.x
?^1.0.0
or1.x
), provide details.Lookup
Is a new datasource required?
The datasource would be the luarocks server/API: https://luarocks.org/
Will users want (or need to) set a custom host or custom registry for Renovate's lookup?
Unsure of what "custom host or custom registry" means. It is possible to configure private luarocks repos, which should be compatible with luarocks.org's API.
Where can Renovate find the custom host/registry?
Are there any constraints in the package files that Renovate should use in the lookup procedure?
v3.x
), provide details.When multiple package files are found, the one with the most recent version should be used.
Will users need the ability to configure language or other constraints using Renovate config?
Artifacts
Does the package manager use a lock file or checksum file?
Is the locksum or checksum mandatory?
If lockfiles or checksums are used: what tool and exact commands should Renovate use to update one (or more) package versions in a dependency file?
Package manager cache
Does the package manager use a cache?
If the package manager uses a cache, how can Renovate control the cache?
Should Renovate keep a cache?
Generating a lockfile from scratch
Renovate can perform "lock file maintenance" by getting the package manager to generate a lockfile from scratch.
Can the package manager generate a lockfile from scratch?
Other
What else should we know about this package manager?
Main websites/reference:
Beta Was this translation helpful? Give feedback.
All reactions