Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/languages-frameworks/cuda.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ Whenever a new version of a redistributable manifest is made available:

Updating package expressions amounts to:

- adding fixes conditioned on newer releases, like added or removed dependencies
- adding package expressions for new packages
- updating `passthru.brokenConditions` and `passthru.badPlatformsConditions` with various constraints, (e.g., new releases removing support for various architectures)
- adding fixes conditioned on newer releases, like added or removed dependencies,
- adding package expressions for new packages,
- updating `meta.problems`.

#### Updating supported compilers and GPUs {#cuda-updating-supported-compilers-and-gpus}

Expand Down
139 changes: 0 additions & 139 deletions pkgs/development/cuda-modules/_cuda/lib/assertions.nix

This file was deleted.

10 changes: 2 additions & 8 deletions pkgs/development/cuda-modules/_cuda/lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
lib,
}:
{
# See ./assertions.nix for documentation.
inherit (import ./assertions.nix { inherit _cuda lib; })
_evaluateAssertions
_mkFailedAssertionsString
_mkMissingPackagesAssertions
;

# See ./cuda.nix for documentation.
inherit (import ./cuda.nix { inherit _cuda lib; })
_cudaCapabilityIsDefault
Expand All @@ -23,8 +16,9 @@

# See ./meta.nix for documentation.
inherit (import ./meta.nix { inherit _cuda lib; })
_hasProblemKind
_mkMetaProblems
_mkMetaBadPlatforms
_mkMetaBroken
;

# See ./redist.nix for documentation.
Expand Down
85 changes: 22 additions & 63 deletions pkgs/development/cuda-modules/_cuda/lib/meta.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
{ _cuda, lib }:
{
/**
Returns a list of bad platforms for a given package if assertsions in `finalAttrs.passthru.platformAssertions`
fail, optionally logging evaluation warnings with `builtins.traceVerbose` for each reason.

NOTE: No guarantees are made about this function's stability. You may use it at your own risk.

NOTE: This function requires `finalAttrs.passthru.platformAssertions` to be a list of assertions and
`finalAttrs.finalPackage.name` and `finalAttrs.finalPackage.stdenv` to be available.

# Type

```
_mkMetaBadPlatforms :: (finalAttrs :: AttrSet) -> List String
```

# Inputs

`finalAttrs`

: The final attributes of the package
*/
# _mkMetaProblems ∷ [{ assertion ∷ bool, message ∷ str }] → [str]
_mkMetaProblems = builtins.concatMap (
{
assertion,
kind,
message,
urls ? [ ],
...
}@problem:
lib.lists.optional (!assertion) { inherit kind message urls; }
);

# _hasProblemKind ∷ { meta, ... } → bool
_hasProblemKind =
kind': finalAttrs: builtins.any ({ kind, ... }: kind == kind') finalAttrs.meta.problems or [ ];

# _mkMetaBadPlatforms ∷ { meta, ... } → [str]
#
# A helper for generating a short list of `badPlatforms` to be displayed in `errormsg` by `check-meta.nix`,
# when the real requirements of a package are more complex and dynamic than a matching CPU architecture.
_mkMetaBadPlatforms =
finalAttrs:
let
failedAssertionsString = _cuda.lib._mkFailedAssertionsString finalAttrs.passthru.platformAssertions;
hasFailedAssertions = failedAssertionsString != "";
hasFailedAssertions = _cuda.lib._hasProblemKind "unsupported" finalAttrs;
finalStdenv = finalAttrs.finalPackage.stdenv;
badPlatforms = lib.optionals hasFailedAssertions (
lib.unique [
Expand All @@ -34,45 +32,6 @@
finalStdenv.targetPlatform.system
]
);
handle =
if hasFailedAssertions then
builtins.traceVerbose "Package ${finalAttrs.finalPackage.name} is unsupported on this platform due to the following failed assertions:${failedAssertionsString}"
else
lib.id;
in
handle badPlatforms;

/**
Returns a boolean indicating whether the package is broken as a result of `finalAttrs.passthru.brokenAssertions`,
optionally logging evaluation warnings with `builtins.traceVerbose` for each reason.

NOTE: No guarantees are made about this function's stability. You may use it at your own risk.

NOTE: This function requires `finalAttrs.passthru.brokenAssertions` to be a list of assertions and
`finalAttrs.finalPackage.name` to be available.

# Type

```
_mkMetaBroken :: (finalAttrs :: AttrSet) -> Bool
```

# Inputs

`finalAttrs`

: The final attributes of the package
*/
_mkMetaBroken =
finalAttrs:
let
failedAssertionsString = _cuda.lib._mkFailedAssertionsString finalAttrs.passthru.brokenAssertions;
hasFailedAssertions = failedAssertionsString != "";
handle =
if hasFailedAssertions then
builtins.traceVerbose "Package ${finalAttrs.finalPackage.name} is marked as broken due to the following failed assertions:${failedAssertionsString}"
else
lib.id;
in
handle hasFailedAssertions;
badPlatforms;
}
Loading
Loading