When generating a CAB Silo use the prefix "components"

This makes fu_engine_get_details use a more standard prefix.
This commit is contained in:
Mario Limonciello 2019-01-26 00:31:58 -06:00 committed by Richard Hughes
parent 0a212fd1d6
commit 51ddf18faa
5 changed files with 16 additions and 14 deletions

View File

@ -187,6 +187,9 @@ fu_common_store_from_cab_file (XbBuilder *builder, GCabCabinet *cabinet,
g_autoptr(GError) error_local = NULL;
g_autoptr(XbBuilderSource) source = xb_builder_source_new ();
/* rewrite to be under a components root */
xb_builder_source_set_prefix (source, "components");
/* parse file */
#ifdef HAVE_GCAB_1_0
blob = gcab_file_get_bytes (cabfile);
@ -440,8 +443,7 @@ fu_common_cab_build_silo (GBytes *blob, guint64 size_max, GError **error)
if (silo == NULL)
return NULL;
/* this looks weird, but metainfo files have no <components> node */
components = xb_silo_query (silo, "component", 0, &error_local);
components = xb_silo_query (silo, "components/component", 0, &error_local);
if (components == NULL) {
g_set_error (error,
FWUPD_ERROR,

View File

@ -2250,7 +2250,7 @@ fu_engine_get_details (FuEngine *self, gint fd, GError **error)
silo = fu_engine_get_silo_from_blob (self, blob, error);
if (silo == NULL)
return NULL;
components = xb_silo_query (silo, "component", 0, &error_local);
components = xb_silo_query (silo, "components/component", 0, &error_local);
if (components == NULL) {
g_set_error (error,
FWUPD_ERROR,
@ -2261,10 +2261,10 @@ fu_engine_get_details (FuEngine *self, gint fd, GError **error)
}
/* build the index */
if (!xb_silo_query_build_index (silo, "component/provides/firmware",
if (!xb_silo_query_build_index (silo, "components/component/provides/firmware",
"type", error))
return FALSE;
if (!xb_silo_query_build_index (silo, "component/provides/firmware",
if (!xb_silo_query_build_index (silo, "components/component/provides/firmware",
NULL, error))
return FALSE;

View File

@ -599,7 +599,7 @@ fu_main_install_with_helper (FuMainAuthHelper *helper_ref, GError **error)
return FALSE;
/* for each component in the silo */
components = xb_silo_query (helper->silo, "component", 0, error);
components = xb_silo_query (helper->silo, "components/component", 0, error);
if (components == NULL)
return FALSE;
helper->action_ids = g_ptr_array_new_with_free_func (g_free);

View File

@ -591,7 +591,7 @@ fu_engine_require_hwid_func (void)
fu_engine_add_device (engine, device);
/* get component */
component = xb_silo_query_first (silo, "component/id[text()='com.hughski.test.firmware']/..", &error);
component = xb_silo_query_first (silo, "components/component/id[text()='com.hughski.test.firmware']/..", &error);
g_assert_no_error (error);
g_assert_nonnull (component);
@ -896,7 +896,7 @@ fu_engine_history_func (void)
g_assert_nonnull (silo);
/* get component */
component = xb_silo_query_first (silo, "component/id[text()='com.hughski.test.firmware']/..", &error);
component = xb_silo_query_first (silo, "components/component/id[text()='com.hughski.test.firmware']/..", &error);
g_assert_no_error (error);
g_assert_nonnull (component);
@ -1023,7 +1023,7 @@ fu_engine_history_error_func (void)
silo = fu_engine_get_silo_from_blob (engine, blob_cab, &error);
g_assert_no_error (error);
g_assert_nonnull (silo);
component = xb_silo_query_first (silo, "component/id[text()='com.hughski.test.firmware']/..", &error);
component = xb_silo_query_first (silo, "components/component/id[text()='com.hughski.test.firmware']/..", &error);
g_assert_no_error (error);
g_assert_nonnull (component);
task = fu_install_task_new (device, component);
@ -2595,7 +2595,7 @@ fu_plugin_composite_func (void)
silo = fu_common_cab_build_silo (blob, 10240, &error);
g_assert_no_error (error);
g_assert_nonnull (silo);
components = xb_silo_query (silo, "component", 0, &error);
components = xb_silo_query (silo, "components/component", 0, &error);
g_assert_no_error (error);
g_assert_nonnull (components);
g_assert_cmpint (components->len, ==, 3);
@ -2742,7 +2742,7 @@ fu_common_store_cab_func (void)
g_assert_nonnull (silo);
/* verify */
component = xb_silo_query_first (silo, "component/id[text()='com.acme.example.firmware']/..", &error);
component = xb_silo_query_first (silo, "components/component/id[text()='com.acme.example.firmware']/..", &error);
g_assert_no_error (error);
g_assert_nonnull (component);
rel = xb_node_query_first (component, "releases/release", &error);
@ -2792,7 +2792,7 @@ fu_common_store_cab_unsigned_func (void)
g_assert_nonnull (silo);
/* verify */
component = xb_silo_query_first (silo, "component/id[text()='com.acme.example.firmware']/..", &error);
component = xb_silo_query_first (silo, "components/component/id[text()='com.acme.example.firmware']/..", &error);
g_assert_no_error (error);
g_assert_nonnull (component);
rel = xb_node_query_first (component, "releases/release", &error);
@ -2837,7 +2837,7 @@ fu_common_store_cab_folder_func (void)
g_assert_nonnull (silo);
/* verify */
component = xb_silo_query_first (silo, "component/id[text()='com.acme.example.firmware']/..", &error);
component = xb_silo_query_first (silo, "components/component/id[text()='com.acme.example.firmware']/..", &error);
g_assert_no_error (error);
g_assert_nonnull (component);
rel = xb_node_query_first (component, "releases/release", &error);

View File

@ -731,7 +731,7 @@ fu_util_install (FuUtilPrivate *priv, gchar **values, GError **error)
silo = fu_engine_get_silo_from_blob (priv->engine, blob_cab, error);
if (silo == NULL)
return FALSE;
components = xb_silo_query (silo, "component", 0, error);
components = xb_silo_query (silo, "components/component", 0, error);
if (components == NULL)
return FALSE;