From d9402b8ce46a02aebbab5afacad2088184f4c908 Mon Sep 17 00:00:00 2001 From: Fabio Forni Date: Fri, 26 Jul 2024 12:48:50 +0200 Subject: [PATCH] moss: Adapt boot.rs to the new fnmatch API --- moss/src/client/boot.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/moss/src/client/boot.rs b/moss/src/client/boot.rs index bd8b5d25..dc446df8 100644 --- a/moss/src/client/boot.rs +++ b/moss/src/client/boot.rs @@ -28,10 +28,6 @@ pub enum Error { #[error("os_release: {0}")] OsRelease(#[from] os_release::Error), - /// fnmatch pattern compilation for boot, etc. - #[error("fnmatch pattern: {0}")] - Pattern(#[from] fnmatch::Error), - #[error("incomplete kernel tree: {0}")] IncompleteKernel(String), } @@ -62,7 +58,7 @@ fn kernel_files_from_state<'a>( for (_, path) in layouts.iter() { match &path.entry { layout::Entry::Regular(_, target) => { - if pattern.match_path(target).is_some() { + if pattern.matches(target).is_some() { kernel_entries.push(KernelCandidate { path: install.root.join("usr").join(target), _layout: path, @@ -70,7 +66,7 @@ fn kernel_files_from_state<'a>( } } layout::Entry::Symlink(_, target) => { - if pattern.match_path(target).is_some() { + if pattern.matches(target).is_some() { kernel_entries.push(KernelCandidate { path: install.root.join("usr").join(target), _layout: path, @@ -94,7 +90,7 @@ fn boot_files_from_state<'a>( for (_, path) in layouts.iter() { if let layout::Entry::Regular(_, target) = &path.entry { - if pattern.match_path(target).is_some() { + if pattern.matches(target).is_some() { rets.push(install.root.join("usr").join(target)); } } @@ -116,8 +112,8 @@ pub fn synchronize(install: &Installation, layouts: &[(Id, Layout)]) -> Result<( vfs: "/".into(), }; - let pattern = fnmatch::Pattern::from_str("lib/kernel/(version:*)/*")?; - let systemd = fnmatch::Pattern::from_str("lib*/systemd/boot/efi/*.efi")?; + let pattern = fnmatch::Pattern::from_str("lib/kernel/(version:*)/*").unwrap(); // TODO: Do not return Infallible? + let systemd = fnmatch::Pattern::from_str("lib*/systemd/boot/efi/*.efi").unwrap(); // TODO: Do not return Infallible? let booty_bits = boot_files_from_state(install, layouts, &systemd); // No kernels? No bother.