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

feat: adding first implementation of a lockfile #147

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

saccarosium
Copy link
Collaborator

Related to: #107

This PR tries to implement a lockfile mechanism into Paq. The lockfile is stored in stdpath('data'), as a json file. The file tries to represent the previous state of Paq but since this cannot be trusted fully I've setup some safeguards that fall back to the previous behaviour when needed:

  1. For cleaning up the packages I've maintained the previous function find_unlisted(). We cannot assume that all the unlisted packages will be listed in the lockfile.
  2. If a lock file is not present it will not throw anything and generate itself from the current configuration.

This change is meant to be not disruptive and most users don't even need to know that is happening. Later in we can iterate over this feature and try to fix some of the bug and strange behaviour paq has (#99, #80, #73).

@savq
Copy link
Owner

savq commented Jul 6, 2023

I'll try to make a more thorough review later, but for now the only thing that stands out is using io instead of vim.loop/uv. Sometimes the uv api is less convenient, but it's what protects us from evil ensures windows compatibility.

Using the built-in JSON functions is the right call 👍

@saccarosium
Copy link
Collaborator Author

I've updated the lock_load and state_write function to use uv.fs_* function instead of io.*.

@savq savq merged commit 2a77158 into savq:master Aug 3, 2023
@savq
Copy link
Owner

savq commented Aug 3, 2023

Hi, Luca. The changes look good.

As you mentioned, it's probably better to iterate on this later rather than try to fix everything now, so I'll create a tracking issue for those problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants