validateLicenses: Warn about derivations lacking licensing information.

svn path=/nixpkgs/trunk/; revision=30496
This commit is contained in:
Ludovic Courtès 2011-11-20 20:53:15 +00:00
parent 36da53ebc3
commit 4122bd643e

View File

@ -330,16 +330,22 @@ rec {
{ mkDerivation = args: { mkDerivation = args:
let let
pkg = stdenv.mkDerivation args; pkg = stdenv.mkDerivation args;
drv = builtins.unsafeDiscardStringContext pkg.drvPath;
license = license =
if pkg ? meta && pkg.meta ? license then if pkg ? meta && pkg.meta ? license then
pkg.meta.license pkg.meta.license
else if pkg ? outputHash then
# Fixed-output derivations such as source tarballs usually
# don't have licensing information, but that's OK.
null
else else
null; builtins.trace
"warning: ${drv} lacks licensing information" null;
validate = arg: validate = arg:
if licensePred license then arg if licensePred license then arg
else abort '' else abort ''
while building ${builtins.unsafeDiscardStringContext pkg.drvPath}: while building ${drv}:
license `${builtins.toString license}' does not pass the predicate. license `${builtins.toString license}' does not pass the predicate.
''; '';