void pakfire_package_add_suggests(struct pakfire_package* pkg, const char* dep);
void pakfire_package_add_supplements(struct pakfire_package* pkg, const char* dep);
void pakfire_package_add_enhances(struct pakfire_package* pkg, const char* dep);
+int pakfire_package_has_rich_deps(struct pakfire_package* pkg);
#endif
return r;
}
+static int pakfire_package_has_rich_deps_in_deparray(
+ struct pakfire_package* pkg, Id type) {
+ int r = 0;
+
+ Solvable* s = get_solvable(pkg);
+
+ Queue q;
+ queue_init(&q);
+
+ // Fetch all deps
+ solvable_lookup_deparray(s, type, &q, 0);
+
+ // Nothing to do if the array was empty
+ if (!q.count)
+ goto ERROR;
+
+ for (int i = 0; i < q.count; i++) {
+ const char* dep = pakfire_dep2str(pkg->pakfire, q.elements[i]);
+
+ // Is this a rich dependency?
+ if (dep && *dep == '(') {
+ r = 1;
+ break;
+ }
+ }
+
+ERROR:
+ queue_free(&q);
+
+ return r;
+}
+
+int pakfire_package_has_rich_deps(struct pakfire_package* pkg) {
+ static const Id types[] = {
+ // Requires (includes pre-requires)
+ SOLVABLE_REQUIRES,
+ SOLVABLE_PROVIDES,
+ SOLVABLE_CONFLICTS,
+ SOLVABLE_OBSOLETES,
+ SOLVABLE_RECOMMENDS,
+ SOLVABLE_SUGGESTS,
+ SOLVABLE_SUPPLEMENTS,
+ SOLVABLE_ENHANCES,
+ 0,
+ };
+
+ for (const Id* type = types; *type; type++) {
+ int r = pakfire_package_has_rich_deps_in_deparray(pkg, *type);
+ if (r)
+ return r;
+ }
+
+ // No match
+ return 0;
+}
+
PAKFIRE_EXPORT struct pakfire_repo* pakfire_package_get_repo(struct pakfire_package* pkg) {
if (!pkg->repo) {
Solvable* s = get_solvable(pkg);
FILE* fmtree = NULL;
int r = 1;
+ // Add requires feature markers
+ if (pakfire_package_has_rich_deps(packager->pkg))
+ pakfire_package_add_requires(packager->pkg, "pakfire(RichDependencies)");
+
// Store total install size
pakfire_package_set_installsize(packager->pkg, packager->installsize);