/** * as_pool_update_addon_info: * * Populate the "extensions" property of an #AsComponent, using the * "extends" information from other components. */ static void as_pool_update_addon_info (AsPool *pool, AsComponent *cpt) { guint i; GPtrArray *extends; AsPoolPrivate *priv = GET_PRIVATE (pool); extends = as_component_get_extends (cpt); if ((extends == NULL) || (extends->len == 0)) return; for (i = 0; i < extends->len; i++) { AsComponent *extended_cpt; g_autofree gchar *extended_cdid = NULL; const gchar *extended_cid = (const gchar*) g_ptr_array_index (extends, i); extended_cdid = as_utils_build_data_id ("system", "os", as_utils_get_component_bundle_kind (cpt), extended_cid); extended_cpt = g_hash_table_lookup (priv->cpt_table, extended_cdid); if (extended_cpt == NULL) { g_debug ("%s extends %s, but %s was not found.", as_component_get_data_id (cpt), extended_cdid, extended_cdid); return; } /* don't act if we already have addons */ if (as_component_get_addons (extended_cpt)->len > 0) continue; as_component_add_addon (extended_cpt, cpt); } }
/** * as_utils_build_data_id_for_cpt: * @cpt: The component to build the ID for. * * Builds the unique metadata ID for component @cpt. */ gchar* as_utils_build_data_id_for_cpt (AsComponent *cpt) { const gchar *origin; AsBundleKind bundle_kind; /* determine bundle - what should we do if there are multiple bundles of different types * defined for one component? */ bundle_kind = as_utils_get_component_bundle_kind (cpt); /* NOTE: packages share one namespace, therefore we edit the origin here for now. */ if (bundle_kind == AS_BUNDLE_KIND_PACKAGE) origin = "os"; else origin = as_component_get_origin (cpt); /* build the data-id */ return as_utils_build_data_id (as_component_get_scope (cpt), origin, bundle_kind, as_component_get_id (cpt)); }