[gnome-builder] flatpak: take current branch into account
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: take current branch into account
- Date: Thu, 11 Jan 2018 05:03:37 +0000 (UTC)
commit cf935b552e094c9ed3d577b9290a72f9b5b1b955
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 10 21:00:29 2018 -0800
flatpak: take current branch into account
We need to use the current branch so that we can compartmentalize a build
in case the application is opened with a different branch in another
workbench window.
https://bugzilla.gnome.org/show_bug.cgi?id=792383
src/plugins/flatpak/gbp-flatpak-util.c | 38 +++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-util.c b/src/plugins/flatpak/gbp-flatpak-util.c
index 9fbd779..15ee939 100644
--- a/src/plugins/flatpak/gbp-flatpak-util.c
+++ b/src/plugins/flatpak/gbp-flatpak-util.c
@@ -26,31 +26,53 @@
gchar *
gbp_flatpak_get_repo_dir (IdeConfiguration *configuration)
{
- g_autofree gchar *runtime_id = NULL;
+ g_autofree gchar *branch = NULL;
+ g_autofree gchar *name = NULL;
+ const gchar *runtime_id;
IdeContext *context;
+ IdeVcs *vcs;
g_assert (IDE_IS_CONFIGURATION (configuration));
context = ide_object_get_context (IDE_OBJECT (configuration));
- runtime_id = g_strdup (ide_configuration_get_runtime_id (configuration));
- g_strdelimit (runtime_id, G_DIR_SEPARATOR_S, '-');
+ vcs = ide_context_get_vcs (context);
+ branch = ide_vcs_get_branch_name (vcs);
+ runtime_id = ide_configuration_get_runtime_id (configuration);
- return ide_context_cache_filename (context, "flatpak", "repos", runtime_id, NULL);
+ if (branch != NULL)
+ name = g_strdup_printf ("%s:%s", runtime_id, branch);
+ else
+ name = g_strdup (runtime_id);
+
+ g_strdelimit (name, G_DIR_SEPARATOR_S, '-');
+
+ return ide_context_cache_filename (context, "flatpak", "repos", name, NULL);
}
gchar *
gbp_flatpak_get_staging_dir (IdeConfiguration *configuration)
{
- g_autofree gchar *runtime_id = NULL;
+ g_autofree gchar *branch = NULL;
+ g_autofree gchar *name = NULL;
+ const gchar *runtime_id;
IdeContext *context;
+ IdeVcs *vcs;
g_assert (IDE_IS_CONFIGURATION (configuration));
context = ide_object_get_context (IDE_OBJECT (configuration));
- runtime_id = g_strdup (ide_configuration_get_runtime_id (configuration));
- g_strdelimit (runtime_id, G_DIR_SEPARATOR_S, '-');
+ vcs = ide_context_get_vcs (context);
+ branch = ide_vcs_get_branch_name (vcs);
+ runtime_id = ide_configuration_get_runtime_id (configuration);
+
+ if (branch != NULL)
+ name = g_strdup_printf ("%s:%s", runtime_id, branch);
+ else
+ name = g_strdup (runtime_id);
+
+ g_strdelimit (name, G_DIR_SEPARATOR_S, '-');
- return ide_context_cache_filename (context, "flatpak", "staging", runtime_id, NULL);
+ return ide_context_cache_filename (context, "flatpak", "staging", name, NULL);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]