Commit 1be6d007 authored by Eman Resu's avatar Eman Resu
Browse files

stdenv/check-meta: check that allowlist/blocklist nonempty first

parent 1d12e66b
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -81,11 +81,7 @@ let

  hasListedLicense =
    assert areLicenseListsValid;
    list:
    if list == [ ] then
      attrs: false
    else
      attrs:
    list: attrs:
    attrs ? meta.license
    && (
      if isList attrs.meta.license then
@@ -428,13 +424,13 @@ let
      }

    # --- Put checks that can be ignored here ---
    else if hasDeniedUnfreeLicense attrs && !(hasAllowlistedLicense attrs) then
    else if hasDeniedUnfreeLicense attrs && !(allowlist != [ ] && hasAllowlistedLicense attrs) then
      {
        reason = "unfree";
        msg = "has an unfree license (‘${showLicense attrs.meta.license}’)";
        remediation = remediate_allowlist "Unfree" (remediate_predicate "allowUnfreePredicate" attrs);
      }
    else if hasBlocklistedLicense attrs then
    else if blocklist != [ ] && hasBlocklistedLicense attrs then
      {
        reason = "blocklisted";
        msg = "has a blocklisted license (‘${showLicense attrs.meta.license}’)";