[gnome-builder] flatpak: add helper to fetch SDK ref name
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: add helper to fetch SDK ref name
- Date: Fri, 17 Feb 2017 19:43:09 +0000 (UTC)
commit 7bd812d19fca49ba79b694bb5f729d020d6f6a28
Author: Christian Hergert <chergert redhat com>
Date: Fri Feb 17 11:42:27 2017 -0800
flatpak: add helper to fetch SDK ref name
This allows fetching just the name without the /arch/branch suffix. This
is useful when passing an SDK to `flatpak build-init`.
plugins/flatpak/gbp-flatpak-runtime.c | 18 ++++++++++++++++++
plugins/flatpak/gbp-flatpak-runtime.h | 1 +
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runtime.c b/plugins/flatpak/gbp-flatpak-runtime.c
index d9facc2..70bf391 100644
--- a/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/plugins/flatpak/gbp-flatpak-runtime.c
@@ -454,6 +454,24 @@ gbp_flatpak_runtime_get_sdk (GbpFlatpakRuntime *self)
return self->sdk;
}
+gchar *
+gbp_flatpak_runtime_get_sdk_name (GbpFlatpakRuntime *self)
+{
+ const gchar *slash;
+
+ g_return_val_if_fail (GBP_IS_FLATPAK_RUNTIME (self), NULL);
+
+ if (self->sdk == NULL)
+ return NULL;
+
+ slash = strchr (self->sdk, '/');
+
+ if (slash == NULL)
+ return g_strdup (self->sdk);
+ else
+ return g_strndup (self->sdk, slash - self->sdk);
+}
+
void
gbp_flatpak_runtime_set_sdk (GbpFlatpakRuntime *self,
const gchar *sdk)
diff --git a/plugins/flatpak/gbp-flatpak-runtime.h b/plugins/flatpak/gbp-flatpak-runtime.h
index 4c11080..7834f42 100644
--- a/plugins/flatpak/gbp-flatpak-runtime.h
+++ b/plugins/flatpak/gbp-flatpak-runtime.h
@@ -39,6 +39,7 @@ const gchar *gbp_flatpak_runtime_get_arch (GbpFlatpakRuntime *sel
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);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]