rocks.nvim icon indicating copy to clipboard operation
rocks.nvim copied to clipboard

feat: lockfile support

Open mrcjkb opened this issue 2 years ago • 10 comments

Closes #34.

The documentation says luarocks will use a lockfile if there is one in the cwd. But I haven't confirmed this yet.

This needs some vigorous testing.

How it works

Adding/updating/removing rocks:

  • We add a --pin flag to the install command
  • luarocks creates a luarocks.lock file in the rock's install tree (for all transitive dependencies of the installed rock)
  • We add the path to the rtp
  • We load the lockfile and use it to update our rocks-lock.toml

Syncing rocks:

  • We get the locked dependencies from our rocks-lock.toml
  • We use those to create a luarocks.lock in a temp directory
  • We set the cwd to the location of the lock file for any install commands

mrcjkb avatar Apr 05 '24 01:04 mrcjkb

Review Checklist

Does this PR follow the Contribution Guidelines? Following is a partial checklist:

Proper conventional commit scoping:

  • For example, fix(installer): some installer bugfix

  • [x] Pull request title has the appropriate conventional commit prefix.

If applicable:

  • [x] Tested
    • [x] Tests have been added.
    • [x] Tested manually (steps in PR description).
  • [x] Updated documentation.

github-actions[bot] avatar Apr 05 '24 01:04 github-actions[bot]

:thinking: maybe we should just call the file rocks.lock instead of rocks-lock.toml.

mrcjkb avatar Apr 05 '24 01:04 mrcjkb

I just can't get the test cases to succeed (╯°□°)╯︵ ┻━┻

It looks like it could be something to do with the neovim scheduler? Not sure how to get busted working with that.

mrcjkb avatar Apr 05 '24 10:04 mrcjkb

~This PR is pretty much ready. But I would like to merge #245 first.~

mrcjkb avatar Apr 07 '24 00:04 mrcjkb

Todo:

  • [x] Update the new sync_spec.lua to install a package that has a locked dependency, and confirm that the locked dependency is indeed installed.

mrcjkb avatar Apr 07 '24 21:04 mrcjkb

Looks like luarocks is ignoring the luarocks.lock file in the install cwd.

mrcjkb avatar Apr 07 '24 22:04 mrcjkb

Blocked by https://github.com/luarocks/luarocks/issues/1662

mrcjkb avatar Apr 08 '24 16:04 mrcjkb

Looks like https://github.com/luarocks/luarocks/issues/1662 has been fixed, so this is now unblocked

purepani avatar Jun 11 '24 14:06 purepani

Looks like luarocks/luarocks#1662 has been fixed, so this is now unblocked

We're going to have to wait for luarocks 3.11.1 to land in nixpkgs.

mrcjkb avatar Jun 11 '24 21:06 mrcjkb

Well... it looks like luarocks 3.11.1 is still not picking up the lockfile when installing :disappointed:

  • https://github.com/luarocks/luarocks/pull/1693

mrcjkb avatar Jul 07 '24 18:07 mrcjkb