feat(tvix/glue): emit a warning in case of bad SRI hashes

And include a test to ensure we show the warning.

Change-Id: Ib6a436dbba2592b398b54e44f15a48d1aa345099
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10470
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2023-12-30 03:01:59 +01:00 committed by tazjin
parent d5aa75bbcf
commit 6b136dfd23
6 changed files with 50 additions and 3 deletions

View file

@ -18,6 +18,7 @@ pub enum WarningKind {
EmptyInherit,
EmptyLet,
ShadowedOutput(String),
SRIHashWrongPadding,
/// Tvix internal warning for features triggered by users that are
/// not actually implemented yet, but do not cause runtime failures.
@ -105,6 +106,7 @@ impl EvalWarning {
"this derivation's environment shadows the output name {}",
out
),
WarningKind::SRIHashWrongPadding => "SRI hash has wrong padding".to_string(),
WarningKind::NotImplemented(what) => {
format!("feature not yet implemented in tvix: {}", what)
@ -127,6 +129,7 @@ impl EvalWarning {
WarningKind::EmptyInherit => "W009",
WarningKind::EmptyLet => "W010",
WarningKind::ShadowedOutput(_) => "W011",
WarningKind::SRIHashWrongPadding => "W012",
WarningKind::NotImplemented(_) => "W999",
}