fu-util/fu-tool: Print devices, remotes, releases using a tree

This brings consistency to all fwupd output and allows stuff like
this:

```
    No upgrades for Thunderbolt controller in Dell dock, current is 43.00: 40.00=older
    No upgrades for Package level of Dell dock, current is 01.00.08.01: 01.00.04.01=older
    No upgrades for RTS5413 in Dell dock, current is 01.21: 01.21=same
    No upgrades for RTS5487 in Dell dock, current is 01.47: 01.47=same
    No upgrades for VMM5331 in Dell dock, current is 05.04.00: 05.03.10=older
    No upgrades for WD19TB, current is 01.00.00.02: 01.00.00.00=older
    ○
    └─XPS 13 9380 System Firmware:
      │   Device ID:           6c24a747f97668873b761558e322398a91dbf394
      │   Current version:     0.1.6.0
      │   Minimum Version:     0.1.6.0
      │   Vendor:              Dell Inc.
      │   Flags:               internal|updatable|require-ac|supported|registered|needs-reboot
      │
      └─XPS 13 9380 System Update:
            Version:           0.1.7.0
            Remote ID:         lvfs
            Summary:           Firmware for the Dell XPS 13 9380
            License:           proprietary
            Size:              0x1563d67
            Vendor:            Dell Inc.
            Flags:             is-upgrade
            Description:       This stable release fixes the following issues:

           Fixed the issue where the Dell Power Manager displays an error when a 130W Type-C adapter is connected to the system.

           new functionality has also been added:

           Added a new feature to automatically suspend BitLocker before upgrading the firmware. After the firmware upgrade is complete, BitLocker is automatically enabled.
```
This commit is contained in:
Mario Limonciello 2019-08-29 09:53:44 -05:00 committed by Mario Limonciello
parent dfff18e3e8
commit 4250d9da62
4 changed files with 210 additions and 167 deletions

View File

@ -298,6 +298,7 @@ static gboolean
fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GPtrArray) devices = NULL;
g_autoptr(GNode) root = g_node_new (NULL);
/* load engine */
if (!fu_util_start_engine (priv, FU_ENGINE_LOAD_FLAG_NONE, error))
@ -311,6 +312,7 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
FwupdDevice *dev = g_ptr_array_index (devices, i);
g_autoptr(GPtrArray) rels = NULL;
g_autoptr(GError) error_local = NULL;
GNode *child;
/* not going to have results, so save a engine round-trip */
if (!fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_SUPPORTED))
@ -326,15 +328,15 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
g_printerr ("%s\n", error_local->message);
continue;
}
g_print ("%s", fu_util_device_to_string (dev, 0));
g_print (" Release information:\n");
/* print all releases */
child = g_node_append_data (root, dev);
for (guint j = 0; j < rels->len; j++) {
FwupdRelease *rel = g_ptr_array_index (rels, j);
g_print ("%s\n", fwupd_release_to_string (rel));
g_node_append_data (child, g_object_ref (rel));
}
}
if (g_node_n_nodes (root, G_TRAVERSE_ALL) > 1)
fu_util_print_tree (root, priv);
/* save the device state for other applications to see */
if (!fu_util_save_current_state (priv, error))
return FALSE;
@ -347,6 +349,7 @@ static gboolean
fu_util_get_details (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GPtrArray) array = NULL;
g_autoptr(GNode) root = g_node_new (NULL);
gint fd;
/* load engine */
@ -380,12 +383,12 @@ fu_util_get_details (FuUtilPrivate *priv, gchar **values, GError **error)
return FALSE;
for (guint i = 0; i < array->len; i++) {
FwupdDevice *dev = g_ptr_array_index (array, i);
g_autofree gchar *tmp = NULL;
if (!fu_util_filter_device (priv, dev))
continue;
tmp = fu_util_device_to_string (dev, 0);
g_print ("%s\n", tmp);
g_node_append_data (root, dev);
}
fu_util_print_tree (root, priv);
return TRUE;
}
@ -448,8 +451,7 @@ fu_util_get_devices (FuUtilPrivate *priv, gchar **values, GError **error)
return TRUE;
}
fu_util_build_device_tree (priv, root, devs, NULL);
g_node_traverse (root, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
fu_util_print_device_tree, priv);
fu_util_print_tree (root, priv);
/* save the device state for other applications to see */
return fu_util_save_current_state (priv, error);
@ -1337,6 +1339,7 @@ static gboolean
fu_util_get_history (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GPtrArray) devices = NULL;
g_autoptr(GNode) root = g_node_new (NULL);
/* load engine */
if (!fu_util_start_engine (priv, FU_ENGINE_LOAD_FLAG_NONE, error))
@ -1350,12 +1353,11 @@ fu_util_get_history (FuUtilPrivate *priv, gchar **values, GError **error)
/* show each device */
for (guint i = 0; i < devices->len; i++) {
FwupdDevice *dev = g_ptr_array_index (devices, i);
g_autofree gchar *str = NULL;
if (!fu_util_filter_device (priv, dev))
continue;
str = fu_util_device_to_string (dev, 0);
g_print ("%s\n", str);
g_node_append_data (root, dev);
}
fu_util_print_tree (root, priv);
return TRUE;
}

View File

@ -138,38 +138,48 @@ fu_util_prompt_for_boolean (gboolean def)
return FALSE;
}
gboolean
fu_util_print_device_tree (GNode *n, gpointer data)
static gboolean
fu_util_traverse_tree (GNode *n, gpointer data)
{
FwupdDevice *dev = FWUPD_DEVICE (n->data);
guint idx = g_node_depth (n) - 1;
g_autofree gchar *tmp = NULL;
g_auto(GStrv) split = NULL;
/* get split lines */
if (FWUPD_IS_DEVICE (n->data)) {
FwupdDevice *dev = FWUPD_DEVICE (n->data);
tmp = fu_util_device_to_string (dev, idx);
} else if (FWUPD_IS_REMOTE (n->data)) {
FwupdRemote *remote = FWUPD_REMOTE (n->data);
tmp = fu_util_remote_to_string (remote, idx);
} else if (FWUPD_IS_RELEASE (n->data)) {
FwupdRelease *release = FWUPD_RELEASE (n->data);
tmp = fu_util_release_to_string (release, idx);
g_debug ("%s", tmp);
}
/* root node */
if (dev == NULL && g_getenv ("FWUPD_VERBOSE") == NULL) {
if (n->data == NULL && g_getenv ("FWUPD_VERBOSE") == NULL) {
g_print ("\n");
return FALSE;
}
if (n->parent == NULL)
return FALSE;
/* get split lines */
tmp = fu_util_device_to_string (dev, idx);
if (tmp == NULL)
return FALSE;
split = g_strsplit (tmp, "\n", -1);
for (guint i = 0; split[i] != NULL; i++) {
g_autoptr(GString) str = g_string_new (NULL);
/* device header */
/* header */
if (i == 0) {
if (g_node_next_sibling (n) == NULL)
g_string_prepend (str, "└─");
else
g_string_prepend (str, "├─");
/* device properties */
/* properties */
} else {
g_string_prepend (str, n->children == NULL ? " " : "");
g_string_prepend (str, g_node_next_sibling (n) == NULL ? " " : "");
@ -199,6 +209,13 @@ fu_util_print_device_tree (GNode *n, gpointer data)
return FALSE;
}
void
fu_util_print_tree (GNode *n, gpointer data)
{
g_node_traverse (n, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
fu_util_traverse_tree, data);
}
gboolean
fu_util_is_interesting_device (FwupdDevice *dev)
{
@ -989,8 +1006,10 @@ fu_util_release_to_string (FwupdRelease *rel, guint idt)
g_return_val_if_fail (FWUPD_IS_RELEASE (rel), NULL);
fu_common_string_append_kv (str, idt, fwupd_release_get_name (rel), NULL);
/* TRANSLATORS: version number of new firmware */
fu_common_string_append_kv (str, idt, _("Version"),
fu_common_string_append_kv (str, idt + 1 , _("Version"),
fwupd_release_get_version (rel));
if (fwupd_release_get_remote_id (rel) != NULL) {
@ -1003,21 +1022,16 @@ fu_util_release_to_string (FwupdRelease *rel, guint idt)
fu_common_string_append_kv (str, idt + 1, _("Summary"),
fwupd_release_get_summary (rel));
}
if (fwupd_release_get_description (rel) != NULL) {
g_autofree gchar *desc = NULL;
desc = fu_util_convert_description (fwupd_release_get_description (rel), NULL);
/* TRANSLATORS: multiline description of device */
fu_common_string_append_kv (str, idt + 1, _("Description"), desc);
}
if (fwupd_release_get_license (rel) != NULL) {
/* TRANSLATORS: e.g. GPLv2+, Non free etc */
fu_common_string_append_kv (str, idt + 1, _("License"),
fwupd_release_get_license (rel));
}
if (fwupd_release_get_size (rel) != 0) {
g_autofree gchar *tmp = NULL;
tmp = g_format_size (fwupd_release_get_size (rel));
/* TRANSLATORS: file size of the download */
fu_common_string_append_kx (str, idt + 1, _("Size"),
fwupd_release_get_size (rel));
fu_common_string_append_kv (str, idt + 1, _("Size"), tmp);
}
if (fwupd_release_get_details_url (rel) != NULL) {
/* TRANSLATORS: more details about the update link */
@ -1059,6 +1073,129 @@ fu_util_release_to_string (FwupdRelease *rel, guint idt)
/* TRANSLATORS: release properties */
fu_common_string_append_kv (str, idt + 1, _("Flags"), flags_str->str);
}
if (fwupd_release_get_description (rel) != NULL) {
g_autofree gchar *desc = NULL;
desc = fu_util_convert_description (fwupd_release_get_description (rel), NULL);
/* TRANSLATORS: multiline description of device */
fu_common_string_append_kv (str, idt + 1, _("Description"), desc);
}
return g_string_free (str, FALSE);
}
gchar *
fu_util_remote_to_string (FwupdRemote *remote, guint idt)
{
GString *str = g_string_new (NULL);
FwupdRemoteKind kind = fwupd_remote_get_kind (remote);
FwupdKeyringKind keyring_kind = fwupd_remote_get_keyring_kind (remote);
const gchar *tmp;
gint priority;
gdouble age;
g_return_val_if_fail (FWUPD_IS_REMOTE (remote), NULL);
fu_common_string_append_kv (str, idt,
fwupd_remote_get_title (remote), NULL);
/* TRANSLATORS: remote identifier, e.g. lvfs-testing */
fu_common_string_append_kv (str, idt + 1, _("Remote ID"),
fwupd_remote_get_id (remote));
/* TRANSLATORS: remote type, e.g. remote or local */
fu_common_string_append_kv (str, idt + 1, _("Type"),
fwupd_remote_kind_to_string (kind));
/* TRANSLATORS: keyring type, e.g. GPG or PKCS7 */
if (keyring_kind != FWUPD_KEYRING_KIND_UNKNOWN) {
fu_common_string_append_kv (str, idt + 1, _("Keyring"),
fwupd_keyring_kind_to_string (keyring_kind));
}
/* TRANSLATORS: if the remote is enabled */
fu_common_string_append_kv (str, idt + 1, _("Enabled"),
fwupd_remote_get_enabled (remote) ? "true" : "false");
tmp = fwupd_remote_get_checksum (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote checksum */
fu_common_string_append_kv (str, idt + 1, _("Checksum"), tmp);
}
/* optional parameters */
age = fwupd_remote_get_age (remote);
if (kind == FWUPD_REMOTE_KIND_DOWNLOAD &&
age > 0 && age != G_MAXUINT64) {
const gchar *unit = "s";
g_autofree gchar *age_str = NULL;
if (age > 60) {
age /= 60.f;
unit = "m";
}
if (age > 60) {
age /= 60.f;
unit = "h";
}
if (age > 24) {
age /= 24.f;
unit = "d";
}
if (age > 7) {
age /= 7.f;
unit = "w";
}
age_str = g_strdup_printf ("%.2f%s", age, unit);
/* TRANSLATORS: the age of the metadata */
fu_common_string_append_kv (str, idt + 1, _("Age"), age_str);
}
priority = fwupd_remote_get_priority (remote);
if (priority != 0) {
g_autofree gchar *priority_str = NULL;
priority_str = g_strdup_printf ("%i", priority);
/* TRANSLATORS: the numeric priority */
fu_common_string_append_kv (str, idt + 1, _("Priority"), priority_str);
}
tmp = fwupd_remote_get_username (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote filename base */
fu_common_string_append_kv (str, idt + 1, _("Username"), tmp);
}
tmp = fwupd_remote_get_password (remote);
if (tmp != NULL) {
g_autofree gchar *hidden = g_strnfill (strlen (tmp), '*');
/* TRANSLATORS: remote filename base */
fu_common_string_append_kv (str, idt + 1, _("Password"), hidden);
}
tmp = fwupd_remote_get_filename_cache (remote);
if (tmp != NULL) {
/* TRANSLATORS: filename of the local file */
fu_common_string_append_kv (str, idt + 1, _("Filename"), tmp);
}
tmp = fwupd_remote_get_filename_cache_sig (remote);
if (tmp != NULL) {
/* TRANSLATORS: filename of the local file */
fu_common_string_append_kv (str, idt + 1, _("Filename Signature"), tmp);
}
tmp = fwupd_remote_get_metadata_uri (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote URI */
fu_common_string_append_kv (str, idt + 1, _("Metadata URI"), tmp);
}
tmp = fwupd_remote_get_metadata_uri_sig (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote URI */
fu_common_string_append_kv (str, idt + 1, _("Metadata Signature"), tmp);
}
tmp = fwupd_remote_get_firmware_base_uri (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote URI */
fu_common_string_append_kv (str, idt + 1, _("Firmware Base URI"), tmp);
}
tmp = fwupd_remote_get_report_uri (remote);
if (tmp != NULL) {
/* TRANSLATORS: URI to send success/failure reports */
fu_common_string_append_kv (str, idt + 1, _("Report URI"), tmp);
}
return g_string_free (str, FALSE);
}

View File

@ -31,7 +31,7 @@ void fu_util_print_data (const gchar *title,
guint fu_util_prompt_for_number (guint maxnum);
gboolean fu_util_prompt_for_boolean (gboolean def);
gboolean fu_util_print_device_tree (GNode *n, gpointer data);
void fu_util_print_tree (GNode *n, gpointer data);
gboolean fu_util_is_interesting_device (FwupdDevice *dev);
gchar *fu_util_get_user_cache_path (const gchar *fn);
SoupSession *fu_util_setup_networking (GError **error);
@ -73,5 +73,7 @@ gchar *fu_util_device_to_string (FwupdDevice *dev,
guint idt);
gchar *fu_util_release_to_string (FwupdRelease *rel,
guint idt);
gchar *fu_util_remote_to_string (FwupdRemote *remote,
guint idt);
G_END_DECLS

View File

@ -399,8 +399,7 @@ fu_util_get_devices (FuUtilPrivate *priv, gchar **values, GError **error)
return TRUE;
}
fu_util_build_device_tree (priv, root, devs, NULL);
g_node_traverse (root, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
fu_util_print_device_tree, priv);
fu_util_print_tree (root, priv);
/* nag? */
if (!fu_util_perhaps_show_unreported (priv, error))
@ -485,6 +484,7 @@ static gboolean
fu_util_get_details (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GPtrArray) array = NULL;
g_autoptr(GNode) root = g_node_new (NULL);
/* check args */
if (g_strv_length (values) != 1) {
@ -499,12 +499,12 @@ fu_util_get_details (FuUtilPrivate *priv, gchar **values, GError **error)
return FALSE;
for (guint i = 0; i < array->len; i++) {
FwupdDevice *dev = g_ptr_array_index (array, i);
g_autofree gchar *tmp = NULL;
if (!fu_util_filter_device (priv, dev))
continue;
tmp = fu_util_device_to_string (dev, 0);
g_print ("%s\n", tmp);
g_node_append_data (root, dev);
}
fu_util_print_tree (root, priv);
return TRUE;
}
@ -788,6 +788,7 @@ static gboolean
fu_util_get_history (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GPtrArray) devices = NULL;
g_autoptr(GNode) root = g_node_new (NULL);
/* get all devices from the history database */
devices = fwupd_client_get_history (priv->client, NULL, error);
@ -797,12 +798,11 @@ fu_util_get_history (FuUtilPrivate *priv, gchar **values, GError **error)
/* show each device */
for (guint i = 0; i < devices->len; i++) {
FwupdDevice *dev = g_ptr_array_index (devices, i);
g_autofree gchar *str = NULL;
if (!fu_util_filter_device (priv, dev))
continue;
str = fu_util_device_to_string (dev, 0);
g_print ("%s\n", str);
g_node_append_data (root, dev);
}
fu_util_print_tree (root, priv);
return TRUE;
}
@ -1194,6 +1194,7 @@ fu_util_get_releases (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(FwupdDevice) dev = NULL;
g_autoptr(GPtrArray) rels = NULL;
g_autoptr(GNode) root = g_node_new (NULL);
dev = fu_util_get_device_or_prompt (priv, values, error);
if (dev == NULL)
@ -1203,16 +1204,19 @@ fu_util_get_releases (FuUtilPrivate *priv, gchar **values, GError **error)
rels = fwupd_client_get_releases (priv->client, fwupd_device_get_id (dev), NULL, error);
if (rels == NULL)
return FALSE;
g_print ("%s:\n", fwupd_device_get_name (dev));
if (rels->len == 0) {
/* TRANSLATORS: no repositories to download from */
g_print ("%s\n", _("No releases available"));
return TRUE;
}
for (guint i = 0; i < rels->len; i++) {
FwupdRelease *rel = g_ptr_array_index (rels, i);
g_autofree gchar *tmp = fu_util_release_to_string (rel, 0);
g_print ("%s", tmp);
/* new line between all but last entries */
if (i != rels->len - 1)
g_print ("\n");
g_node_append_data (root, rel);
}
fu_util_print_tree (root, priv);
return TRUE;
}
@ -1397,6 +1401,7 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GPtrArray) devices = NULL;
gboolean supported = FALSE;
g_autoptr(GNode) root = g_node_new (NULL);
/* are the remotes very old */
if (!fu_util_perhaps_refresh_remotes (priv, error))
@ -1408,9 +1413,9 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
return FALSE;
for (guint i = 0; i < devices->len; i++) {
FwupdDevice *dev = g_ptr_array_index (devices, i);
g_autofree gchar *tmp = NULL;
g_autoptr(GPtrArray) rels = NULL;
g_autoptr(GError) error_local = NULL;
GNode *child;
/* not going to have results, so save a D-Bus round-trip */
if (!fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_SUPPORTED))
@ -1427,20 +1432,18 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
g_printerr ("%s\n", error_local->message);
continue;
}
child = g_node_append_data (root, dev);
/* TRANSLATORS: list of devices */
g_print ("%s\n", _("Firmware updates:"));
tmp = fu_util_device_to_string (dev, 0);
g_print ("%s", tmp);
/* print all releases */
/* add all releases */
for (guint j = 0; j < rels->len; j++) {
FwupdRelease *rel = g_ptr_array_index (rels, j);
g_autofree gchar *tmp2 = fu_util_release_to_string (rel, 1);
g_print ("%s\n", tmp2);
g_node_append_data (child, g_object_ref (rel));
}
}
if (g_node_n_nodes (root, G_TRAVERSE_ALL) > 1)
fu_util_print_tree (root, priv);
/* nag? */
if (!fu_util_perhaps_show_unreported (priv, error))
return FALSE;
@ -1461,126 +1464,25 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
static gboolean
fu_util_get_remotes (FuUtilPrivate *priv, gchar **values, GError **error)
{
g_autoptr(GNode) root = g_node_new (NULL);
g_autoptr(GPtrArray) remotes = NULL;
/* print any updates */
remotes = fwupd_client_get_remotes (priv->client, NULL, error);
if (remotes == NULL)
return FALSE;
for (guint i = 0; i < remotes->len; i++) {
FwupdRemote *remote = g_ptr_array_index (remotes, i);
FwupdRemoteKind kind = fwupd_remote_get_kind (remote);
FwupdKeyringKind keyring_kind = fwupd_remote_get_keyring_kind (remote);
const gchar *tmp;
gint priority;
gdouble age;
/* TRANSLATORS: remote identifier, e.g. lvfs-testing */
fu_util_print_data (_("Remote ID"),
fwupd_remote_get_id (remote));
/* TRANSLATORS: remote title, e.g. "Linux Vendor Firmware Service" */
fu_util_print_data (_("Title"),
fwupd_remote_get_title (remote));
/* TRANSLATORS: remote type, e.g. remote or local */
fu_util_print_data (_("Type"),
fwupd_remote_kind_to_string (kind));
/* TRANSLATORS: keyring type, e.g. GPG or PKCS7 */
if (keyring_kind != FWUPD_KEYRING_KIND_UNKNOWN) {
fu_util_print_data (_("Keyring"),
fwupd_keyring_kind_to_string (keyring_kind));
}
/* TRANSLATORS: if the remote is enabled */
fu_util_print_data (_("Enabled"),
fwupd_remote_get_enabled (remote) ? "true" : "false");
/* TRANSLATORS: remote checksum */
fu_util_print_data (_("Checksum"),
fwupd_remote_get_checksum (remote));
/* optional parameters */
age = fwupd_remote_get_age (remote);
if (kind == FWUPD_REMOTE_KIND_DOWNLOAD &&
age > 0 && age != G_MAXUINT64) {
const gchar *unit = "s";
g_autofree gchar *age_str = NULL;
if (age > 60) {
age /= 60.f;
unit = "m";
}
if (age > 60) {
age /= 60.f;
unit = "h";
}
if (age > 24) {
age /= 24.f;
unit = "d";
}
if (age > 7) {
age /= 7.f;
unit = "w";
}
age_str = g_strdup_printf ("%.2f%s", age, unit);
/* TRANSLATORS: the age of the metadata */
fu_util_print_data (_("Age"), age_str);
}
priority = fwupd_remote_get_priority (remote);
if (priority != 0) {
g_autofree gchar *priority_str = NULL;
priority_str = g_strdup_printf ("%i", priority);
/* TRANSLATORS: the numeric priority */
fu_util_print_data (_("Priority"), priority_str);
}
tmp = fwupd_remote_get_username (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote filename base */
fu_util_print_data (_("Username"), tmp);
}
tmp = fwupd_remote_get_password (remote);
if (tmp != NULL) {
g_autofree gchar *hidden = g_strnfill (strlen (tmp), '*');
/* TRANSLATORS: remote filename base */
fu_util_print_data (_("Password"), hidden);
}
tmp = fwupd_remote_get_filename_cache (remote);
if (tmp != NULL) {
/* TRANSLATORS: filename of the local file */
fu_util_print_data (_("Filename"), tmp);
}
tmp = fwupd_remote_get_filename_cache_sig (remote);
if (tmp != NULL) {
/* TRANSLATORS: filename of the local file */
fu_util_print_data (_("Filename Signature"), tmp);
}
tmp = fwupd_remote_get_metadata_uri (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote URI */
fu_util_print_data (_("Metadata URI"), tmp);
}
tmp = fwupd_remote_get_metadata_uri_sig (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote URI */
fu_util_print_data (_("Metadata URI Signature"), tmp);
}
tmp = fwupd_remote_get_firmware_base_uri (remote);
if (tmp != NULL) {
/* TRANSLATORS: remote URI */
fu_util_print_data (_("Firmware Base URI"), tmp);
}
tmp = fwupd_remote_get_report_uri (remote);
if (tmp != NULL) {
/* TRANSLATORS: URI to send success/failure reports */
fu_util_print_data (_("Report URI"), tmp);
}
/* newline */
if (i != remotes->len - 1)
g_print ("\n");
if (remotes->len == 0) {
/* TRANSLATORS: no repositories to download from */
g_print ("%s\n", _("No remotes available"));
return TRUE;
}
for (guint i = 0; i < remotes->len; i++) {
FwupdRemote *remote_tmp = g_ptr_array_index (remotes, i);
g_node_append_data (root, remote_tmp);
}
fu_util_print_tree (root, priv);
return TRUE;
}