packages: Raise an exception for invalid 'license' values.
authorLudovic Courtès <ludo@gnu.org>
Sat, 1 Oct 2022 14:56:19 +0000 (16:56 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 10 Oct 2022 09:16:07 +0000 (11:16 +0200)
commitb6bc4c109b807c646e99ec40360e681122d85b2c
tree02afbe98458dd5c23e057dbacb433d77d8072457
parent79b390a207adc70a1169c80e52c590d8b358f488
packages: Raise an exception for invalid 'license' values.

This is written in such a way that the type check turns into a no-op at
macro-expansion time for trivial cases:

  > ,optimize (validate-license gpl3+)
  $18 = gpl3+
  > ,optimize (validate-license (list gpl3+ gpl2+))
  $19 = (list gpl3+ gpl2+)

* guix/packages.scm (valid-license-value?, validate-license): New
macros.
(<package>)[license]: Add 'sanitize' option.
(&package-license-error): New error condition type.
* tests/packages.scm ("license type checking"): New test.
guix/packages.scm
tests/packages.scm