-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
fetchpatch breaks the generic rewriter #427
Comments
I think this is intentional. If multiple hashes need updating, there isn't a way to determine which new hash goes to which location. PRs welcome if there's a sufficiently robust thing that we could do differently. |
|
The problem isn't getting the old hash of
|
We can zero out To prevent unknown secondary source attributes not being updated, the multiple hashes check could be updated to ignore known source fields. |
It is clear that the check is there for a reason, otherwise I would have posted a pull request removing instead of an issue. After giving it some thought, I came up with the following solution:
Unless I'm missing something, this should fix the fetchpatch issue, while also subsuming the functionality of the Rust, Go and NPM rewriters, fixing some potential false negatives too (like Other (less ideal, but still preferable to the status quo) ideas:
|
Don't bad things happen if a fake hash other than zeroes is used? ISTR reading something about how that's not good practice. Other than that, again, PRs welcome if you want to implement something that complicated. But I'd be more supportive of an in-tree solution; I'm of the opinion that the updating logic |
Other than treating an empty hash as zero, I don't think Nix treats the zero hash specially. Of course you shouldn't choose a fake hash that collides with something that's already in your store (for example, not changing the hash at all).
This sounds quite reasonable. I think it would still be good to add some note about this to the documentation, particularly given how common fetchpatch usage is.
Obtaining the latest version can be quite involved, particularly for projects that supply their releases as tarballs. Of course you could duplicate the logic of nixpkgs-update, but this does not sound like a good idea, and repology probably won't like the bulk requests that causes. It might be a good idea if nixpkgs-update could communicate the target version (which it already knows anyway) to the update script. |
Yeah, though note that in the specific case of VLC there is a Git repository we could read tags from. You could probably use passthru.updateScript = genericUpdater {
versionLister = "${common-updater-scripts}/bin/list-git-tags --url=https://code.videolan.org/videolan/vlc";
ignoredVersions = "[-]";
}; if the common updater infrastructure could cope with the hash situation.
I think that's a good idea! We could set an environment variable, or extend the updateScript interface to include a version hint and use that. |
If a patch is retrieved using
fetchpatch
, there is a second hash in the file, which triggers the multiple hash check of the generic version rewriter (example: https://r.ryantm.com/log/vlc/2024-06-09.log). Consequently, the package will not be updated. This is pretty surprising behaviour.The text was updated successfully, but these errors were encountered: