Unverified Commit 1ae214f8 authored by Grimmauld's avatar Grimmauld
Browse files

check-meta: fix 'hasNoMaintainers'

broken in 650eb613

Previously, if any of `meta.teams` or `meta.maintainers`
was undefined, `hasNoMaintainers` would return false,
suggesting e.g. bash had a maintainer - it does not.

The old logic before meta.teams was:
```nix
  hasNoMaintainers = attrs: attrs ? meta.maintainers && (length attrs.meta.maintainers) == 0;
```
This meant a package that did not define `meta.maintainers` would
appear maintained by this check, while a package with `meta.maintainers = []` would be listed as unmaintained.

This might have been a bug.
If it was not, that logic could be restored by prepending an extra check to the condition:
```nix
  (attrs ? meta.maintainers || attrs ? meta.teams) && (attrs.meta.maintainers or [] == []) && (attrs.meta.teams or [] == [])
```

I believe this makes little sense though. if no maintainer is listed, a package should be considered unmaintained.
If really desired, this can still be bypassed by setting `meta.maintainers = null;` or something.
parent c697944f
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -110,9 +110,19 @@ let
  hasUnfreeLicense = attrs: hasLicense attrs && isUnfree attrs.meta.license;

  hasNoMaintainers =
    # To get usable output, we want to avoid flagging "internal" derivations.
    # Because we do not have a way to reliably decide between internal or
    # external derivation, some heuristics are required to decide.
    #
    # If `outputHash` is defined, the derivation is a FOD, such as the output of a fetcher.
    # If `description` is not defined, the derivation is probably not a package.
    # Simply checking whether `meta` is defined is insufficient,
    # as some fetchers and trivial builders do define meta.
    attrs:
    (attrs ? meta.maintainers && (length attrs.meta.maintainers) == 0)
    && (attrs ? meta.teams && (length attrs.meta.teams) == 0);
    (!attrs ? outputHash)
    && (attrs ? meta.description)
    && (attrs.meta.maintainers or [ ] == [ ])
    && (attrs.meta.teams or [ ] == [ ]);

  isMarkedBroken = attrs: attrs.meta.broken or false;