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

lib.callPackageWith: Use abort again instead of throw and fix evaluation errors caused by it #278777

Merged
merged 8 commits into from
Jan 8, 2024

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Jan 4, 2024

Description of changes

In #269356 by @amjoseph-nixpkgs (but really the split-off #271123 by @Mic92), lib.callPackageWith was switched from an abort to a throw, which can be caught with builtins.tryEval. Because the ofborg evaluation gracefully handles evaluation failures that can be caught, this meant that all lib.callPackageWith errors weren't being guarded against by CI anymore, making CI succeed when it really shouldn't have.

This especially affected evaluation with allowAliases = false, which triggers the callPackageWith error when aliases are used.

Affected merged PRs are:

There may be more PRs in the pipeline that would fail on master.

@jtojnar already made a fix for one evaluation failure in #278744. This PR fixes the remaining errors and uses abort again to prevent against future breakages.

In particular nix-build pkgs/test/release continues succeeding with this PR.

Ping @lilyinstarlight


Add a 👍 reaction to pull requests you find important.

@@ -53,7 +53,7 @@ final: _: {
autoAddCudaCompatRunpathHook =
final.callPackage
(
{makeSetupHook, cuda_compat}:
{makeSetupHook, cuda_compat ? throw "autoAddCudaCompatRunpathHook: No cuda_compat for CUDA ${final.cudaMajorMinorVersion}" }:
Copy link
Contributor

Choose a reason for hiding this comment

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

So to make sure I understand correctly, it's ok to use throw here because we do want to prevent Ofborg from evaluating the hook on platforms that don't support cuda_compat? Or should this be an abort as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed that's right :)

Copy link
Contributor

@yannham yannham left a comment

Choose a reason for hiding this comment

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

LGTM on the CUDA part. Thanks!

@infinisil
Copy link
Member Author

I just rebased and pushed another commit to fix another failure that's since been introduced on master. I'll merge this PR as soon as ofborg passes so we fix this for PRs going forward.

Note that even after merging, new failures on master may be introduced from PRs that already passed CI.

@ofborg ofborg bot requested a review from veprbl January 8, 2024 00:54
@infinisil infinisil merged commit 0ed96ee into NixOS:master Jan 8, 2024
22 of 23 checks passed
@infinisil infinisil deleted the fix-evals branch January 8, 2024 02:51
@vcunat
Copy link
Member

vcunat commented Jan 8, 2024

This merge itself caused breakage and blocks channels now:
https://hydra.nixos.org/build/245871962

@infinisil
Copy link
Member Author

@vcunat Yeah this is what I was anticipating with my previous message:

Note that even after merging, new failures on master may be introduced from PRs that already passed CI.

In the future we should apply the ratchet check idea I recently introduced for pkgs/by-name more widely. This would fix such problems.

For now we can only fix forward as these problems happen, I'll do so.

@infinisil
Copy link
Member Author

Oh actually no this is a different problem, I think this is something that wasn't anticipated in #269356, I'll investigate..

@vcunat
Copy link
Member

vcunat commented Jan 8, 2024

To be clear, this is broken on the merge commit itself already, not by any subsequent merges.

@infinisil
Copy link
Member Author

I tracked down the root problem to #276800.

Fixed with #279684

infinisil added a commit that referenced this pull request Jan 8, 2024
This very weirdly broke the channel evaluation: https://hydra.nixos.org/build/245871962/nixlog/1

It appears that this attribute is only evaluated by Hydra, _not_ by
ofborg. So this wouldn't have been detected by CI anyways in the PR that
introduced the problem: #276800.

However, due to #271123 (comment),
the channel only broke once that was fixed with #278777

Whether the fix is good, I don't know, but the failing-on-darwin attribute
doesn't exist anymore with this commit, making the tarball build succeed
again:

    nix-build pkgs/top-level/release.nix -A tarball
slam-bert pushed a commit to slam-bert/nixpkgs that referenced this pull request Jan 11, 2024
This very weirdly broke the channel evaluation: https://hydra.nixos.org/build/245871962/nixlog/1

It appears that this attribute is only evaluated by Hydra, _not_ by
ofborg. So this wouldn't have been detected by CI anyways in the PR that
introduced the problem: NixOS#276800.

However, due to NixOS#271123 (comment),
the channel only broke once that was fixed with NixOS#278777

Whether the fix is good, I don't know, but the failing-on-darwin attribute
doesn't exist anymore with this commit, making the tarball build succeed
again:

    nix-build pkgs/top-level/release.nix -A tarball
github-actions bot pushed a commit to Mic92/nixpkgs that referenced this pull request Jan 14, 2024
This very weirdly broke the channel evaluation: https://hydra.nixos.org/build/245871962/nixlog/1

It appears that this attribute is only evaluated by Hydra, _not_ by
ofborg. So this wouldn't have been detected by CI anyways in the PR that
introduced the problem: NixOS#276800.

However, due to NixOS#271123 (comment),
the channel only broke once that was fixed with NixOS#278777

Whether the fix is good, I don't know, but the failing-on-darwin attribute
doesn't exist anymore with this commit, making the tarball build succeed
again:

    nix-build pkgs/top-level/release.nix -A tarball
flandweber pushed a commit to flandweber/nixpkgs that referenced this pull request Jan 21, 2024
This very weirdly broke the channel evaluation: https://hydra.nixos.org/build/245871962/nixlog/1

It appears that this attribute is only evaluated by Hydra, _not_ by
ofborg. So this wouldn't have been detected by CI anyways in the PR that
introduced the problem: NixOS#276800.

However, due to NixOS#271123 (comment),
the channel only broke once that was fixed with NixOS#278777

Whether the fix is good, I don't know, but the failing-on-darwin attribute
doesn't exist anymore with this commit, making the tarball build succeed
again:

    nix-build pkgs/top-level/release.nix -A tarball
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.

None yet

4 participants