refactor(tvix/glue/known_paths): use StorePath
Passing a StorePathRef is annoying if we only (already) have a StorePath. Change-Id: Ic3b36c0041707230515a6745a57f0d25b2bafd16 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10948 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: Peter Kolloch <info@eigenvalue.net>
This commit is contained in:
parent
cc8b7fee57
commit
8cd93f3db5
2 changed files with 5 additions and 9 deletions
|
@ -443,7 +443,7 @@ pub(crate) mod derivation_builtins {
|
||||||
// This one is still intermediate (so not added to known_paths)
|
// This one is still intermediate (so not added to known_paths)
|
||||||
let derivation_or_fod_hash_tmp = drv.derivation_or_fod_hash(|drv_path| {
|
let derivation_or_fod_hash_tmp = drv.derivation_or_fod_hash(|drv_path| {
|
||||||
known_paths
|
known_paths
|
||||||
.get_hash_derivation_modulo(drv_path)
|
.get_hash_derivation_modulo(&drv_path.to_owned())
|
||||||
.unwrap_or_else(|| panic!("{} not found", drv_path))
|
.unwrap_or_else(|| panic!("{} not found", drv_path))
|
||||||
.to_owned()
|
.to_owned()
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,11 +8,7 @@
|
||||||
//! This data is required to find the derivation needed to actually trigger the
|
//! This data is required to find the derivation needed to actually trigger the
|
||||||
//! build, if necessary.
|
//! build, if necessary.
|
||||||
|
|
||||||
use nix_compat::{
|
use nix_compat::{derivation::Derivation, nixhash::NixHash, store_path::StorePath};
|
||||||
derivation::Derivation,
|
|
||||||
nixhash::NixHash,
|
|
||||||
store_path::{StorePath, StorePathRef},
|
|
||||||
};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
/// Struct keeping track of all known Derivations in the current evaluation.
|
/// Struct keeping track of all known Derivations in the current evaluation.
|
||||||
|
@ -34,9 +30,9 @@ pub struct KnownPaths {
|
||||||
|
|
||||||
impl KnownPaths {
|
impl KnownPaths {
|
||||||
/// Fetch the opaque "hash derivation modulo" for a given derivation path.
|
/// Fetch the opaque "hash derivation modulo" for a given derivation path.
|
||||||
pub fn get_hash_derivation_modulo(&self, drv_path: &StorePathRef) -> Option<&NixHash> {
|
pub fn get_hash_derivation_modulo(&self, drv_path: &StorePath) -> Option<&NixHash> {
|
||||||
self.derivations
|
self.derivations
|
||||||
.get(&drv_path.to_owned())
|
.get(drv_path)
|
||||||
.map(|(hash_derivation_modulo, _derivation)| hash_derivation_modulo)
|
.map(|(hash_derivation_modulo, _derivation)| hash_derivation_modulo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +72,7 @@ impl KnownPaths {
|
||||||
|
|
||||||
// compute the hash derivation modulo
|
// compute the hash derivation modulo
|
||||||
let hash_derivation_modulo = drv.derivation_or_fod_hash(|drv_path| {
|
let hash_derivation_modulo = drv.derivation_or_fod_hash(|drv_path| {
|
||||||
self.get_hash_derivation_modulo(drv_path)
|
self.get_hash_derivation_modulo(&drv_path.to_owned())
|
||||||
.unwrap_or_else(|| panic!("{} not found", drv_path))
|
.unwrap_or_else(|| panic!("{} not found", drv_path))
|
||||||
.to_owned()
|
.to_owned()
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue