mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-18 05:38:34 -04:00
Show subset information on info and remote-info
This commit is contained in:
@@ -109,6 +109,7 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
||||
g_autofree char *formatted_size = NULL;
|
||||
gboolean friendly = TRUE;
|
||||
g_autofree const char **subpaths = NULL;
|
||||
g_autofree char *subsets = NULL;
|
||||
int len = 0;
|
||||
int rows, cols;
|
||||
int width;
|
||||
@@ -211,6 +212,7 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
||||
g_printerr (_("Warning: Commit has no flatpak metadata\n"));
|
||||
|
||||
collection_id = var_metadata_lookup_string (commit_metadata, "ostree.collection-binding", NULL);
|
||||
subsets = metadata_get_subsets_string (commit_metadata);
|
||||
}
|
||||
|
||||
len = 0;
|
||||
@@ -224,6 +226,8 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
||||
len = MAX (len, g_utf8_strlen (_("License:"), -1));
|
||||
if (collection_id != NULL)
|
||||
len = MAX (len, g_utf8_strlen (_("Collection:"), -1));
|
||||
if (subsets != NULL)
|
||||
len = MAX (len, g_utf8_strlen (_("Subsets:"), -1));
|
||||
len = MAX (len, g_utf8_strlen (_("Installation:"), -1));
|
||||
len = MAX (len, g_utf8_strlen (_("Installed:"), -1));
|
||||
if (flatpak_decomposed_is_app (ref))
|
||||
@@ -267,6 +271,8 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
||||
print_aligned (len, _("Origin:"), origin ? origin : "-");
|
||||
if (collection_id)
|
||||
print_aligned (len, _("Collection:"), collection_id);
|
||||
if (subsets)
|
||||
print_aligned (len, _("Subsets:"), subsets);
|
||||
print_aligned (len, _("Installation:"), flatpak_dir_get_name_cached (dir));
|
||||
print_aligned (len, _("Installed:"), formatted_size);
|
||||
if (flatpak_decomposed_is_app (ref))
|
||||
|
||||
@@ -100,6 +100,7 @@ flatpak_builtin_remote_info (int argc, char **argv, GCancellable *cancellable, G
|
||||
const char *collection_id = NULL;
|
||||
const char *eol = NULL;
|
||||
const char *eol_rebase = NULL;
|
||||
g_autofree char *subsets = NULL;
|
||||
g_autoptr(GKeyFile) metakey = NULL;
|
||||
guint64 installed_size = 0;
|
||||
guint64 download_size = 0;
|
||||
@@ -222,6 +223,7 @@ flatpak_builtin_remote_info (int argc, char **argv, GCancellable *cancellable, G
|
||||
}
|
||||
|
||||
collection_id = var_metadata_lookup_string (commit_metadata, "ostree.collection-binding", NULL);
|
||||
subsets = metadata_get_subsets_string (commit_metadata);
|
||||
|
||||
installed_size = GUINT64_FROM_BE (var_metadata_lookup_uint64 (commit_metadata, "xa.installed-size", 0));
|
||||
download_size = GUINT64_FROM_BE (var_metadata_lookup_uint64 (commit_metadata, "xa.download-size", 0));
|
||||
@@ -242,6 +244,8 @@ flatpak_builtin_remote_info (int argc, char **argv, GCancellable *cancellable, G
|
||||
len = MAX (len, g_utf8_strlen (_("License:"), -1));
|
||||
if (collection_id != NULL)
|
||||
len = MAX (len, g_utf8_strlen (_("Collection:"), -1));
|
||||
if (subsets != NULL)
|
||||
len = MAX (len, g_utf8_strlen (_("Subsets:"), -1));
|
||||
if (formatted_download_size)
|
||||
len = MAX (len, g_utf8_strlen (_("Download:"), -1));
|
||||
if (formatted_installed_size)
|
||||
@@ -277,6 +281,8 @@ flatpak_builtin_remote_info (int argc, char **argv, GCancellable *cancellable, G
|
||||
print_aligned (len, _("License:"), license);
|
||||
if (collection_id != NULL)
|
||||
print_aligned (len, _("Collection:"), collection_id);
|
||||
if (subsets != NULL)
|
||||
print_aligned (len, _("Subsets:"), subsets);
|
||||
if (formatted_download_size)
|
||||
print_aligned (len, _("Download:"), formatted_download_size);
|
||||
if (formatted_installed_size)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "flatpak-builtins-utils.h"
|
||||
#include "flatpak-utils-private.h"
|
||||
#include "flatpak-run-private.h"
|
||||
#include "flatpak-variant-impl-private.h"
|
||||
|
||||
|
||||
void
|
||||
@@ -68,6 +69,26 @@ ref_dir_pair_free (RefDirPair *pair)
|
||||
g_free (pair);
|
||||
}
|
||||
|
||||
char *
|
||||
metadata_get_subsets_string (VarMetadataRef commit_metadata)
|
||||
{
|
||||
VarVariantRef xa_subsets_v;
|
||||
|
||||
if (var_metadata_lookup (commit_metadata, "xa.subsets", NULL, &xa_subsets_v))
|
||||
{
|
||||
VarArrayofstringRef xa_subsets = var_arrayofstring_from_variant (xa_subsets_v);
|
||||
gsize len = var_arrayofstring_get_length (xa_subsets);
|
||||
g_autofree char **subset_strings = g_new (char *, len + 1);
|
||||
|
||||
for (gsize j = 0; j < len; j++)
|
||||
subset_strings[j] = (char *) var_arrayofstring_get_at (xa_subsets, j);
|
||||
subset_strings[len] = NULL;
|
||||
|
||||
return g_strjoinv (", ", subset_strings);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
looks_like_branch (const char *branch)
|
||||
|
||||
@@ -106,7 +106,7 @@ gboolean update_appstream (GPtrArray *dirs,
|
||||
char ** get_permission_tables (XdpDbusPermissionStore *store);
|
||||
gboolean reset_permissions_for_app (const char *app_id,
|
||||
GError **error);
|
||||
|
||||
char * metadata_get_subsets_string (VarMetadataRef commit_metadata);
|
||||
|
||||
/* --columns handling */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user