]> git.ipfire.org Git - pakfire.git/commitdiff
build: Use convenience function to match filenames
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Jan 2025 17:29:33 +0000 (17:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Jan 2025 17:29:33 +0000 (17:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/build.c

index c7bfa22ef4c3d28ee9bcb8f2311bf0a58ba43b10..cd4526d05d96598ee8b9bc9e03266bd22a457c86 100644 (file)
@@ -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;