[gnome-builder/wip/gtk4-port] libide/projects: use spdx-id for license
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/projects: use spdx-id for license
- Date: Sat, 28 May 2022 01:32:45 +0000 (UTC)
commit 6030030d9ba077832be23b56870e887c4a9b1919
Author: Christian Hergert <chergert redhat com>
Date: Fri May 27 18:31:22 2022 -0700
libide/projects: use spdx-id for license
src/libide/projects/ide-template-input.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/projects/ide-template-input.c b/src/libide/projects/ide-template-input.c
index 09f370dc0..8be9f1e5d 100644
--- a/src/libide/projects/ide-template-input.c
+++ b/src/libide/projects/ide-template-input.c
@@ -892,6 +892,24 @@ get_short_license (IdeTemplateInput *self)
return g_strdup ("");
}
+static char *
+get_spdx_id (IdeTemplateInput *self)
+{
+ g_assert (IDE_IS_TEMPLATE_INPUT (self));
+
+ for (guint i = 0; i < G_N_ELEMENTS (licenses); i++)
+ {
+ if (g_strcmp0 (licenses[i].spdx, self->license_name) == 0)
+ {
+ if (licenses[i].short_path != NULL)
+ return g_strdup (licenses[i].spdx);
+ break;
+ }
+ }
+
+ return g_strdup ("LicenseRef-proprietary");
+}
+
static TmplScope *
ide_template_input_to_scope (IdeTemplateInput *self)
{
@@ -945,7 +963,7 @@ ide_template_input_to_scope (IdeTemplateInput *self)
scope_take_string (scope, "spaces", g_strnfill (strlen (prefix_), ' '));
scope_take_string (scope, "Spaces", g_strnfill (strlen (PreFix), ' '));
- scope_take_string (scope, "project_license", get_short_license (self));
+ scope_take_string (scope, "project_license", get_spdx_id (self));
return g_steal_pointer (&scope);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]