From: Michael Tremer Date: Fri, 3 Jan 2025 17:29:33 +0000 (+0000) Subject: build: Use convenience function to match filenames X-Git-Tag: 0.9.30~556 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f1c2ea841a037af1cc8b91f642d1c64cd722adb;p=pakfire.git build: Use convenience function to match filenames Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/build.c b/src/pakfire/build.c index c7bfa22ef..cd4526d05 100644 --- a/src/pakfire/build.c +++ b/src/pakfire/build.c @@ -713,24 +713,18 @@ static int pakfire_build_find_python_abi_requires( static int pakfire_build_find_provides( struct pakfire_ctx* ctx, struct pakfire_file* file, void* data) { struct pakfire_find_deps_ctx* deps = data; - const char* path = NULL; int r; - // Fetch the file path - path = pakfire_file_get_path(file); - if (!path) - return -EINVAL; - // Skip debug files - if (pakfire_path_match("/usr/lib/debug/**", path)) + if (pakfire_file_matches(file, "/usr/lib/debug/**")) return 0; // Skip debug sources - else if (pakfire_path_match("/usr/src/debug/**", path)) + else if (pakfire_file_matches(file, "/usr/src/debug/**")) return 0; // Handle pkg-config files - else if (pakfire_path_match("**.pc", path)) + else if (pakfire_file_matches(file ,"**.pc")) return pakfire_build_find_pkgconfig_provides(ctx, file, deps); // Split certain file types differently @@ -750,24 +744,18 @@ static int pakfire_build_find_provides( static int pakfire_build_find_requires( struct pakfire_ctx* ctx, struct pakfire_file* file, void* data) { struct pakfire_find_deps_ctx* deps = data; - const char* path = NULL; int r; - // Fetch the file path - path = pakfire_file_get_path(file); - if (!path) - return -EINVAL; - // Skip debug files - if (pakfire_path_match("/usr/lib/debug/**", path)) + if (pakfire_file_matches(file, "/usr/lib/debug/**")) return 0; // Skip debug sources - else if (pakfire_path_match("/usr/src/debug/**", path)) + else if (pakfire_file_matches(file, "/usr/src/debug/**")) return 0; // Handle pkg-config files - else if (pakfire_path_match("**.pc", path)) + else if (pakfire_file_matches(file, "**.pc")) return pakfire_build_find_pkgconfig_requires(ctx, file, deps); // Split certain file types differently @@ -783,7 +771,7 @@ static int pakfire_build_find_requires( // Directories case S_IFDIR: // Handle Python ABI - if (pakfire_path_match("/usr/lib*/python*", path)) { + if (pakfire_file_matches(file, "/usr/lib*/python*")) { r = pakfire_build_find_python_abi_requires(ctx, file, deps); if (r < 0) return r;