[gnome-builder/wip/chergert/flatpak-repo: 24/29] flatpak: add helper to get refs for sdk/platform
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/flatpak-repo: 24/29] flatpak: add helper to get refs for sdk/platform
- Date: Wed, 25 Aug 2021 22:17:38 +0000 (UTC)
commit f7997521f7221f20b6efcceadf8b851208db811f
Author: Christian Hergert <chergert redhat com>
Date: Wed Aug 25 13:58:45 2021 -0700
flatpak: add helper to get refs for sdk/platform
src/plugins/flatpak/gbp-flatpak-runtime.c | 23 +++++++++++++++++++++++
src/plugins/flatpak/gbp-flatpak-runtime.h | 1 +
2 files changed, 24 insertions(+)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index edca4ba4b..f98c02da5 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -801,3 +801,26 @@ gbp_flatpak_runtime_new (const char *name,
"sdk", sdk_name,
NULL);
}
+
+char **
+gbp_flatpak_runtime_get_refs (GbpFlatpakRuntime *self)
+{
+ GPtrArray *ar;
+ g_autofree char *sdk = NULL;
+ g_autofree char *platform = NULL;
+ const char *arch;
+
+ g_return_val_if_fail (GBP_IS_FLATPAK_RUNTIME (self), NULL);
+
+ arch = ide_triplet_get_arch (self->triplet);
+ platform = g_strdup_printf ("runtime/%s/%s/%s", self->platform, arch, self->branch);
+ sdk = g_strdup_printf ("runtime/%s/%s/%s", self->sdk, arch, self->branch);
+
+ ar = g_ptr_array_new ();
+ g_ptr_array_add (ar, g_steal_pointer (&sdk));
+ if (g_strcmp0 (sdk, platform) != 0)
+ g_ptr_array_add (ar, g_steal_pointer (&platform));
+ g_ptr_array_add (ar, NULL);
+
+ return (char **)g_ptr_array_free (ar, FALSE);
+}
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.h b/src/plugins/flatpak/gbp-flatpak-runtime.h
index dd9a35473..3512f1197 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.h
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.h
@@ -41,5 +41,6 @@ const gchar *gbp_flatpak_runtime_get_branch (GbpFlatpakRuntime *self);
const gchar *gbp_flatpak_runtime_get_platform (GbpFlatpakRuntime *self);
const gchar *gbp_flatpak_runtime_get_sdk (GbpFlatpakRuntime *self);
gchar *gbp_flatpak_runtime_get_sdk_name (GbpFlatpakRuntime *self);
+char **gbp_flatpak_runtime_get_refs (GbpFlatpakRuntime *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]