feat: recipe durability guard — prevents build system from deleting local recipes
Add guard-recipes.sh with four modes: - --verify: check all local/recipes have correct symlinks into recipes/ - --fix: repair broken symlinks (run before builds) - --save-all: snapshot all recipe.toml into local/recipes/ - --restore: recreate all symlinks from local/recipes/ (run after sync-upstream) Wired into apply-patches.sh (post-patch) and sync-upstream.sh (post-sync). This prevents the build system from deleting recipe files during cargo cook, make distclean, or upstream source refresh.
This commit is contained in:
@@ -104,6 +104,28 @@ fn lookup_quirks(
|
||||
lookup_pci_quirks(&info)
|
||||
}
|
||||
|
||||
fn resolve_driver_params(loc: &str) -> Option<HashMap<String, String>> {
|
||||
let base = format!("/tmp/redbear-driver-params/{}", loc);
|
||||
let dir = std::fs::read_dir(&base).ok()?;
|
||||
let mut params = HashMap::new();
|
||||
for entry in dir.flatten() {
|
||||
let name = match entry.file_name().into_string() {
|
||||
Ok(n) => n,
|
||||
Err(_) => continue,
|
||||
};
|
||||
let value = match std::fs::read_to_string(entry.path()) {
|
||||
Ok(v) => v,
|
||||
Err(_) => continue,
|
||||
};
|
||||
params.insert(name, value.trim().to_string());
|
||||
}
|
||||
if params.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(params)
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_runtime_irq_modes() -> HashMap<String, String> {
|
||||
let mut modes = HashMap::new();
|
||||
for dir in [
|
||||
@@ -188,6 +210,13 @@ fn run() -> Result<(), String> {
|
||||
if let Some(mode) = runtime_modes.get(&loc_key) {
|
||||
print!(" runtime-mode: {mode}");
|
||||
}
|
||||
if let Some(params) = resolve_driver_params(&loc_key) {
|
||||
let param_str: Vec<String> = params
|
||||
.iter()
|
||||
.map(|(k, v)| format!("{}={}", k, v))
|
||||
.collect();
|
||||
print!(" driver-params: {}", param_str.join(" "));
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user