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
break;
}
+ return 0;
+
+SKIP:
+ DEBUG(pakfire, "Skipping dependency that is provided by the package itself: %s\n", dep);
+
return 0;
}