size_t l = skip(&p, &n);
// Add name to pool
- if (pakfire_string_startswith(n, "pakfire("))
+ if (pakfire_string_startswith(n, "pakfire(") || pakfire_string_startswith(n, "arch("))
id = pakfire_parse_namespace(pool, n);
else
id = pool_strn2id(pool, n, l, 1);
DEBUG(pakfire, "pool: %s", s);
}
+static Id pakfire_handle_ns_pakfire(struct pakfire* pakfire, const char* name) {
+ // Find all supported features
+ for (const struct pakfire_feature* feature = features; feature->name; feature++) {
+ if (strcmp(feature->name, name) == 0)
+ return 1;
+ }
+
+ // Not supported
+ return 0;
+}
+
+static Id pakfire_handle_ns_arch(struct pakfire* pakfire, const char* name) {
+ const char* arch = pakfire_get_arch(pakfire);
+
+ return strcmp(arch, name) == 0;
+}
+
static Id pakfire_namespace_callback(Pool* pool, void* data, Id ns, Id id) {
struct pakfire* pakfire = (struct pakfire*)data;
DEBUG(pakfire, "Namespace callback called for %s(%s)\n", namespace, name);
- // We only handle the pakfire namesapce
- if (strcmp(namespace, "pakfire") != 0)
- return 0;
+ // Handle the pakfire() namespace
+ if (strcmp(namespace, "pakfire") == 0)
+ return pakfire_handle_ns_pakfire(pakfire, name);
- // Find all supported features
- for (const struct pakfire_feature* feature = features; feature->name; feature++) {
- if (strcmp(feature->name, name) == 0)
- return 1;
- }
+ // Handle the arch() namespace
+ else if (strcmp(namespace, "arch") == 0)
+ return pakfire_handle_ns_arch(pakfire, name);
- // Not supported
- return 0;
+ // Not handled here
+ else
+ return 0;
}
static int pakfire_populate_pool(struct pakfire* pakfire) {