chore(glue): upgrade to 2024 edition
Part of #114 cargo fix wanted to rewrite `if let else` to match statements, but i reverted them as they dont belong in this cl. There weren't any warnings about locks (relative drop order changed in 2024) Change-Id: I9c851ef8e214a481cbe7b4cf9b2634b5d56970d4 Reviewed-on: https://cl.snix.dev/c/snix/+/30369 Autosubmit: Bence Nemes <nemes.bence1@gmail.com> Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Reviewed-by: Florian Klink <flokli@flokli.de> Tested-by: besadii
This commit is contained in:
parent
916988a7a2
commit
1a84bc0e62
15 changed files with 36 additions and 32 deletions
|
|
@ -14335,7 +14335,7 @@ rec {
|
|||
"snix-glue" = rec {
|
||||
crateName = "snix-glue";
|
||||
version = "0.1.0";
|
||||
edition = "2021";
|
||||
edition = "2024";
|
||||
src = lib.cleanSourceWith { filter = sourceFilter; src = ./glue; };
|
||||
libName = "snix_glue";
|
||||
dependencies = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "snix-glue"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
async-compression = { workspace = true, features = [
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
use clap::Parser;
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use criterion::{Criterion, black_box, criterion_group, criterion_main};
|
||||
use mimalloc::MiMalloc;
|
||||
use snix_build::buildservice::DummyBuildService;
|
||||
use snix_eval::{builtins::impure_builtins, EvalIO};
|
||||
use snix_eval::{EvalIO, builtins::impure_builtins};
|
||||
use snix_glue::{
|
||||
builtins::{add_derivation_builtins, add_fetcher_builtins, add_import_builtins},
|
||||
configure_nix_path,
|
||||
snix_io::SnixIO,
|
||||
snix_store_io::SnixStoreIO,
|
||||
};
|
||||
use snix_store::utils::{construct_services, ServiceUrlsMemory};
|
||||
use snix_store::utils::{ServiceUrlsMemory, construct_services};
|
||||
use std::sync::LazyLock;
|
||||
use std::{env, rc::Rc, sync::Arc, time::Duration};
|
||||
|
||||
|
|
|
|||
2
snix/glue/rustfmt.toml
Normal file
2
snix/glue/rustfmt.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# FUTUREWORK: move to .. once all crates are migrated (#114)
|
||||
edition = "2024"
|
||||
|
|
@ -7,11 +7,11 @@ use nix_compat::derivation::{Derivation, Output};
|
|||
use nix_compat::nixhash;
|
||||
use nix_compat::store_path::{StorePath, StorePathRef};
|
||||
use snix_eval::builtin_macros::builtins;
|
||||
use snix_eval::generators::{self, emit_warning_kind, GenCo};
|
||||
use snix_eval::generators::{self, GenCo, emit_warning_kind};
|
||||
use snix_eval::{
|
||||
AddContext, ErrorKind, NixAttrs, NixContext, NixContextElement, Value, WarningKind,
|
||||
};
|
||||
use std::collections::{btree_map, BTreeSet};
|
||||
use std::collections::{BTreeSet, btree_map};
|
||||
use std::rc::Rc;
|
||||
|
||||
// Constants used for strangely named fields in derivation inputs.
|
||||
|
|
@ -146,7 +146,7 @@ fn handle_fixed_output(
|
|||
None | Some("flat") => Some(nixhash::CAHash::Flat(nixhash)),
|
||||
Some("recursive") => Some(nixhash::CAHash::Nar(nixhash)),
|
||||
Some(other) => {
|
||||
return Err(DerivationError::InvalidOutputHashMode(other.to_string()))?
|
||||
return Err(DerivationError::InvalidOutputHashMode(other.to_string()))?;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use super::utils::select_string;
|
||||
use crate::{
|
||||
fetchers::{url_basename, Fetch},
|
||||
fetchers::{Fetch, url_basename},
|
||||
snix_store_io::SnixStoreIO,
|
||||
};
|
||||
use nix_compat::nixhash;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
//! Implements builtins used to import paths in the store.
|
||||
|
||||
use crate::snix_store_io::SnixStoreIO;
|
||||
use snix_castore::import::ingest_entries;
|
||||
use snix_castore::Node;
|
||||
use snix_castore::import::ingest_entries;
|
||||
use snix_eval::{
|
||||
ErrorKind, EvalIO, Value,
|
||||
builtin_macros::builtins,
|
||||
generators::{self, GenCo},
|
||||
ErrorKind, EvalIO, Value,
|
||||
};
|
||||
use std::path::Path;
|
||||
|
||||
|
|
@ -112,13 +112,13 @@ mod import_builtins {
|
|||
use crate::snix_store_io::SnixStoreIO;
|
||||
use bstr::ByteSlice;
|
||||
use nix_compat::nixhash::{CAHash, NixHash};
|
||||
use nix_compat::store_path::{build_ca_path, StorePath, StorePathRef};
|
||||
use nix_compat::store_path::{StorePath, StorePathRef, build_ca_path};
|
||||
use sha2::Digest;
|
||||
use snix_castore::blobservice::BlobService;
|
||||
use snix_eval::builtins::coerce_value_to_path;
|
||||
use snix_eval::generators::Gen;
|
||||
use snix_eval::{generators::GenCo, ErrorKind, Value};
|
||||
use snix_eval::{AddContext, FileType, NixContext, NixContextElement, NixString};
|
||||
use snix_eval::{ErrorKind, Value, generators::GenCo};
|
||||
use snix_store::path_info::PathInfo;
|
||||
use std::rc::Rc;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
|
@ -239,7 +239,7 @@ mod import_builtins {
|
|||
}
|
||||
|
||||
FileType::Directory if !recursive_ingestion => {
|
||||
return Err(ImportError::FlatImportOfNonFile(path))?
|
||||
return Err(ImportError::FlatImportOfNonFile(path))?;
|
||||
}
|
||||
|
||||
// do the filtered ingest
|
||||
|
|
@ -265,7 +265,7 @@ mod import_builtins {
|
|||
std::io::ErrorKind::Unsupported,
|
||||
"unsupported file type",
|
||||
)),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ mod import_builtins {
|
|||
return Err(ErrorKind::TypeError {
|
||||
expected: "string or path",
|
||||
actual: path.type_of(),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ mod tests {
|
|||
use rstest::rstest;
|
||||
use snix_build::buildservice::DummyBuildService;
|
||||
use snix_eval::{EvalIO, EvaluationResult};
|
||||
use snix_store::utils::{construct_services, ServiceUrlsMemory};
|
||||
use snix_store::utils::{ServiceUrlsMemory, construct_services};
|
||||
use tempfile::TempDir;
|
||||
|
||||
/// evaluates a given nix expression and returns the result.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use bstr::ByteSlice;
|
||||
use snix_eval::{
|
||||
generators::{self, GenCo},
|
||||
CatchableErrorKind, CoercionKind, ErrorKind, NixAttrs, NixString, Value,
|
||||
generators::{self, GenCo},
|
||||
};
|
||||
|
||||
pub(super) async fn strong_importing_coerce_to_string(
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
use futures::TryStreamExt;
|
||||
use md5::{digest::DynDigest, Md5};
|
||||
use md5::{Md5, digest::DynDigest};
|
||||
use nix_compat::{
|
||||
nixhash::{CAHash, HashAlgo, NixHash},
|
||||
store_path::{build_ca_path, BuildStorePathError, StorePathRef},
|
||||
store_path::{BuildStorePathError, StorePathRef, build_ca_path},
|
||||
};
|
||||
use sha1::Sha1;
|
||||
use sha2::{digest::Output, Digest, Sha256, Sha512};
|
||||
use snix_castore::{blobservice::BlobService, directoryservice::DirectoryService, Node};
|
||||
use sha2::{Digest, Sha256, Sha512, digest::Output};
|
||||
use snix_castore::{Node, blobservice::BlobService, directoryservice::DirectoryService};
|
||||
use snix_store::{
|
||||
nar::{NarCalculationService, NarIngestionError},
|
||||
pathinfoservice::{PathInfo, PathInfoService},
|
||||
};
|
||||
use tokio::io::{AsyncBufRead, AsyncRead, AsyncWrite, AsyncWriteExt, BufReader};
|
||||
use tokio_util::io::{InspectReader, InspectWriter};
|
||||
use tracing::{instrument, warn, Span};
|
||||
use tracing::{Span, instrument, warn};
|
||||
use tracing_indicatif::span_ext::IndicatifSpanExt;
|
||||
use url::Url;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub(crate) fn fetchurl_derivation_to_fetch(drv: &Derivation) -> Result<(String,
|
|||
url,
|
||||
exp_hash: Some(hash),
|
||||
},
|
||||
))
|
||||
));
|
||||
}
|
||||
CAHash::Nar(hash) => {
|
||||
if drv.environment.get("executable").map(|v| v.as_slice()) == Some(b"1") {
|
||||
|
|
|
|||
|
|
@ -279,9 +279,11 @@ mod tests {
|
|||
let mut known_paths = KnownPaths::default();
|
||||
|
||||
// get_fetch_for_output_path should return None for new fetches.
|
||||
assert!(known_paths
|
||||
assert!(
|
||||
known_paths
|
||||
.get_fetch_for_output_path(&FETCH_TARBALL_OUT_PATH)
|
||||
.is_none());
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// add_fetch should return the properly calculated store paths.
|
||||
assert_eq!(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub(crate) fn get_all_inputs<'a, F, Fut>(
|
|||
derivation: &'a Derivation,
|
||||
known_paths: &'a KnownPaths,
|
||||
get_path_info: F,
|
||||
) -> impl Stream<Item = Result<(StorePath<String>, Node), std::io::Error>>
|
||||
) -> impl Stream<Item = Result<(StorePath<String>, Node), std::io::Error>> + use<F, Fut>
|
||||
where
|
||||
F: Fn(StorePath<String>) -> Fut,
|
||||
Fut: Future<Output = std::io::Result<Option<PathInfo>>>,
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
use tokio_util::io::SyncIoBridge;
|
||||
use tracing::{error, instrument, warn, Level, Span};
|
||||
use tracing::{Level, Span, error, instrument, warn};
|
||||
use tracing_indicatif::span_ext::IndicatifSpanExt;
|
||||
|
||||
use snix_castore::{
|
||||
Node,
|
||||
blobservice::BlobService,
|
||||
directoryservice::{self, DirectoryService},
|
||||
Node,
|
||||
};
|
||||
use snix_store::pathinfoservice::{PathInfo, PathInfoService};
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ mod tests {
|
|||
use clap::Parser;
|
||||
use snix_build::buildservice::DummyBuildService;
|
||||
use snix_eval::{EvalIO, EvaluationResult};
|
||||
use snix_store::utils::{construct_services, ServiceUrlsMemory};
|
||||
use snix_store::utils::{ServiceUrlsMemory, construct_services};
|
||||
use tempfile::TempDir;
|
||||
|
||||
use super::SnixStoreIO;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use clap::Parser;
|
|||
use pretty_assertions::assert_eq;
|
||||
use snix_build::buildservice::DummyBuildService;
|
||||
use snix_eval::{EvalIO, EvalMode, Value};
|
||||
use snix_store::utils::{construct_services, ServiceUrlsMemory};
|
||||
use snix_store::utils::{ServiceUrlsMemory, construct_services};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rstest::rstest;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue