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

mesonEmulatorHook: make error message agree with code #238484

Closed
wants to merge 1 commit into from
Closed

mesonEmulatorHook: make error message agree with code #238484

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jun 18, 2023

Description of changes

This commit fixes the error thrown by mesonEmulatorHook so it agrees with the actual condition that was not met.

Discovered during this discussion:

#238331 (comment)

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

This commit fixes the error thrown by `mesonEmulatorHook` so it
agrees with the actual condition that was not met.

Discovered during this discussion:

  #238331 (comment)
@ghost ghost requested a review from Artturin June 18, 2023 22:17
Copy link
Member

@sternenseemann sternenseemann left a comment

Choose a reason for hiding this comment

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

I believe this message is actually correct in a sense—that is the code you'd use at the call site and the hook (which goes in nativeBuildInputs) comes from the previous set.

What should be changed to be totally accurate (but it doesn't matter for any practical case I can think of), is the if— it should be !(stdenv.hostPlatform.canExecute stdenv.targetPlatform) and it should use pkgs, not buildPackages.

@sternenseemann
Copy link
Member

I think this works correctly at the moment because

pkgsCross.aarch64-multiplatform.buildPackages.buildPackages.stdenv == pkgsCross.aarch64-multiplatform.buildPackages.stdenv

@ghost
Copy link
Author

ghost commented Jun 23, 2023

I believe this message is actually correct in a sense—that is the code you'd use at the call site and the hook (which goes in nativeBuildInputs) comes from the previous set.

Oh I see. Yeah it could be confusing.

We probably shouldn't use the literal stdenv in situations like this where the error message will appear in a scope where stdenv is bound differently than the scope where the error string literal emanates from.

Suggested fix: https://github.com/NixOS/nixpkgs/pull/238654/files#r1239559837

@ghost ghost closed this Jun 23, 2023
@ghost ghost deleted the pr/mesonEmulatorHook/error branch June 23, 2023 09:00
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant