lib, treewide: introduce repoRevToName and use it to cleanup most fetch* functions#316668
lib, treewide: introduce repoRevToName and use it to cleanup most fetch* functions#316668Lassulus merged 3 commits intoNixOS:masterfrom
repoRevToName and use it to cleanup most fetch* functions#316668Conversation
repoRevToName and use to cleanup most fetch* functionsrepoRevToName and use it to cleanup most fetch* functions
38ffa76 to
a09a1e7
Compare
a09a1e7 to
6fc7913
Compare
philiptaron
left a comment
There was a problem hiding this comment.
A few curious questions as I read through this PR.
6fc7913 to
3b81d58
Compare
|
Okay, so I edited this to use A simple way to see which files fail the checks, except to run those checks yourself, would be nice, though. |
3b81d58 to
08d03fa
Compare
|
ping @AndersonTorres specifically, since your review requested changes that were since resolved, IMHO. Also, somewhat relatedly, #391322 is a follow-up to 6620964 which changed the version without changing the hash, which would not have happened if @mweinelt used this PR with Such errors, how frequent are they? 🤔 Just saying. |
AndersonTorres
left a comment
There was a problem hiding this comment.
I would complain about nixfmt not having its own commit. But nothing relevant is being lost.
So, LGTM.
The cause is limitations in the python bulk updater. These commits are under my name, but |
08d03fa to
dd3352f
Compare
|
@AndersonTorres Thanks! Also, mass-reformat now ate those @mweinelt Well, okay, but it would have been caught by this infra. Also, rebased onto |
|
Ping. What's holding this up? |
dd3352f to
6404a0f
Compare
|
Took the liberty with @Lassulus to rebase this to solve the merge conflict |
|
Thanks. Rebase LGTM. |
This is more efficient.
…ctions This patch adds `lib.repoRevToName` function that generalizes away most of the code used for derivation name generation by `fetch*` functions (`fetchzip`, `fetchFromGitHub`, etc, except those which are delayed until latter commits for mass-rebuild reasons). It's first argument controls how the resulting name will look (see below). Since `lib` has no equivalent of Nixpkgs' `config`, this patch adds `config.fetchedSourceNameDefault` option to Nixpkgs and then re-exposes `lib.repoRevToName config.fetchedSourceNameDefault` expression as `pkgs.repoRevToNameMaybe` which is then used in `fetch*` derivations. The result is that different values of `config.fetchedSourceNameDefault` now control how the `src` derivations produced by `fetch*` functions are to be named, e.g.: - `fetchedSourceNameDefault = "source"` (the default): ``` $ nix-instantiate -A fuse.src /nix/store/<hash>-source.drv ``` - `fetchedSourceNameDefault = "versioned"`: ``` $ nix-instantiate -A fuse.src /nix/store/<hash>-libfuse-2.9.9-source.drv ``` - `fetchedSourceNameDefault = "full"`: ``` $ nix-instantiate -A fuse.src /nix/store/<hash>-libfuse-2.9.9-github-source.drv ``` See the documentation of `config.fetchedSourceNameDefault` for more info.
6404a0f to
7c8a4ef
Compare
|
Rebased again to fix conflicts. And it is now stuck at Darwin check again. And the previous time it was stuck right there for a month. So, I don't think it's likely this will get any better anytime soon. |
|
Thanks @Lassulus! |
This a first half of #49862. Basically, this is a noop cleanup that keeps all the
fetch*names as they are now, while introducing the newconfig.fetchedSourceNameDefaultoption.Changes
This patch adds
lib.repoRevToNamefunction that generalizes away most of the code used for derivation name generation byfetch*functions (fetchzip,fetchFromGitHub, etc, except those which are delayed until latter commits for mass-rebuild reasons).It's first argument controls how the resulting name will look (see below).
Since
libhas no equivalent of Nixpkgs'config, this patch addsconfig.fetchedSourceNameDefaultoption to Nixpkgs and then re-exposeslib.repoRevToName config.fetchedSourceNameDefaultexpression aspkgs.repoRevToNameMaybewhich is then used infetch*derivations.The result is that different values of
config.fetchedSourceNameDefaultnow control how thesrcderivations produced byfetch*functions are to be named, e.g.:fetchedSourceNameDefault = "source"(the default):fetchedSourceNameDefault = "versioned":fetchedSourceNameDefault = "full":See documentation of
config.fetchedSourceNameDefaultfor more info.