Merge pull request #38 from nix-community/fix-malformed-gens

lanzatool: ignore malformed generations
This commit is contained in:
nikstur 2022-12-26 02:51:15 +01:00 committed by GitHub
commit 46df12d579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -36,10 +36,18 @@ impl Installer {
pub fn install(&self) -> Result<()> { pub fn install(&self) -> Result<()> {
for toplevel in &self.generations { for toplevel in &self.generations {
let generation = Generation::from_toplevel(toplevel).with_context(|| { let generation_result = Generation::from_toplevel(toplevel).with_context(|| {
format!("Failed to build generation from toplevel: {toplevel:?}") format!("Failed to build generation from toplevel: {toplevel:?}")
})?; });
let generation = match generation_result {
Ok(generation) => generation,
Err(e) => {
println!("Malformed generation: {:?}", e);
continue;
}
};
println!("Installing generation {generation}"); println!("Installing generation {generation}");
self.install_generation(&generation) self.install_generation(&generation)