From 45ff0632b8a461c9cf0f56a9a5dc312a2775a661 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 10 Aug 2025 01:43:26 +0800 Subject: [PATCH] remove xtask bodges for MPW --- xtask/src/builder.rs | 2 + xtask/src/main.rs | 109 +------------------------------------------ 2 files changed, 3 insertions(+), 108 deletions(-) diff --git a/xtask/src/builder.rs b/xtask/src/builder.rs index 4806967be..4df2015b0 100644 --- a/xtask/src/builder.rs +++ b/xtask/src/builder.rs @@ -1269,6 +1269,7 @@ pub fn project_root() -> PathBuf { use std::fs::File; use std::io::{self, BufRead, BufReader}; +#[allow(dead_code)] pub fn search_and_replace_in_file(filename: &str, search: &str, replace: &str) -> io::Result<()> { let file = File::open(filename)?; let reader = BufReader::new(file); @@ -1287,6 +1288,7 @@ pub fn search_and_replace_in_file(filename: &str, search: &str, replace: &str) - Ok(()) } +#[allow(dead_code)] pub fn search_in_file(filename: &str, search: &str) -> io::Result { let file = File::open(filename)?; let reader = BufReader::new(file); diff --git a/xtask/src/main.rs b/xtask/src/main.rs index e89138f92..4507bc4bd 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -204,62 +204,6 @@ fn main() -> Result<(), Box> { builder.set_change_target_flag(); } - // manage an ugly patch we have to do to selectively configure AES for only cramium-soc targets - match builder::search_in_file("services/aes/Cargo.toml", "default = []") { - Ok(false) => { - builder::search_and_replace_in_file( - "services/aes/Cargo.toml", - "default = [\"cramium-soc\"]", - "default = []", - ) - .expect("couldn't patch AES"); - - // revert these just in case - but don't throw an error if the strings aren't found - builder::search_and_replace_in_file( - "Cargo.toml", - "# [patch.crates-io.curve25519-dalek]", - "[patch.crates-io.curve25519-dalek]", - ) - .ok(); - builder::search_and_replace_in_file( - "Cargo.toml", - "# git = \"https://github.com/betrusted-io/curve25519-dalek.git\"", - "git = \"https://github.com/betrusted-io/curve25519-dalek.git\"", - ) - .ok(); - builder::search_and_replace_in_file( - "Cargo.toml", - "# branch = \"main\" # c25519", - "branch = \"main\" # c25519", - ) - .ok(); - builder::search_and_replace_in_file( - "services/root-keys/Cargo.toml", - "# features = [\"auto-release\", \"warn-fallback\"]", - "features = [\"auto-release\", \"warn-fallback\"]", - ) - .ok(); - builder::search_and_replace_in_file( - "services/shellchat/Cargo.toml", - "# features = [\"auto-release\", \"warn-fallback\"]", - "features = [\"auto-release\", \"warn-fallback\"]", - ) - .ok(); - - match builder::search_in_file("services/aes/Cargo.toml", "default = []") { - Ok(false) => { - return Err( - "Couldn't revert services/aes/Cargo.toml -- is the file writeable or corrupted?" - .into(), - ); - } - _ => (), - } - } - _ => {} - } - let mut broken_aes_cleanup = false; - // ---- now process the verb plus position dependent arguments ---- let mut args = env::args(); let task = args.nth(1); @@ -588,7 +532,6 @@ fn main() -> Result<(), Box> { Some("cramium-soc") => builder.target_cramium_soc(), _ => panic!("should be unreachable"), }; - broken_aes_cleanup = true; for service in cramium_flash_pkgs { builder.add_service(service, LoaderRegion::Flash); @@ -685,7 +628,7 @@ fn main() -> Result<(), Box> { let bao_rram_pkgs = ["xous-ticktimer", "xous-log", "xous-names", "keystore" /* "usb-cramium" */].to_vec(); /* "usb-cramium" */ let bao_swap_pkgs = - ["cram-hal-service", "bao-console", /* "modals", "pddb", */ "bao-video"].to_vec(); /* "bao-video" */ + ["cram-hal-service", "bao-console", "modals", /* "pddb", */ "bao-video"].to_vec(); /* "bao-video" */ if !builder.is_swap_set() { builder.set_swap(0, 8 * 1024 * 1024); } @@ -716,7 +659,6 @@ fn main() -> Result<(), Box> { Some("baosec") => builder.target_cramium_soc(), _ => panic!("should be unreachable"), }; - broken_aes_cleanup = true; // It is important that this is the first service added, because the swapper *must* be in PID 2 builder.add_service("xous-swapper", LoaderRegion::Flash); @@ -756,55 +698,6 @@ fn main() -> Result<(), Box> { } builder.build()?; - // AES is broken in the current rev of the Cramium SoC. This unpatches the crate so other builds can - // work properly. - if broken_aes_cleanup { - builder::search_and_replace_in_file( - "services/aes/Cargo.toml", - "default = [\"cramium-soc\"]", - "default = []", - ) - .expect("couldn't patch AES"); - builder::search_and_replace_in_file( - "Cargo.toml", - "# [patch.crates-io.curve25519-dalek]", - "[patch.crates-io.curve25519-dalek]", - ) - .expect("couldn't patch curve25519"); - builder::search_and_replace_in_file( - "Cargo.toml", - "# git = \"https://github.com/betrusted-io/curve25519-dalek.git\"", - "git = \"https://github.com/betrusted-io/curve25519-dalek.git\"", - ) - .expect("couldn't patch curve25519"); - builder::search_and_replace_in_file( - "Cargo.toml", - "# branch = \"main\" # c25519", - "branch = \"main\" # c25519", - ) - .expect("couldn't patch curve25519"); - builder::search_and_replace_in_file( - "services/root-keys/Cargo.toml", - "# features = [\"auto-release\", \"warn-fallback\"]", - "features = [\"auto-release\", \"warn-fallback\"]", - ) - .expect("couldn't patch rootkeys"); - builder::search_and_replace_in_file( - "services/shellchat/Cargo.toml", - "# features = [\"auto-release\", \"warn-fallback\"]", - "features = [\"auto-release\", \"warn-fallback\"]", - ) - .expect("couldn't patch shellchat"); - } - match builder::search_in_file("services/aes/Cargo.toml", "default = []") { - Ok(false) => { - println!( - "Build configuration is out of sync: cramium-soc patch on AES crate was not cleared out" - ); - return Err("services/aes/Cargo.toml is in a bad state! Revert any patches to the file.".into()); - } - _ => {} - } // the intent of this call is to check that crates we are sourcing from crates.io // match the crates in our local source. The usual cause of an inconsistency is // a maintainer forgot to publish a change to crates.io.