[gnome-builder] flatpak: Add fallback when guessing primary module
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: Add fallback when guessing primary module
- Date: Tue, 14 Feb 2017 20:22:34 +0000 (UTC)
commit a8402351b1a7f5d7b83b1c2e4e1d713052b83ba4
Author: Matthew Leeds <mleeds redhat com>
Date: Tue Feb 14 14:20:43 2017 -0600
flatpak: Add fallback when guessing primary module
If none of the modules in the flatpak manifest match the directory name,
assume the last module in the list is the primary one, since that's a
common convention.
.../flatpak/gbp-flatpak-configuration-provider.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-configuration-provider.c
b/plugins/flatpak/gbp-flatpak-configuration-provider.c
index f16b76e..32d7c78 100644
--- a/plugins/flatpak/gbp-flatpak-configuration-provider.c
+++ b/plugins/flatpak/gbp-flatpak-configuration-provider.c
@@ -620,6 +620,7 @@ guess_primary_module (JsonNode *modules_node,
{
JsonArray *modules;
JsonNode *module;
+ JsonNode *parent;
g_autofree gchar *dir_name;
g_assert (G_IS_FILE (directory));
@@ -658,6 +659,17 @@ guess_primary_module (JsonNode *modules_node,
}
}
}
+ /* If none match, assume the last module in the list is the primary one */
+ parent = json_node_get_parent (modules_node);
+ if (JSON_NODE_HOLDS_OBJECT (parent) &&
+ json_node_get_parent (parent) == NULL &&
+ json_array_get_length (modules) > 0)
+ {
+ JsonNode *last_node;
+ last_node = json_array_get_element (modules, json_array_get_length (modules) - 1);
+ if (JSON_NODE_HOLDS_OBJECT (last_node))
+ return last_node;
+ }
}
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]