Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prune command doesn't seem to work for rocks-git.nvim packages #34

Closed
simifalaye opened this issue Jun 21, 2024 · 13 comments · Fixed by nvim-neorocks/rocks.nvim#400 or nvim-neorocks/rocks.nvim#451
Assignees
Labels
bug Something isn't working

Comments

@simifalaye
Copy link

Versions:

  • rocks.nvim = "2.31.3"
  • rocks-git.nvim = "1.5.1"

I can successfully run the "update", "edit", "sync", and "install" commands for git packages but running the "prune" command (:Rocks prune tummetott/unimpaired.nvim) yields this error:

[START][2024-06-20 20:12:21] rocks.nvim logging initiated
ERROR | 2024-06-20 20:12:26 | ....local/share/nvim/rocks/rocks_rtp/lua/rocks/luarocks.lua:64 | luarocks CLI FAILED
ERROR | 2024-06-20 20:12:26 | ....local/share/nvim/rocks/rocks_rtp/lua/rocks/luarocks.lua:65 | 
Error: cannot find package tummetott/unimpaired.nvim
Use 'list' to find installed rocks.

ERROR | 2024-06-20 20:12:26 | ...er/.local/share/nvim/rocks/rocks_rtp/lua/rocks/state.lua:106 | Could not get dependencies for rock tummetott/unimpaired.nvim: 
Error: cannot find package tummetott/unimpaired.nvim
Use 'list' to find installed rocks.

ERROR | 2024-06-20 20:12:26 | ...er/.local/share/nvim/rocks/rocks_rtp/lua/rocks/state.lua:115 | ...er/.local/share/nvim/rocks/share/lua/5.1/nio/control.lua:145: Could not get dependencies for rock tummetott/unimpaired.nvim: 
Error: cannot find package tummetott/unimpaired.nvim
Use 'list' to find installed rocks.

ERROR | 2024-06-20 20:12:26 | ....local/share/nvim/rocks/rocks_rtp/lua/rocks/luarocks.lua:64 | luarocks CLI FAILED
ERROR | 2024-06-20 20:12:26 | ....local/share/nvim/rocks/rocks_rtp/lua/rocks/luarocks.lua:65 | 
Error: Could not find rock 'tummetott/unimpaired.nvim' in /home/user/.local/share/nvim/rocks

ERROR | 2024-06-20 20:12:30 | ...share/nvim/rocks/rocks_rtp/lua/rocks/operations/init.lua:682 | Prune completed with errors! Run ':Rocks log' for details.

It seems it's trying to prune it as a luarocks package and not as a rocks-git package.

NOTE: I put some output logs on the rocks-git "prune" callback handler (rocks_git.get_prune_callback) and it seems that the prune callback isn't being called whereas the other handlers are being called when you run the "Rocks " action.

NOTE: If you run the prune command just using the repo name (no owner, ex. "unimpaired.nvim"), it removes the plugin spec from the rocks.toml file (I assume this is a final prune handler) but the repo still exists in the rocks-git rtp. You can then just run :Rocks sync after and that works but the prune command should work on its own with the owner/repo name.

@mrcjkb mrcjkb self-assigned this Jun 21, 2024
@mrcjkb mrcjkb added the bug Something isn't working label Jun 21, 2024
@mrcjkb
Copy link
Member

mrcjkb commented Jun 21, 2024

Hey 👋

Thanks for the detailed report 🙏

@mrcjkb
Copy link
Member

mrcjkb commented Jun 21, 2024

If you run the prune command just using the repo name (no owner, ex. "unimpaired.nvim")

This is the intended interface. The tab completions should show you which packages can be pruned.

@simifalaye
Copy link
Author

This is the intended interface

I was rather pointing that there is a workaround for now to get pruning of rocks-git packages to work (without just manually removing the repo directory from the nvim data path). Though this works (prune just the repo name which removes it from the config and then sync), I think that you should be able to prune the entire rocks-git package in one command.

@mrcjkb
Copy link
Member

mrcjkb commented Jun 21, 2024

I think that you should be able to prune the entire rocks-git package in one command.

That's what nvim-neorocks/rocks.nvim#400 will fix 😄

What I was referring to by "this is the intended interface" is the fact that you have to pass in the rock name to prune, not the git URL.

@simifalaye
Copy link
Author

simifalaye commented Jun 25, 2024

@mrcjkb Are you sure this is fixed? Just updated rocks.nvim version to 2.32.0 and when I run the prune owner/repo command, I get a notification saying that the prune completed BUT the git repo still exists in <stddatapath>/site/pack/rocks/start/<repo> and in my rocks.toml

@mrcjkb
Copy link
Member

mrcjkb commented Jun 25, 2024

Yep. Rocks prune doesn't take an owner/repo argument. You have to pass in the rock name.

But I've just realised the command completions don't work for rocks that are managed by external modules (like rocks-git and rocks-dev).

@mrcjkb
Copy link
Member

mrcjkb commented Jun 25, 2024

@simifalaye
Copy link
Author

Few notes:

  • The rocks-git README.md says all the sub-commands take the plugin short name "owner/repo" so this is what I would expect to use when removing a rocks-git package. I think for consistency, it would be better to have it work this way because it is clear when you are installing or pruning a rocks-git repo vs a luarocks package but if there are technical limitations, then I think the readme should clarify that the "owner/repo" short name does not apply to the prune command.
  • I did already try just the repo name and it didn't work to remove the git repo from the runtimepath UNTIL I ran it a second time. In my testing (maybe I have something setup incorrectly), I need to run :Rocks prune twice for the rocks-git package to actually get pruned.

@mrcjkb
Copy link
Member

mrcjkb commented Jun 25, 2024

The rocks-git README.md says all the sub-commands take the plugin short name "owner/repo" so this is what I would expect to use when removing a rocks-git package.

This is what the rocks-git readme says:

You can use the same :Rocks {install|update|sync|prune} commands as you would use to install rocks with rocks.nvim.

The only difference is the :Rocks install {plugin} {args?} command.

I did already try just the repo name and it didn't work to remove the git repo from the runtimepath UNTIL I ran it a second time.

rocks-git doesn't remove plugins from the rtp after pruning. It just deletes the repo from the file path so that it doesn't get added to the runtimepath on the next start.

@simifalaye
Copy link
Author

simifalaye commented Jun 25, 2024

This is what the rocks-git readme says:

But the next part you left out is the part I'm referring to which states that the 'plugin' argument is the repo short name, ie. "owner/repo"

EDIT: Oh I see, so the readme is saying that only the 'install' command is changed, not all of them. My bad on the misunderstanding. Could you also comment on the prune needing to be run twice?

@mrcjkb
Copy link
Member

mrcjkb commented Jun 25, 2024

Could you also comment on the prune needing to be run twice?

I did:

rocks-git doesn't remove plugins from the rtp after pruning. It just deletes the repo from the file path so that it doesn't get added to the runtimepath on the next start.

If it needs to be run twice in order to delete the repo, then something must be wrong. Do you have the same behaviour with sync?

@simifalaye
Copy link
Author

I did:

My bad for not wording it properly. I meant the file path where the plugin was downloaded and then added to the runtime (ie. /site/pack/rocks/**/*)

If it needs to be run twice in order to delete the repo, then something must be wrong. Do you have the same behaviour with sync?

Sync works immediately, I've only seen it on prune. I'll keep testing a few things just to make sure it's not on my end but so far, it always take two prunes for rocks-git packages when I load up nvim.

@mrcjkb
Copy link
Member

mrcjkb commented Jun 25, 2024

Sync works immediately, I've only seen it on prune.

That's very strange. prune and prune on sync use exactly the same function.
I'll have to investigate that on Friday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants