From 6b70e4d498fe0d0fb6173646d8282ae24fb2a5ea Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 8 Jan 2025 11:36:25 +0000 Subject: [PATCH] linter: Move skipping files we never want to lint This saves us from initializing the linter and reading the entire payload. Signed-off-by: Michael Tremer --- src/pakfire/linter-file.c | 14 +------------- src/pakfire/linter.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pakfire/linter-file.c b/src/pakfire/linter-file.c index 18c850397..ad2973434 100644 --- a/src/pakfire/linter-file.c +++ b/src/pakfire/linter-file.c @@ -504,20 +504,8 @@ int pakfire_linter_file_lint(struct pakfire_linter_file* lfile) { if (r < 0) return r; - // Skip firmware files - if (pakfire_file_matches(lfile->file, "/usr/lib/firmware/**")) - return 0; - - // Skip GRUB files - else if (pakfire_file_matches(lfile->file, "/usr/lib/grub/**")) - return 0; - - // Skip valgrind files - else if (pakfire_file_matches(lfile->file, "/usr/lib/valgrind/*")) - return 0; - // Check debug files - else if (pakfire_file_matches(lfile->file, "/usr/lib/debug/**")) + if (pakfire_file_matches(lfile->file, "/usr/lib/debug/**")) return pakfire_linter_file_check_debug(lfile); // ELF Checks diff --git a/src/pakfire/linter.c b/src/pakfire/linter.c index 8606b2a99..8052bd413 100644 --- a/src/pakfire/linter.c +++ b/src/pakfire/linter.c @@ -352,6 +352,18 @@ static int pakfire_linter_payload( int fd = -EBADF; int r; + // Skip firmware files + if (pakfire_file_matches(file, "/usr/lib/firmware/**")) + return 0; + + // Skip GRUB files + else if (pakfire_file_matches(file, "/usr/lib/grub/**")) + return 0; + + // Skip valgrind files + else if (pakfire_file_matches(file, "/usr/lib/valgrind/*")) + return 0; + // Fetch path const char* path = pakfire_file_get_path(file); -- 2.47.3