New upstream release

This commit is contained in:
Richard Hughes 2018-04-20 11:42:07 +01:00
parent a461939c55
commit ac16c7e3b7
5 changed files with 13 additions and 211 deletions

1
.gitignore vendored
View File

@ -59,3 +59,4 @@
/appstream-glib-0.7.5.tar.xz
/appstream-glib-0.7.6.tar.xz
/appstream-glib-0.7.7.tar.xz
/appstream-glib-0.7.8.tar.xz

View File

@ -1,170 +0,0 @@
From 911ef7fb4b3bdda8acd6cf57715b9020c65e274c Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 15 Mar 2018 10:10:54 +0000
Subject: [PATCH] Add as_utils_unique_id_match()
This allows us to whitelist the sections that have to match.
---
libappstream-glib/as-self-test.c | 16 +++++++++++++++
libappstream-glib/as-utils.c | 42 +++++++++++++++++++++++++++++++++-------
libappstream-glib/as-utils.h | 27 ++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 7 deletions(-)
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index a6edd49186a7..8f4e6e9a7c69 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -5249,6 +5249,22 @@ as_test_utils_unique_id_func (void)
}
duration_ns = g_timer_elapsed (timer, NULL) * 1000000000.f;
g_print ("%.0f ns: ", duration_ns / (loops * 4));
+
+ /* allow ignoring using bitfields */
+ g_assert (as_utils_unique_id_match ("aa/bb/cc/dd/ee/ff",
+ "aa/bb/cc/dd/ee/XXXXXXXXXXXXX",
+ AS_UNIQUE_ID_MATCH_FLAG_SCOPE |
+ AS_UNIQUE_ID_MATCH_FLAG_BUNDLE_KIND |
+ AS_UNIQUE_ID_MATCH_FLAG_ORIGIN |
+ AS_UNIQUE_ID_MATCH_FLAG_KIND |
+ AS_UNIQUE_ID_MATCH_FLAG_ID));
+ g_assert (as_utils_unique_id_match ("XXXXXXXXXXXXX/bb/cc/dd/ee/ff",
+ "aa/bb/cc/dd/ee/ff",
+ AS_UNIQUE_ID_MATCH_FLAG_BUNDLE_KIND |
+ AS_UNIQUE_ID_MATCH_FLAG_ORIGIN |
+ AS_UNIQUE_ID_MATCH_FLAG_KIND |
+ AS_UNIQUE_ID_MATCH_FLAG_ID |
+ AS_UNIQUE_ID_MATCH_FLAG_BRANCH));
}
static void
diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c
index b4e2d8c8aed7..eab324203c38 100644
--- a/libappstream-glib/as-utils.c
+++ b/libappstream-glib/as-utils.c
@@ -1877,20 +1877,23 @@ as_utils_unique_id_is_wildcard_part (const gchar *str, guint len)
}
/**
- * as_utils_unique_id_equal:
+ * as_utils_unique_id_match:
* @unique_id1: a unique ID
* @unique_id2: another unique ID
+ * @match_flags: a #AsUniqueIdMatchFlags bitfield, e.g. %AS_UNIQUE_ID_MATCH_FLAG_ID
*
- * Checks two unique IDs for equality allowing globs to match.
+ * Checks two unique IDs for equality allowing globs to match, whilst also
+ * allowing clients to whitelist sections that have to match.
*
* Returns: %TRUE if the ID's should be considered equal.
*
- * Since: 0.6.1
+ * Since: 0.7.8
*/
gboolean
-as_utils_unique_id_equal (const gchar *unique_id1, const gchar *unique_id2)
+as_utils_unique_id_match (const gchar *unique_id1,
+ const gchar *unique_id2,
+ AsUniqueIdMatchFlags match_flags)
{
- guint i;
guint last1 = 0;
guint last2 = 0;
guint len1;
@@ -1906,7 +1909,7 @@ as_utils_unique_id_equal (const gchar *unique_id1, const gchar *unique_id2)
return g_strcmp0 (unique_id1, unique_id2) == 0;
/* look at each part */
- for (i = 0; i < AS_UTILS_UNIQUE_ID_PARTS; i++) {
+ for (guint i = 0; i < AS_UTILS_UNIQUE_ID_PARTS; i++) {
const gchar *tmp1 = unique_id1 + last1;
const gchar *tmp2 = unique_id2 + last2;
@@ -1915,7 +1918,8 @@ as_utils_unique_id_equal (const gchar *unique_id1, const gchar *unique_id2)
len2 = as_utils_unique_id_find_part (tmp2);
/* either string was a wildcard */
- if (!as_utils_unique_id_is_wildcard_part (tmp1, len1) &&
+ if (match_flags & (1 << i) &&
+ !as_utils_unique_id_is_wildcard_part (tmp1, len1) &&
!as_utils_unique_id_is_wildcard_part (tmp2, len2)) {
/* are substrings the same */
if (len1 != len2)
@@ -1931,6 +1935,30 @@ as_utils_unique_id_equal (const gchar *unique_id1, const gchar *unique_id2)
return TRUE;
}
+/**
+ * as_utils_unique_id_equal:
+ * @unique_id1: a unique ID
+ * @unique_id2: another unique ID
+ *
+ * Checks two unique IDs for equality allowing globs to match.
+ *
+ * Returns: %TRUE if the ID's should be considered equal.
+ *
+ * Since: 0.6.1
+ */
+gboolean
+as_utils_unique_id_equal (const gchar *unique_id1, const gchar *unique_id2)
+{
+ return as_utils_unique_id_match (unique_id1,
+ unique_id2,
+ AS_UNIQUE_ID_MATCH_FLAG_SCOPE |
+ AS_UNIQUE_ID_MATCH_FLAG_BUNDLE_KIND |
+ AS_UNIQUE_ID_MATCH_FLAG_ORIGIN |
+ AS_UNIQUE_ID_MATCH_FLAG_KIND |
+ AS_UNIQUE_ID_MATCH_FLAG_ID |
+ AS_UNIQUE_ID_MATCH_FLAG_BRANCH);
+}
+
/**
* as_utils_unique_id_hash:
* @unique_id: a unique ID
diff --git a/libappstream-glib/as-utils.h b/libappstream-glib/as-utils.h
index a8d56a015c1e..ecb7cdda35b1 100644
--- a/libappstream-glib/as-utils.h
+++ b/libappstream-glib/as-utils.h
@@ -95,6 +95,30 @@ typedef enum {
AS_VERSION_PARSE_FLAG_LAST
} AsVersionParseFlag;
+/**
+ * AsUniqueIdMatchFlags:
+ * @AS_UNIQUE_ID_MATCH_FLAG_NONE: No flags set
+ * @AS_UNIQUE_ID_MATCH_FLAG_SCOPE: Scope, e.g. a #AsAppScope
+ * @AS_UNIQUE_ID_MATCH_FLAG_BUNDLE_KIND: Bundle kind, e.g. a #AsBundleKind
+ * @AS_UNIQUE_ID_MATCH_FLAG_ORIGIN: Origin
+ * @AS_UNIQUE_ID_MATCH_FLAG_KIND: Component kind, e.g. a #AsAppKind
+ * @AS_UNIQUE_ID_MATCH_FLAG_ID: Component AppStream ID
+ * @AS_UNIQUE_ID_MATCH_FLAG_BRANCH: Branch
+ *
+ * The flags used when matching unique IDs.
+ **/
+typedef enum {
+ AS_UNIQUE_ID_MATCH_FLAG_NONE = 0,
+ AS_UNIQUE_ID_MATCH_FLAG_SCOPE = 1 << 0,
+ AS_UNIQUE_ID_MATCH_FLAG_BUNDLE_KIND = 1 << 1, /* Since: 0.7.8 */
+ AS_UNIQUE_ID_MATCH_FLAG_ORIGIN = 1 << 2, /* Since: 0.7.8 */
+ AS_UNIQUE_ID_MATCH_FLAG_KIND = 1 << 3, /* Since: 0.7.8 */
+ AS_UNIQUE_ID_MATCH_FLAG_ID = 1 << 4, /* Since: 0.7.8 */
+ AS_UNIQUE_ID_MATCH_FLAG_BRANCH = 1 << 5, /* Since: 0.7.8 */
+ /*< private >*/
+ AS_UNIQUE_ID_MATCH_FLAG_LAST
+} AsUniqueIdMatchFlags;
+
GQuark as_utils_error_quark (void);
gboolean as_utils_is_stock_icon_name (const gchar *name);
gboolean as_utils_is_spdx_license_id (const gchar *license_id);
@@ -146,6 +170,9 @@ gchar *as_utils_unique_id_build (AsAppScope scope,
const gchar *branch);
gboolean as_utils_unique_id_equal (const gchar *unique_id1,
const gchar *unique_id2);
+gboolean as_utils_unique_id_match (const gchar *unique_id1,
+ const gchar *unique_id2,
+ AsUniqueIdMatchFlags match_flags);
gboolean as_utils_unique_id_valid (const gchar *unique_id);
guint as_utils_unique_id_hash (const gchar *unique_id);
gchar *as_utils_appstream_id_build (const gchar *str);
--
2.16.2

View File

@ -1,34 +0,0 @@
From 5a7d76de734b049192b5b992a1e54117b98de733 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 17 Apr 2018 13:14:19 +0200
Subject: [PATCH] Veto apps that have empty OnlyShowIn=
Apps that have OnlyShowIn= are equivalent to NoDisplay=True (gnome-shell
doesn't show them). Veto such apps to avoid them inadvertently showing
up in gnome-software and to match gnome-shell behaviour.
https://bugzilla.redhat.com/show_bug.cgi?id=1567689
https://gitlab.gnome.org/GNOME/gnome-software/issues/367
---
libappstream-glib/as-app-desktop.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c
index fadf4ab006ec..ee5742dac663 100644
--- a/libappstream-glib/as-app-desktop.c
+++ b/libappstream-glib/as-app-desktop.c
@@ -324,7 +324,10 @@ as_app_parse_file_key (AsApp *app,
G_KEY_FILE_DESKTOP_GROUP,
key,
NULL, NULL);
- if (g_strv_length (list) == 1)
+ /* "OnlyShowIn=" is the same as "NoDisplay=True" */
+ if (g_strv_length (list) == 0)
+ as_app_add_veto (app, "Empty OnlyShowIn");
+ else if (g_strv_length (list) == 1)
as_app_set_project_group (app, list[0]);
/* Name */
--
2.17.0

View File

@ -5,16 +5,12 @@
Summary: Library for AppStream metadata
Name: libappstream-glib
Version: 0.7.7
Release: 3%{?dist}
Version: 0.7.8
Release: 1%{?dist}
License: LGPLv2+
URL: http://people.freedesktop.org/~hughsient/appstream-glib/
Source0: http://people.freedesktop.org/~hughsient/appstream-glib/releases/appstream-glib-%{version}.tar.xz
# Backported from upstream
Patch0: 0001-Add-as_utils_unique_id_match.patch
Patch1: 0001-Veto-apps-that-have-empty-OnlyShowIn.patch
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: docbook-utils
BuildRequires: gtk-doc
@ -149,6 +145,15 @@ GLib headers and libraries for appstream-builder.
%{_datadir}/gir-1.0/AppStreamBuilder-1.0.gir
%changelog
* Fri Apr 20 2018 Richard Hughes <richard@hughsie.com> 0.7.8-1
- New upstream release
- Add as_version_string() for fwupd
- Add support for component agreements
- Correctly compare version numbers like '1.2.3' and '1.2.3a'
- Don't include the path component in the name when parsing the package filename
- If the launchable is specified don't guess it when composing
- Never add more than one component to the AppStream store when composing
* Tue Apr 17 2018 Kalev Lember <klember@redhat.com> 0.7.7-3
- Veto apps that have empty OnlyShowIn= (#1568492)

View File

@ -1 +1 @@
SHA512 (appstream-glib-0.7.7.tar.xz) = ba0cab57e41af8d7ba9dc0b5eaec665715c923ce1767668d2a2c61ab58e7949f1e12cc2734b5c811f25c642d966b7dca90ff5a13997acd73463cbe64edf231d6
SHA512 (appstream-glib-0.7.8.tar.xz) = 2e451e007862558475feae918afac570c1124bfcf6c1db0332abf4311340538917c7aa51dda5443d59b32540fabde90161a4e5137f1cd187327799db005376a1