*/
static int pakfire_build_find_deps(struct pakfire_build* build,
struct pakfire_package* pkg, int dep, const char* script,
- struct pakfire_filelist* filelist, const int class, const pcre2_code* filter) {
-
+ struct pakfire_filelist* filelist, int class, const pcre2_code* filter) {
// Construct the context
struct pakfire_find_deps_ctx ctx = {
.pkg = pkg,
};
int r;
+ // Skip calling the script if class doesn't match
+ if (class && !pakfire_filelist_matches_class(filelist, class)) {
+ DEBUG(build->pakfire, "Skipping calling %s as class does not match\n", script);
+ return 0;
+ }
+
// Pass the buildroot as first argument
const char* args[] = {
pakfire_relpath(build->pakfire, build->buildroot),
return 0;
}
+
+static int __pakfire_filelist_matches_class(struct pakfire* pakfire,
+ struct pakfire_file* file, void* p) {
+ int* class = (int*)p;
+
+ return pakfire_file_matches_class(file, *class);
+}
+
+/*
+ Returns true if any file on the list matches class
+*/
+int pakfire_filelist_matches_class(struct pakfire_filelist* list, int class) {
+ return pakfire_filelist_walk(list, __pakfire_filelist_matches_class, &class);
+}