feat(tvix/derivation): check for other invalid output names
This uses the exposed StorePath::validate_name method to check for other invalid output names (for which it would not be possible to construct a store path of). Change-Id: Ia3f65e19a07ef164f9f64013a5f37cbac99eb8e0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7855 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
4a256dda09
commit
b1e8fe7212
1 changed files with 11 additions and 6 deletions
|
@ -20,8 +20,11 @@ impl Derivation {
|
|||
// meaning.
|
||||
//
|
||||
// Other output names that don't match the name restrictions from
|
||||
// [StorePath] will fail output path calculation.
|
||||
if output_name.is_empty() || output_name == "drv" {
|
||||
// [StorePath] will fail the [StorePath::validate_name] check.
|
||||
if output_name.is_empty()
|
||||
|| output_name == "drv"
|
||||
|| StorePath::validate_name(&output_name).is_err()
|
||||
{
|
||||
return Err(DerivationError::InvalidOutputName(output_name.to_string()));
|
||||
}
|
||||
|
||||
|
@ -73,10 +76,12 @@ impl Derivation {
|
|||
// `drvPath` key (which already exists) and has a different
|
||||
// meaning.
|
||||
//
|
||||
// Other output names that don't match the name restrictions
|
||||
// from [StorePath] can't be constructed with this library, but
|
||||
// are not explicitly checked here (yet).
|
||||
if output_name.is_empty() || output_name == "drv" {
|
||||
// Other output names that don't match the name restrictions from
|
||||
// [StorePath] will fail the [StorePath::validate_name] check.
|
||||
if output_name.is_empty()
|
||||
|| output_name == "drv"
|
||||
|| StorePath::validate_name(&output_name).is_err()
|
||||
{
|
||||
return Err(DerivationError::InvalidInputDerivationOutputName(
|
||||
input_derivation_path.to_string(),
|
||||
output_name.to_string(),
|
||||
|
|
Loading…
Reference in a new issue