diff options
Diffstat (limited to 'src/luarocks/deps.lua')
-rw-r--r-- | src/luarocks/deps.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 0e3265b5..f6c86d1c 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -159,6 +159,15 @@ function deps.compare_versions(a, b) | |||
159 | return deps.parse_version(a) > deps.parse_version(b) | 159 | return deps.parse_version(a) > deps.parse_version(b) |
160 | end | 160 | end |
161 | 161 | ||
162 | --- Check if rockspec format version satisfies version requirement. | ||
163 | -- @param rockspec table: The rockspec table. | ||
164 | -- @param version string: required version. | ||
165 | -- @return boolean: true if rockspec format matches version or is newer, false otherwise. | ||
166 | function deps.format_is_at_least(rockspec, version) | ||
167 | local rockspec_format = rockspec.rockspec_format or "1.0" | ||
168 | return deps.parse_version(rockspec_format) >= deps.parse_version(version) | ||
169 | end | ||
170 | |||
162 | --- Consumes a constraint from a string, converting it to table format. | 171 | --- Consumes a constraint from a string, converting it to table format. |
163 | -- For example, a string ">= 1.0, > 2.0" is converted to a table in the | 172 | -- For example, a string ">= 1.0, > 2.0" is converted to a table in the |
164 | -- format {op = ">=", version={1,0}} and the rest, "> 2.0", is returned | 173 | -- format {op = ">=", version={1,0}} and the rest, "> 2.0", is returned |