mirror of
https://github.com/flatpak/flatpak.git
synced 2026-01-26 14:13:26 +00:00
Remove last uses of flatpak_decompose_ref()
This commit is contained in:
parent
f7593cd7b6
commit
e633fe0d81
@ -454,7 +454,7 @@ generate_labels (FlatpakOciDescriptor *layer_desc,
|
||||
|
||||
static gboolean
|
||||
build_oci (OstreeRepo *repo, const char *commit_checksum, GFile *dir,
|
||||
const char *name, const char *ref,
|
||||
const char *name, const char *ref_str,
|
||||
GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GFile) root = NULL;
|
||||
@ -473,7 +473,8 @@ build_oci (OstreeRepo *repo, const char *commit_checksum, GFile *dir,
|
||||
g_autoptr(FlatpakOciManifest) manifest = NULL;
|
||||
g_autoptr(FlatpakOciIndex) index = NULL;
|
||||
g_autoptr(GHashTable) flatpak_labels = NULL;
|
||||
g_auto(GStrv) ref_parts = NULL;
|
||||
g_autoptr(FlatpakDecomposed) ref = NULL;
|
||||
g_autofree char *arch = NULL;
|
||||
int history_index;
|
||||
GTimeVal tv;
|
||||
|
||||
@ -486,10 +487,12 @@ build_oci (OstreeRepo *repo, const char *commit_checksum, GFile *dir,
|
||||
if (!ostree_repo_read_commit_detached_metadata (repo, commit_checksum, &commit_metadata, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
ref_parts = flatpak_decompose_ref (ref, error);
|
||||
if (ref_parts == NULL)
|
||||
ref = flatpak_decomposed_new_from_ref (ref_str, error);
|
||||
if (ref == NULL)
|
||||
return FALSE;
|
||||
|
||||
arch = flatpak_decomposed_dup_arch (ref);
|
||||
|
||||
dir_uri = g_file_get_uri (dir);
|
||||
registry = flatpak_oci_registry_new (dir_uri, TRUE, -1, cancellable, error);
|
||||
if (registry == NULL)
|
||||
@ -512,13 +515,13 @@ build_oci (OstreeRepo *repo, const char *commit_checksum, GFile *dir,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
flatpak_labels = generate_labels (layer_desc, repo, root, name, ref, commit_checksum, commit_data, cancellable, error);
|
||||
flatpak_labels = generate_labels (layer_desc, repo, root, name, flatpak_decomposed_get_ref (ref), commit_checksum, commit_data, cancellable, error);
|
||||
if (flatpak_labels == NULL)
|
||||
return FALSE;
|
||||
|
||||
image = flatpak_oci_image_new ();
|
||||
flatpak_oci_image_set_layer (image, uncompressed_digest);
|
||||
flatpak_oci_image_set_architecture (image, flatpak_arch_to_oci_arch (ref_parts[2]));
|
||||
flatpak_oci_image_set_architecture (image, flatpak_arch_to_oci_arch (arch));
|
||||
history_index = flatpak_oci_image_add_history (image);
|
||||
|
||||
g_get_current_time (&tv);
|
||||
@ -547,7 +550,7 @@ build_oci (OstreeRepo *repo, const char *commit_checksum, GFile *dir,
|
||||
if (index == NULL)
|
||||
index = flatpak_oci_index_new ();
|
||||
|
||||
flatpak_oci_index_add_manifest (index, ref, manifest_desc);
|
||||
flatpak_oci_index_add_manifest (index, flatpak_decomposed_get_ref (ref), manifest_desc);
|
||||
|
||||
if (!flatpak_oci_registry_save_index (registry, index, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
@ -217,20 +217,34 @@ print_history (GPtrArray *dirs,
|
||||
strcmp (columns[k].name, "arch") == 0 ||
|
||||
strcmp (columns[k].name, "branch") == 0)
|
||||
{
|
||||
g_autofree char *ref = get_field (j, "REF", error);
|
||||
g_autoptr(FlatpakDecomposed) ref = NULL;
|
||||
g_autofree char *ref_str = get_field (j, "REF", error);
|
||||
if (*error)
|
||||
return FALSE;
|
||||
|
||||
if (ref_str)
|
||||
{
|
||||
ref = flatpak_decomposed_new_from_ref (ref_str, error);
|
||||
if (ref == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strcmp (columns[k].name, "ref") == 0)
|
||||
flatpak_table_printer_add_column (printer, ref);
|
||||
flatpak_table_printer_add_column (printer, ref_str);
|
||||
else
|
||||
{
|
||||
g_auto(GStrv) pref = flatpak_decompose_ref (ref, NULL);
|
||||
if (strcmp (columns[k].name, "application") == 0)
|
||||
flatpak_table_printer_add_column (printer, pref ? pref[1] : "");
|
||||
else if (strcmp (columns[k].name, "arch") == 0)
|
||||
flatpak_table_printer_add_column (printer, pref ? pref[2] : "");
|
||||
else
|
||||
flatpak_table_printer_add_column (printer, pref ? pref[3] : "");
|
||||
g_autofree char *value = NULL;
|
||||
if (ref)
|
||||
{
|
||||
if (strcmp (columns[k].name, "application") == 0)
|
||||
value = flatpak_decomposed_dup_id (ref);
|
||||
else if (strcmp (columns[k].name, "arch") == 0)
|
||||
value = flatpak_decomposed_dup_arch (ref);
|
||||
else
|
||||
value = flatpak_decomposed_dup_branch (ref);
|
||||
}
|
||||
|
||||
flatpak_table_printer_add_column (printer, value);
|
||||
}
|
||||
}
|
||||
else if (strcmp (columns[k].name, "installation") == 0)
|
||||
|
||||
@ -174,20 +174,25 @@ enumerate_instances (Column *columns, GError **error)
|
||||
12);
|
||||
else if (strcmp (columns[i].name, "runtime") == 0)
|
||||
{
|
||||
const char *full_ref = flatpak_instance_get_runtime (instance);
|
||||
if (full_ref != NULL)
|
||||
const char *ref_str = flatpak_instance_get_runtime (instance);
|
||||
if (ref_str != NULL)
|
||||
{
|
||||
g_auto(GStrv) ref = flatpak_decompose_ref (full_ref, NULL);
|
||||
flatpak_table_printer_add_column (printer, ref[1]);
|
||||
g_autoptr(FlatpakDecomposed) ref = flatpak_decomposed_new_from_ref (ref_str, NULL);
|
||||
if (ref)
|
||||
{
|
||||
g_autofree char *id = flatpak_decomposed_dup_id (ref);
|
||||
flatpak_table_printer_add_column (printer, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp (columns[i].name, "runtime-branch") == 0)
|
||||
{
|
||||
const char *full_ref = flatpak_instance_get_runtime (instance);
|
||||
if (full_ref != NULL)
|
||||
const char *ref_str = flatpak_instance_get_runtime (instance);
|
||||
if (ref_str != NULL)
|
||||
{
|
||||
g_auto(GStrv) ref = flatpak_decompose_ref (full_ref, NULL);
|
||||
flatpak_table_printer_add_column (printer, ref[3]);
|
||||
g_autoptr(FlatpakDecomposed) ref = flatpak_decomposed_new_from_ref (ref_str, NULL);
|
||||
if (ref)
|
||||
flatpak_table_printer_add_column (printer, flatpak_decomposed_get_branch (ref));
|
||||
}
|
||||
}
|
||||
else if (strcmp (columns[i].name, "runtime-commit") == 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user