summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-12-18 17:30:05 +0000
committerRichard Hughes <richard@hughsie.com>2015-12-18 17:30:05 +0000
commit5c3041e840c60cb6a9a63aa743d0dbb3add54101 (patch)
treea9580b6ac44ab1aed852e9da0db6e09eca4d6713
parent6cfef30c510b66bf41419ee9c77a384a6b91632e (diff)
downloadappstream-glib-5c3041e840c60cb6a9a63aa743d0dbb3add54101.tar.gz
Accept various 'or later' metadata content licenses
-rw-r--r--libappstream-glib/as-app-validate.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c
index cb31924..87e4a10 100644
--- a/libappstream-glib/as-app-validate.c
+++ b/libappstream-glib/as-app-validate.c
@@ -986,6 +986,43 @@ as_app_validate_license (const gchar *license_text, GError **error)
}
/**
+ * as_app_validate_is_content_license_id:
+ **/
+static gboolean
+as_app_validate_is_content_license_id (const gchar *license_id)
+{
+ if (g_strcmp0 (license_id, "@CC0-1.0") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-3.0") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-3.0+") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-4.0") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-4.0+") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-SA-3.0") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-SA-3.0+") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-SA-4.0") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@CC-BY-SA-4.0+") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@GFDL-1.1") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@GFDL-1.2") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "@GFDL-1.3") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "&") == 0)
+ return TRUE;
+ if (g_strcmp0 (license_id, "|") == 0)
+ return TRUE;
+ return FALSE;
+}
+
+/**
* as_app_validate_is_content_license:
**/
static gboolean
@@ -997,25 +1034,8 @@ as_app_validate_is_content_license (const gchar *license)
if (tokens == NULL)
return FALSE;
for (i = 0; tokens[i] != NULL; i++) {
- if (g_strcmp0 (tokens[i], "@CC0-1.0") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@CC-BY-3.0") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@CC-BY-4.0") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@CC-BY-SA-3.0") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@CC-BY-SA-4.0") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@GFDL-1.1") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@GFDL-1.2") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "@GFDL-1.3") == 0)
- continue;
- if (g_strcmp0 (tokens[i], "&") == 0)
- continue;
- return FALSE;
+ if (!as_app_validate_is_content_license_id (tokens[i]))
+ return FALSE;
}
return TRUE;
}