maintainers/scripts/update.nix: handle null paths

Previously we did not handle non-existant paths making the program crash.
Let’s show a proper error.
This commit is contained in:
Jan Tojnar 2019-06-02 09:03:41 +02:00
parent 36b2012447
commit c3dd31f177
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4

View File

@ -69,9 +69,12 @@ let
let
attrSet = pkgs.lib.attrByPath (pkgs.lib.splitString "." path) null pkgs;
in
packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg)
(name: pkg: pkg)
attrSet;
if attrSet == null then
builtins.throw "Attribute path `${path}` does not exists."
else
packagesWith (name: pkg: builtins.hasAttr "updateScript" pkg)
(name: pkg: pkg)
attrSet;
packageByName = name:
let