From: Michael Tremer Date: Fri, 16 Dec 2022 10:26:05 +0000 (+0000) Subject: build: Do not add dependencies to files provided by the same package X-Git-Tag: 0.9.29~413 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7aacb6712de863df718ec104c2a6abad27c6165;p=pakfire.git build: Do not add dependencies to files provided by the same package Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index d0be3ce9e..93b8bf58a 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -316,18 +316,32 @@ ERROR: static int pakfire_build_process_deps(struct pakfire* pakfire, void* data, int priority, const char* buffer, const size_t length) { const struct pakfire_find_deps_ctx* ctx = (struct pakfire_find_deps_ctx*)data; + char dep[PATH_MAX]; int r; + // Nothing to do for an empty buffer + if (!buffer || !*buffer) + return 0; + switch (priority) { // Add every dependency that we have received case LOG_INFO: + // Copy the dependency to the stack (and remove the trailing newline) + r = pakfire_string_format(dep, "%.*s", (int)length - 1, buffer); + if (r) + return r; + + DEBUG(pakfire, "Processing dependency: %s\n", dep); + // Filter out any dependencies that are provided by this package if (ctx->dep == PAKFIRE_PKG_REQUIRES) { - if (pakfire_package_matches_dep(ctx->pkg, PAKFIRE_PKG_PROVIDES, buffer)) { - DEBUG(pakfire, - "Skipping dependency that is provided by the package itself: %s\n", buffer); - return 0; - } + // If this is a file, we check if it is on the filelist + if (pakfire_filelist_contains(ctx->filelist, dep)) + goto SKIP; + + // Otherwise check if this dependency is provided by this package + else if (pakfire_package_matches_dep(ctx->pkg, PAKFIRE_PKG_PROVIDES, dep)) + goto SKIP; } // Add dependency @@ -344,6 +358,11 @@ static int pakfire_build_process_deps(struct pakfire* pakfire, break; } + return 0; + +SKIP: + DEBUG(pakfire, "Skipping dependency that is provided by the package itself: %s\n", dep); + return 0; }