diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-12-15 19:32:38 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-12-15 19:32:38 +0100 |
commit | 6b8e2555ef013b579cda57025b17d662e0f1fe1f (patch) | |
tree | 5a83c673af26c9976acd5a5dfa20e09e06898047 /nixpkgs/pkgs/stdenv/generic | |
parent | 66ca7a150b5c051f0728f13134e6265cc46f370c (diff) | |
parent | 02357adddd0889782362d999628de9d309d202dc (diff) | |
download | nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.tar nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.tar.gz nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.tar.bz2 nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.tar.lz nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.tar.xz nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.tar.zst nixlib-6b8e2555ef013b579cda57025b17d662e0f1fe1f.zip |
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/stdenv/generic')
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/check-meta.nix | 48 | ||||
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/setup.sh | 16 |
2 files changed, 38 insertions, 26 deletions
diff --git a/nixpkgs/pkgs/stdenv/generic/check-meta.nix b/nixpkgs/pkgs/stdenv/generic/check-meta.nix index f2d9233b6fdd..62a6cd8ef02e 100644 --- a/nixpkgs/pkgs/stdenv/generic/check-meta.nix +++ b/nixpkgs/pkgs/stdenv/generic/check-meta.nix @@ -22,11 +22,15 @@ let optionals remove unknownModule + isAttrs + isString ; inherit (lib.lists) any toList + isList + elem ; # If we're in hydra, we can dispense with the more verbose error @@ -59,11 +63,15 @@ let hasLicense = attrs: attrs ? meta.license; - hasAllowlistedLicense = assert areLicenseListsValid; attrs: - hasLicense attrs && any (l: builtins.elem l allowlist) (toList attrs.meta.license); + hasListedLicense = assert areLicenseListsValid; list: attrs: + length list > 0 && hasLicense attrs && ( + if isList attrs.meta.license then any (l: elem l list) attrs.meta.license + else elem attrs.meta.license list + ); - hasBlocklistedLicense = assert areLicenseListsValid; attrs: - hasLicense attrs && any (l: builtins.elem l blocklist) (toList attrs.meta.license); + hasAllowlistedLicense = attrs: hasListedLicense allowlist attrs; + + hasBlocklistedLicense = attrs: hasListedLicense blocklist attrs; allowBroken = config.allowBroken || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1"; @@ -71,11 +79,16 @@ let allowUnsupportedSystem = config.allowUnsupportedSystem || builtins.getEnv "NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM" == "1"; - isUnfree = licenses: any (l: !l.free or true) licenses; + isUnfree = licenses: + if isAttrs licenses then !licenses.free or true + # TODO: Returning false in the case of a string is a bug that should be fixed. + # In a previous implementation of this function the function body + # was `licenses: lib.lists.any (l: !l.free or true) licenses;` + # which always evaluates to `!true` for strings. + else if isString licenses then false + else lib.lists.any (l: !l.free or true) licenses; - hasUnfreeLicense = attrs: - hasLicense attrs && - isUnfree (toList attrs.meta.license); + hasUnfreeLicense = attrs: hasLicense attrs && isUnfree attrs.meta.license; hasNoMaintainers = attrs: attrs ? meta.maintainers && (length attrs.meta.maintainers) == 0; @@ -479,16 +492,21 @@ let assertValidity = { meta, attrs }: let validity = checkValidity attrs; - in validity // { + inherit (validity) valid; + in validity // { # Throw an error if trying to evaluate a non-valid derivation # or, alternatively, just output a warning message. handled = - { - no = handleEvalIssue { inherit meta attrs; } { inherit (validity) reason errormsg; }; - warn = handleEvalWarning { inherit meta attrs; } { inherit (validity) reason errormsg; }; - yes = true; - }.${validity.valid}; - + ( + if valid == "yes" then true + else if valid == "no" then ( + handleEvalIssue { inherit meta attrs; } { inherit (validity) reason errormsg; } + ) + else if valid == "warn" then ( + handleEvalWarning { inherit meta attrs; } { inherit (validity) reason errormsg; } + ) + else throw "Unknown validitiy: '${valid}'" + ); }; in { inherit assertValidity commonMeta; } diff --git a/nixpkgs/pkgs/stdenv/generic/setup.sh b/nixpkgs/pkgs/stdenv/generic/setup.sh index 37c10fb2957b..081024781eef 100644 --- a/nixpkgs/pkgs/stdenv/generic/setup.sh +++ b/nixpkgs/pkgs/stdenv/generic/setup.sh @@ -1260,6 +1260,10 @@ configurePhase() { prependToVar configureFlags --disable-static fi fi + + if [ -z "${dontPatchShebangsInConfigure:-}" ]; then + patchShebangs --build "$configureScript" + fi fi if [ -n "$configureScript" ]; then @@ -1495,17 +1499,7 @@ distPhase() { showPhaseHeader() { local phase="$1" - case "$phase" in - unpackPhase) echo "unpacking sources";; - patchPhase) echo "patching sources";; - configurePhase) echo "configuring";; - buildPhase) echo "building";; - checkPhase) echo "running tests";; - installPhase) echo "installing";; - fixupPhase) echo "post-installation fixup";; - installCheckPhase) echo "running install tests";; - *) echo "$phase";; - esac + echo "Running phase: $phase" } |