mirror of
https://github.com/DeterminateSystems/flake-checker.git
synced 2024-07-14 17:30:37 +03:00
Add enum variant for tarball nodes
This commit is contained in:
parent
639f58fb99
commit
c4f0c9a738
@ -149,6 +149,7 @@ fn chase_input_node(
|
||||
Node::Repo(node) => node.inputs.to_owned(),
|
||||
Node::Indirect(node) => node.inputs.to_owned(),
|
||||
Node::Path(node) => node.inputs.to_owned(),
|
||||
Node::Tarball(node) => node.inputs.to_owned(),
|
||||
Node::Fallthrough(node) => match node.get("inputs") {
|
||||
Some(node_inputs) => serde_json::from_value(node_inputs.clone())
|
||||
.map_err(FlakeLockParseError::Json)?,
|
||||
@ -203,6 +204,8 @@ pub enum Node {
|
||||
Indirect(IndirectNode),
|
||||
/// A [PathNode] flake input stemming from a filesystem path.
|
||||
Path(PathNode),
|
||||
/// TODO
|
||||
Tarball(TarballNode),
|
||||
/// A "catch-all" variant for node types that don't (yet) have explicit struct definitions in
|
||||
/// this crate.
|
||||
Fallthrough(serde_json::value::Value), // Covers all other node types
|
||||
@ -216,6 +219,7 @@ impl Node {
|
||||
Node::Repo(_) => "Repo",
|
||||
Node::Indirect(_) => "Indirect",
|
||||
Node::Path(_) => "Path",
|
||||
Node::Tarball(_) => "Tarball",
|
||||
Node::Fallthrough(_) => "Fallthrough", // Covers all other node types
|
||||
}
|
||||
}
|
||||
@ -353,3 +357,37 @@ pub struct PathOriginal {
|
||||
#[serde(alias = "type")]
|
||||
pub node_type: String,
|
||||
}
|
||||
|
||||
/// TODO
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct TarballNode {
|
||||
/// TODO
|
||||
pub locked: TarballLocked,
|
||||
/// TODO
|
||||
pub inputs: Option<HashMap<String, Input>>,
|
||||
/// TODO
|
||||
pub original: TarballOriginal,
|
||||
}
|
||||
|
||||
/// TODO
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct TarballLocked {
|
||||
/// The NAR hash of the input.
|
||||
#[serde(alias = "narHash")]
|
||||
pub nar_hash: String,
|
||||
/// The type of the node (always `"tarball"`).
|
||||
#[serde(alias = "type")]
|
||||
pub node_type: String,
|
||||
/// The URL used to fetch the tarball.
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
/// TODO
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct TarballOriginal {
|
||||
/// The URL for the tarball input.
|
||||
pub url: String,
|
||||
/// The type of the node (always `"tarball"`).
|
||||
#[serde(alias = "type")]
|
||||
pub node_type: String,
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_clean_flake_locks() {
|
||||
for n in 0..=6 {
|
||||
for n in 0..=7 {
|
||||
let path = PathBuf::from(format!("tests/flake.clean.{n}.lock"));
|
||||
let flake_lock = FlakeLock::new(&path).expect("couldn't create flake.lock");
|
||||
let config = FlakeCheckConfig {
|
||||
|
@ -138,7 +138,7 @@ impl Summary {
|
||||
|
||||
let summary_txt = handlebars.render("summary.txt", &self.data)?;
|
||||
|
||||
println!("{}", summary_txt);
|
||||
print!("{}", summary_txt);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
38
tests/flake.clean.7.lock
Normal file
38
tests/flake.clean.7.lock
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1689078114,
|
||||
"narHash": "sha256-osG8BrX5RpKJ7wH+vI6auOU+ctvNOblT4XXCgknK47c=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b6cc7ff8fee93789bc871a267ab876c3fca042cb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"sub": "sub"
|
||||
}
|
||||
},
|
||||
"sub": {
|
||||
"locked": {
|
||||
"narHash": "sha256-+qUhj8mkS6BsSFAOMQek346MHTEDkmoaojSBbLefq7w=",
|
||||
"type": "tarball",
|
||||
"url": "https://some-server.com/flake.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://some-server.com/flake.tar.gz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
Loading…
Reference in New Issue
Block a user