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

Add option for version_key #214

Closed
wants to merge 1 commit into from

Conversation

pineapplehunter
Copy link

Hi, I was having some problems with packaging with different versioning, so I copied this idea from common-updater-scripts from nixpkgs.

Some packages can have a different version from the source repo but could be derived from source. Currently I see no way to update these packages like this with nix-update.
This PR adds an option version_key for this case.
By expose a variable that holds the github repo version, nix-update *name* --version-key *version attr name* could update the package.

BTW, I added an option to the argparser so it shows the default values of options on --help.

Thanks!

@pineapplehunter
Copy link
Author

I just leant that the case I was thinking of (in the test case) was using import from derivation.
I don't have any other examples that use this feature, so maybe this should just be closed.

@@ -56,6 +58,12 @@ def parse_args(args: list[str]) -> Options:
help="Regex to extract version with, i.e. 'jq-(.*)'",
default="(.*)",
)
parser.add_argument(
"-vk",
"--version-key",
Copy link
Owner

Choose a reason for hiding this comment

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

I think version-attr fits better with how nix language names things:

Suggested change
"--version-key",
"--version-attr",

parser.add_argument(
"-vk",
"--version-key",
help="Key of attribute that holds the version",
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
help="Key of attribute that holds the version",
help="Name of attribute that holds the version",

@@ -56,6 +58,12 @@ def parse_args(args: list[str]) -> Options:
help="Regex to extract version with, i.e. 'jq-(.*)'",
default="(.*)",
)
parser.add_argument(
"-vk",
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure we need a short-hand for that:

Suggested change
"-vk",

I see this more being used in scripts where the long-form is more descriptive.

@Mic92
Copy link
Owner

Mic92 commented Jan 10, 2024

Yeah. Maybe we can revisit this when we have a better idea how this would be useful...
Most packages will have version set properly.

@Mic92 Mic92 closed this Jan 10, 2024
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