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
(compilers): add version and pname #67284
Conversation
@oxij I see you moved the `crossNameAddon` to the start for the earlier versions. Are you aware of any reason I shouldn't change it for the later ones also?
No, I just didn't touch the expressions for the later `gcc`s then. So, if I were you, I would change them now.
|
Thanks. Note that the |
needs a rebase |
731c848
to
dc550f7
Compare
@@ -35,8 +35,8 @@ let | |||
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) | |||
(targetPlatform.config + "-"); | |||
|
|||
ccVersion = (builtins.parseDrvName cc.name).version; | |||
ccName = (builtins.parseDrvName cc.name).name; | |||
ccVersion = cc.version or (builtins.parseDrvName cc.name).version; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
ccVersion = cc.version or (builtins.parseDrvName cc.name).version; | |
ccVersion = lib.getVersion cc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I wonder if we should add a lib.getPName
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gloaming I think that this goes out of scope of this PR.
|
||
bootstrap = targetPlatform == hostPlatform; | ||
|
||
in | ||
|
||
stdenv.mkDerivation ({ | ||
name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon; | ||
pname = crossNameAddon + "${name}${if stripped then "" else "-debug"}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I messed this up recently too. Maybe we can finally fix it in this PR.
dc550f7
to
43afe78
Compare
@veprbl Suggestions added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to base your PR on top of git merge-base origin/master origin/release-19.09
? I would very much appreciate that.
I have been making a number of cleanups to both master
and release-19.09
, and will probably do some more, and it is much easier to "chain" them when I can just merge the same commit into both branches (or rather staging
and staging -19.09
).
I'm not sure this can all go to 19.09, but there is at least some parts which can, and I would add those parts at the very least, which does mean I'd need to make another commit, but the base branch per the above still helps
@@ -96,6 +96,7 @@ stdenv.mkDerivation { | |||
name = targetPrefix | |||
+ (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper") | |||
+ (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}"); | |||
version = ccVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the line above we conditionally append "-${ccVersion}"
suffix and here you refer to ccVersion
unconditionally. I wonder what is the use case for cc-wrapper with cc = null
, depending on what it is we might not want to break it (ccVersion
tries to evaluate cc.name
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc == null
is for this native stdenv stuff I think we should remove anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've added a null check. We still have the minor issue that a null cc will result in a null version attribute rather than a missing one, which seems to be against convention. I don't know an elegant way to conditionally add an attribute to the derivation...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Yeah this fine for now / master.
BTW, I like to do vim -d pkgs/development/compilers/gcc/*/default.nix to make sure all this copy-pasted code isn't drifting apart. |
43afe78
to
607f947
Compare
and fix the dashes
Remarkably, it rebased without any conflict :) |
607f947
to
e158e11
Compare
Oh! Last thing there is a |
Hmm, I made the same changes there as to the others - is there something I missed? |
Oh, I'm so sorry @gloaming! I was reviewing earlier today from my phone and somehow missed that file. Thanks again for your work and patience. |
I'm very confused. Why is this going to release-19.09? |
@veprbl Oh. shit! I meant for this to still go to staging, sorry if that was unclear. |
I'll revert. |
for #74014 I was wondering why my previous nix-review only built ~100 packages, then ~900 a few minutes later... ty for reverting 😄 |
Hehe NP. |
Motivation for this change
It's annoying to have to use
getVersion
with clang and friends. Might as well add thepname
while we're at it.Things done
I ran the rebuild for a little bit (on NixOS) to check it wasn't totally broken.
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @