diff --git a/Cargo.lock b/Cargo.lock index 8ec6bb7..8a7a946 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,6 +93,26 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "const_format" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4556f63e28a78fa5e6f310cfea5647a25636def49a338ab69e33b34a3382057b" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552782506c398da94466b364973b563887e0ca078bf33a76d4163736165e3594" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "directories" version = "3.0.2" @@ -193,6 +213,7 @@ dependencies = [ "igloo_base", "igloo_cli", "igloo_manifest", + "sscanf", "zmq", ] @@ -202,6 +223,7 @@ version = "0.1.0" dependencies = [ "config", "igloo_base", + "sscanf", ] [[package]] @@ -463,6 +485,30 @@ dependencies = [ "serde 0.8.23", ] +[[package]] +name = "sscanf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a812bcc6cd3cb6f4832fd68dfd2ce835901ddd592d181b5e5a63f8e1d66257ec" +dependencies = [ + "const_format", + "lazy_static", + "regex", + "sscanf_macro", +] + +[[package]] +name = "sscanf_macro" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7462034123ad94cc80b60b48d262e622e3689ab25e53ab7a1b8e05c89b98c65" +dependencies = [ + "proc-macro2", + "quote", + "regex-syntax", + "syn", +] + [[package]] name = "static_assertions" version = "1.1.0" diff --git a/igloo_core/Cargo.toml b/igloo_core/Cargo.toml index 6b0aae0..2c32a07 100644 --- a/igloo_core/Cargo.toml +++ b/igloo_core/Cargo.toml @@ -12,4 +12,5 @@ config = "0.10" igloo_base = { path = "../igloo_base" } igloo_cli = { path = "../igloo_cli" } igloo_manifest = { path = "../igloo_manifest" } +sscanf = "0.1.2" zmq = "0.9" \ No newline at end of file diff --git a/igloo_manifest/Cargo.toml b/igloo_manifest/Cargo.toml index 5a07205..203f45e 100644 --- a/igloo_manifest/Cargo.toml +++ b/igloo_manifest/Cargo.toml @@ -9,3 +9,4 @@ edition = "2018" [dependencies] igloo_base = { path = "../igloo_base" } config = "0.10" +sscanf = "0.1.2" diff --git a/igloo_manifest/src/.#lib.rs b/igloo_manifest/src/.#lib.rs deleted file mode 120000 index 06ed8ad..0000000 --- a/igloo_manifest/src/.#lib.rs +++ /dev/null @@ -1 +0,0 @@ -penguin@penguin-arch-home.8452:1632509282 \ No newline at end of file diff --git a/igloo_manifest/src/lib.rs b/igloo_manifest/src/lib.rs index 7d0069c..f90ca58 100644 --- a/igloo_manifest/src/lib.rs +++ b/igloo_manifest/src/lib.rs @@ -3,7 +3,7 @@ /// For now, all functionality is going to sit in this lib.rs until I figure out /// how I want to structure manifests extern crate config; - +extern crate sscanf; #[cfg(test)] mod tests { #[test] @@ -31,20 +31,28 @@ pub mod IglooManifest } let mut target_make_name: String = String::default(); + // Confirm the target.make table exists in the master target manifest match master_tm.get_table("target.make") { Ok(v) => { + // Confirm the target exists in the target.make table + // What this actually means is make sure we can use the target name + // to acquire the target's name in the master make manifest match v.get(name) { Some(v) => { + // Now we've confirmed the target has an entry in the target.make table println!("target.make entry for \"{}\" exists!", v); + // store the target's full name for use in the master make manifest later target_make_name = v.to_string(); - println!("v.to_string() = {}", target_make_name); } None => { + // if we've gotten to this point and failed, it simply means the target doesn't have + // a full name set in the target.make table. We need this for accessing it's makefile parameters + // later, so we'll need to go add that now. println!("target.make entry for \"{}\" does not exist", name); ret = false; } @@ -87,6 +95,52 @@ pub mod IglooManifest } } + // Now confirm the target has an entry in the master make manifest + // strip the name for usable pieces of information + let (dummy, arch, family, mcu_name) = sscanf::scanf!( + target_make_name, "{}.{}.{}.{}", String, String, String, String).unwrap(); + // verify an entry exists for the arch + match master_mm.get_table(&format!("{}.{}", dummy, arch)) + { + Ok(_v) => + { + println!("Make parameters found for arch"); + } + Err(e) => + { + println!("Make parameters not found: {}", e); + ret = false; + } + } + + // verify an entry exists for the mcu family + // later this will be family, then series, then mcu + match master_mm.get_table(&format!("{}.{}.{}", dummy, arch, family)) + { + Ok(_v) => + { + println!("Make parameters found for mcu family"); + } + Err(e) => + { + println!("Make parameters not found: {}", e); + ret = false; + } + } + + // finally, ver + match master_mm.get_table(&format!("{}.{}.{}.{}", dummy, arch, family, mcu_name)) + { + Ok(_v) => + { + println!("Make parameters found for mcu family"); + } + Err(e) => + { + println!("Make parameters not found: {}", e); + ret = false; + } + } Ok(ret) }