diff options
| author | Renato Maia <maia.renato@gmail.com> | 2025-04-27 17:03:33 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2025-05-19 11:30:51 -0300 |
| commit | 3b7bf479568790a8b04772a36c1b3e712fed4579 (patch) | |
| tree | 01b97d4dacb07ee45082b23bb9c664013f41655e /src | |
| parent | 4d7b546602b906f924ac91a01276cd3b2569ca9f (diff) | |
| download | luarocks-3b7bf479568790a8b04772a36c1b3e712fed4579.tar.gz luarocks-3b7bf479568790a8b04772a36c1b3e712fed4579.tar.bz2 luarocks-3b7bf479568790a8b04772a36c1b3e712fed4579.zip | |
feat: add build vars. for rockspecs with the dir. of its deps.
Rockspecs can access the directory of its dependencies using variables
in the format 'foo_ROCKDIR' where 'foo' is the name of a dependency.
This is used to be able to access files of the rock like 'conf', 'docs'
and more.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/deps.lua | 9 | ||||
| -rw-r--r-- | src/luarocks/deps.tl | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 19cf6936..5802601e 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
| @@ -329,9 +329,12 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock | |||
| 329 | util.printout(("%s %s depends on %s (%s)"):format( | 329 | util.printout(("%s %s depends on %s (%s)"):format( |
| 330 | name, version, tostring(depq), (rock_status(depq, get_versions)))) | 330 | name, version, tostring(depq), (rock_status(depq, get_versions)))) |
| 331 | 331 | ||
| 332 | local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) | 332 | local okfulfill, version_or_err, tree = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) |
| 333 | if okfulfill then | 333 | if okfulfill then |
| 334 | deplocks.add(depskey, depq.name, found_or_err) | 334 | deplocks.add(depskey, depq.name, version_or_err) |
| 335 | if tree and rockspec:format_is_at_least("3.1") then | ||
| 336 | rockspec.variables[depq.name:upper() .. "_ROCKDIR"] = path.install_dir(depq.name, version_or_err, tree) | ||
| 337 | end | ||
| 335 | else | 338 | else |
| 336 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then | 339 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then |
| 337 | util.printerr("This version of " .. name .. " is designed for use with") | 340 | util.printerr("This version of " .. name .. " is designed for use with") |
| @@ -341,7 +344,7 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock | |||
| 341 | util.printerr("or look for a suitable version of " .. name .. " with") | 344 | util.printerr("or look for a suitable version of " .. name .. " with") |
| 342 | util.printerr(" luarocks search " .. name) | 345 | util.printerr(" luarocks search " .. name) |
| 343 | end | 346 | end |
| 344 | return nil, found_or_err | 347 | return nil, version_or_err |
| 345 | end | 348 | end |
| 346 | end | 349 | end |
| 347 | 350 | ||
diff --git a/src/luarocks/deps.tl b/src/luarocks/deps.tl index f6a6642f..d127288e 100644 --- a/src/luarocks/deps.tl +++ b/src/luarocks/deps.tl | |||
| @@ -329,9 +329,12 @@ function deps.fulfill_dependencies(rockspec: Rockspec, depskey: DepsKey, deps_mo | |||
| 329 | util.printout(("%s %s depends on %s (%s)"):format( | 329 | util.printout(("%s %s depends on %s (%s)"):format( |
| 330 | name, version, tostring(depq), (rock_status(depq, get_versions)))) | 330 | name, version, tostring(depq), (rock_status(depq, get_versions)))) |
| 331 | 331 | ||
| 332 | local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) | 332 | local okfulfill, version_or_err, tree = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) |
| 333 | if okfulfill then | 333 | if okfulfill then |
| 334 | deplocks.add(depskey, depq.name, found_or_err) | 334 | deplocks.add(depskey, depq.name, version_or_err) |
| 335 | if tree and rockspec:format_is_at_least("3.1") then | ||
| 336 | rockspec.variables[depq.name:upper() .. "_ROCKDIR"] = path.install_dir(depq.name, version_or_err, tree) | ||
| 337 | end | ||
| 335 | else | 338 | else |
| 336 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then | 339 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then |
| 337 | util.printerr("This version of "..name.." is designed for use with") | 340 | util.printerr("This version of "..name.." is designed for use with") |
| @@ -341,7 +344,7 @@ function deps.fulfill_dependencies(rockspec: Rockspec, depskey: DepsKey, deps_mo | |||
| 341 | util.printerr("or look for a suitable version of "..name.." with") | 344 | util.printerr("or look for a suitable version of "..name.." with") |
| 342 | util.printerr(" luarocks search "..name) | 345 | util.printerr(" luarocks search "..name) |
| 343 | end | 346 | end |
| 344 | return nil, found_or_err | 347 | return nil, version_or_err |
| 345 | end | 348 | end |
| 346 | end | 349 | end |
| 347 | 350 | ||
