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

(compilers): add version and pname #67284

Merged
merged 10 commits into from Nov 24, 2019
Merged

Conversation

gloaming
Copy link
Contributor

Motivation for this change

It's annoying to have to use getVersion with clang and friends. Might as well add the pname while we're at it.

Things done

I ran the rebuild for a little bit (on NixOS) to check it wasn't totally broken.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@oxij
Copy link
Member

oxij commented Aug 23, 2019 via email

@gloaming
Copy link
Contributor Author

Thanks. pname now added to gcc.

Note that the cc-wrapper doesn't forward the pname; I'm not sure if it's worth the hassle.

@teto
Copy link
Member

teto commented Aug 28, 2019

needs a rebase

@gloaming gloaming force-pushed the cc-versions branch 2 times, most recently from 731c848 to dc550f7 Compare August 29, 2019 15:31
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

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

How about

Suggested change
ccVersion = cc.version or (builtins.parseDrvName cc.name).version;
ccVersion = lib.getVersion cc;

Copy link
Contributor Author

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?

Copy link
Member

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.

@veprbl veprbl added this to Needs review in Staging Oct 25, 2019

bootstrap = targetPlatform == hostPlatform;

in

stdenv.mkDerivation ({
name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
pname = crossNameAddon + "${name}${if stripped then "" else "-debug"}";
Copy link
Member

Choose a reason for hiding this comment

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

I see we were missing this as 2afd3c9 and 659363f must have crossed.

Copy link
Member

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.

@veprbl veprbl moved this from Needs review to WIP in Staging Oct 27, 2019
@gloaming
Copy link
Contributor Author

@veprbl Suggestions added.

Copy link
Member

@Ericson2314 Ericson2314 left a 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;
Copy link
Member

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).

Copy link
Member

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.

Copy link
Contributor Author

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...

Copy link
Member

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.

@Ericson2314
Copy link
Member

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.

@gloaming
Copy link
Contributor Author

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.

Remarkably, it rebased without any conflict :)

@gloaming gloaming changed the base branch from staging to release-19.09 November 23, 2019 22:04
@ofborg ofborg bot requested a review from veprbl November 23, 2019 22:05
@Ericson2314
Copy link
Member

Oh! Last thing there is a gcc/snapshot/default.nix you should get too, even though it should also be deleted.

@gloaming
Copy link
Contributor Author

Oh! Last thing there is a gcc/snapshot/default.nix you should get too, even though it should also be deleted.

Hmm, I made the same changes there as to the others - is there something I missed?

@Ericson2314
Copy link
Member

Ericson2314 commented Nov 24, 2019

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.

@Ericson2314 Ericson2314 merged commit ba62f5e into NixOS:release-19.09 Nov 24, 2019
Staging automation moved this from WIP to Done Nov 24, 2019
@veprbl
Copy link
Member

veprbl commented Nov 24, 2019

I'm very confused. Why is this going to release-19.09?

@Ericson2314
Copy link
Member

@veprbl Oh. shit! I meant for this to still go to staging, sorry if that was unclear.

@Ericson2314
Copy link
Member

I'll revert.

Ericson2314 added a commit that referenced this pull request Nov 24, 2019
This PR was meant to go to staging, not 19.09. I was not clear.

This reverts commit ba62f5e, reversing
changes made to c02134f.
@jonringer
Copy link
Contributor

for #74014 I was wondering why my previous nix-review only built ~100 packages, then ~900 a few minutes later... ty for reverting 😄

@Ericson2314
Copy link
Member

Hehe NP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Staging
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants