RFC: More common updater script implementations#21766
RFC: More common updater script implementations#21766dezgeg wants to merge 3 commits intoNixOS:masterfrom
Conversation
|
I prefer generating separate JSON file. I should have done so for Firefox/Thunderbird. After all, we need rewrite each packages to adopt |
|
Of course, this update script is far better than my ad hoc update script using |
|
I think in a large number of cases rewriting the packages is not necessary and things like figuring out the latest version can be automated. E.g. if a package is currently using (This is the similar logic what http://monitor.nixos.org/ used to do when it was up and I found it very useful). |
There was a problem hiding this comment.
This is an abuse of callPackage. update.nix is not a package...
There was a problem hiding this comment.
Should we have the same thing under a different name? It's quite painful to duplicate the list of upgrade script dependencies four times.
There was a problem hiding this comment.
Otherwise this happens (on NixOS):
error: Nix database directory ‘/nix/var/nix/db’ is not writable: Permission denied
./maintainers/scripts/common-updater/update-source-version: error: Couldn't evaluate 'thunderbird.meta.position' to locate the .nix file!
garbas
left a comment
There was a problem hiding this comment.
i'm not a fan of using nix-shell inside nix-shell. i would rather have this common-scripts become packages in nixpkgs (under some namespace) and which we run them using maintainers/scripts/update.nix
|
This looks basically good to me. Having a 90-line shell script full of grep/sed magic is not ideal but that could be improved in the future. (I'm thinking that ideally, we would have |
|
@garbas I agree. @dezgeg Regarding |
|
Okay, thank you for the feedback. I've now moved this to |
Adds a script to help automatically upgrading packages: this one can
patch name/version attributes like:
version = "50.1.0";
name = "bc-1.06";
... to the given version, and updates the sha256 hash to match.
Usage is:
update-source-version <attr> <new-version> [<new-source-hash>]
where:
- attr is the attribute path of the package
- new-version is the version string to be patched in
- new-source-hash is the optional sha256/etc. hash of the source.
If not given, the script will automatically calculate it.
This is added to a subdirectory where other useful scripts can be added
in the future, like figuring out the newest version from a git repo or
GitHub releases etc.
This way we have the benefit of the usual Nixpkgs style, and gain a slight reduction in amount of code in the updater. Also use callPackage to reduce duplication of the dependencies of the update script and use makeBinPath to make things neater.
Replace the custom patching code with the common script. Also use callPackage and makeBinPath
|
Any issues with the updated version? |
|
I have pushed this as it also fixes the |
As a first step of adding some common updater script implementations, this PR adds a script to automate patching the
versionandsha256fields in .nix files. It currently uses the hacky way of replacing the existing hash with an invalid one and parsing the proper hash from the error message. When NixOS/nix#1172 is fixed,nix-build --hashcan be used.Now, others have proposed (and used) different and arguably cleaner approaches than patching the .nix files, like generating separate JSON files for sources (e.g. #21734). But from a pragmatic point of view, we already have thousands of packages using the traditional "version/sha in .nix file" style, so it likely makes sense to make the tooling work with those instead of trying to convert all of them.
cc @garbas for the
tp_smapistuff and @taku0 for the Firefox/Thunderbird stuff. Also @edolstra for the general approach & locations of the scripts.For easier testing, here are the same commits + the relevant packages downgraded: https://github.com/dezgeg/nixpkgs/commits/updater-downgraded