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

Implement freezing and thawing of pins #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

andir
Copy link
Owner

@andir andir commented May 11, 2024

This allows freezing a pin to ensure that it isn't changed by issuing a blanked npins update.

Should fix #62

This allows freezing a pin to ensure that it isn't changed by issuing
a blanked `npins update`.
Copy link
Contributor

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as expected. Thanks for looking into this!

@andir andir marked this pull request as ready for review May 12, 2024 08:54
help Prints this message or the help of the given subcommand(s)
import-flake Try to import entries from flake.lock
import-niv Try to import entries from Niv
init Intializes the npins directory. Running this multiple times will restore/upgrade the
`default.nix` and never touch your sources.json
remove Removes one pin entry
show Lists the current pin entries
thaw Thaw a pin entry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that logically freeze <-> thaw makes sense but from a UX perspective I would prefer to have a more explicit indication that those two commands belong together.

Hence I'd prefer freeze and unfreeze - WDYT @andir ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also prefer unfreeze, with an optional alias to thaw for those who find that more intuitive

Copy link
Collaborator

@piegamesde piegamesde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, only some nits (and "thaw" as name)

@@ -123,14 +123,16 @@ macro_rules! mkPin {
version: Option<<$input_name as Updatable>::Version>,
#[serde(flatten)]
hashes: Option<<$input_name as Updatable>::Hashes>,
#[serde(default)]
frozen: Frozen,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't our CI/rustfmt complain on this line? (Mixed usage of tabs and spaces)

@@ -589,6 +602,11 @@ impl Opts {

if opts.names.is_empty() {
for (name, pin) in pins.pins.iter_mut() {
if pin.is_frozen() {
log::info!("Skipping pin {} as it is frozen.", name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit for consistency:

Suggested change
log::info!("Skipping pin {} as it is frozen.", name);
log::info!("Skipping pin '{}' as it is frozen.", name);

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was planning on doing this for the entire code base. We've a few cases where that isn't the case.

@piegamesde
Copy link
Collaborator

Now that I actually think of it, what is the workflow of manually updating frozen pins? Unfreezing them just for that purpose seems a bit unwieldy.

@andir
Copy link
Owner Author

andir commented May 15, 2024

Now that I actually think of it, what is the workflow of manually updating frozen pins? Unfreezing them just for that purpose seems a bit unwieldy.

Perhaps an extra argument to the update command?

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.

Pinning specific commits in a GH repo
4 participants