Source: appstream-glib
Version: 0.5.16-2
Severity: wishlist
Tags: patch

There's been a new upstream release of appstream-glib, which Ubuntu is
already using.

Additionally, I've been doing some targeted bugfixing
upstream for a Debian derivative; please consider cherry-picking those
patches from the upstream 0_5_X branch (sample commits attached) if
you don't go directly to 0.6.x.

I've made a proposed update available in
<git+ssh://git.debian.org/git/users/smcv/appstream-glib.git>.

Regards,
    S

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-rc7-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From 7f64e213761efbb7efb9420d04ee4e9a53efbf0c Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Tue, 2 Aug 2016 16:05:26 +0100
Subject: [PATCH 3/6] New upstream release: 0.5.17

  - update .symbols file
---
 debian/changelog                  | 4 +++-
 debian/libappstream-glib8.symbols | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 9e7c4f0..c3ea440 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
-appstream-glib (0.5.16-2) UNRELEASED; urgency=medium
+appstream-glib (0.5.17-1) UNRELEASED; urgency=medium
 
   * libappstream-glib-dev: depend on gir1.2-appstreamglib-1.0.
     The Debian GObject-Introspection mini-policy says the package
     with the XML (.gir) must depend on the package with the typelib.
+  * New upstream release: 0.5.17
+    - update .symbols file
 
  -- Simon McVittie <[email protected]>  Tue, 02 Aug 2016 15:51:06 +0100
 
diff --git a/debian/libappstream-glib8.symbols b/debian/libappstream-glib8.symbols
index f15acad..01452ee 100644
--- a/debian/libappstream-glib8.symbols
+++ b/debian/libappstream-glib8.symbols
@@ -373,6 +373,9 @@ libappstream-glib.so.8 libappstream-glib8 #MINVER#
  as_screenshot_set_priority@Base 0.5.1
  as_size_kind_from_string@Base 0.5.2
  as_size_kind_to_string@Base 0.5.2
+ as_stemmer_get_type@Base 0.5.17
+ as_stemmer_new@Base 0.5.17
+ as_stemmer_process@Base 0.5.17
  as_store_add_app@Base 0.5.1
  as_store_add_filter@Base 0.5.1
  as_store_add_metadata_index@Base 0.5.1
-- 
2.8.1

>From 3e9a26d0abf1d2685faec4ea3ab46c135ebe1ba9 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Thu, 28 Jul 2016 12:11:49 +0100
Subject: [PATCH 4/6] Don't change ABI if gperf happens to be installed on the
 build system
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Héctor Orón Martínez <[email protected]>
Signed-off-by: Simon McVittie <[email protected]>
---
 debian/changelog                                   |  2 +
 ...nge-ABI-when-built-with-without-gperf-123.patch | 79 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 82 insertions(+)
 create mode 100644 debian/patches/Don-t-change-ABI-when-built-with-without-gperf-123.patch
 create mode 100644 debian/patches/series

diff --git a/debian/changelog b/debian/changelog
index c3ea440..3c3d2ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ appstream-glib (0.5.17-1) UNRELEASED; urgency=medium
     with the XML (.gir) must depend on the package with the typelib.
   * New upstream release: 0.5.17
     - update .symbols file
+  * d/p/Don-t-change-ABI-when-built-with-without-gperf-123.patch:
+    don't change ABI if gperf happens to be installed on the build system
 
  -- Simon McVittie <[email protected]>  Tue, 02 Aug 2016 15:51:06 +0100
 
diff --git a/debian/patches/Don-t-change-ABI-when-built-with-without-gperf-123.patch b/debian/patches/Don-t-change-ABI-when-built-with-without-gperf-123.patch
new file mode 100644
index 0000000..892d063
--- /dev/null
+++ b/debian/patches/Don-t-change-ABI-when-built-with-without-gperf-123.patch
@@ -0,0 +1,79 @@
+From: Simon McVittie <[email protected]>
+Date: Thu, 28 Jul 2016 12:00:52 +0100
+Subject: Don't change ABI when built with/without gperf (#123)
+
+* Prefix as_tag_from_gperf() with an underscore to make it private
+
+Otherwise, the library's exported ABI changes depending on whether
+gperf was present at compile-time, which should just be an optimization.
+
+Signed-off-by: Simon McVittie <[email protected]>
+
+* Don't distribute generated as-tag-private.h in tarballs
+
+Signed-off-by: Simon McVittie <[email protected]>
+
+Applied-upstream: 0.5.18, commit:ef0f9b6cb3e3ff5f34e710f7c83f9dc991b47e5d
+---
+ libappstream-glib/Makefile.am  | 3 ++-
+ libappstream-glib/as-tag.c     | 4 ++--
+ libappstream-glib/as-tag.gperf | 4 ++--
+ 3 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/libappstream-glib/Makefile.am b/libappstream-glib/Makefile.am
+index 0aaeee7..2b0be84 100644
+--- a/libappstream-glib/Makefile.am
++++ b/libappstream-glib/Makefile.am
+@@ -90,6 +90,7 @@ libappstream_glib_include_HEADERS =				\
+ 	as-utils.h						\
+ 	as-version.h
+ 
++nodist_libappstream_glib_la_SOURCES =
+ libappstream_glib_la_SOURCES =					\
+ 	as-app.c						\
+ 	as-app-desktop.c					\
+@@ -146,7 +147,7 @@ libappstream_glib_la_SOURCES +=					\
+ endif
+ 
+ if HAVE_GPERF
+-libappstream_glib_la_SOURCES += as-tag-private.h
++nodist_libappstream_glib_la_SOURCES += as-tag-private.h
+ BUILT_SOURCES += as-tag-private.h
+ endif
+ 
+diff --git a/libappstream-glib/as-tag.c b/libappstream-glib/as-tag.c
+index e802dcb..cd76e65 100644
+--- a/libappstream-glib/as-tag.c
++++ b/libappstream-glib/as-tag.c
+@@ -37,7 +37,7 @@
+ 
+ #ifdef HAVE_GPERF
+   /* we need to define this now as gperf just writes a big header file */
+-  const struct tag_data *as_tag_from_gperf (const char *tag, guint etag);
++  const struct tag_data *_as_tag_from_gperf (const char *tag, guint etag);
+   #include "as-tag-private.h"
+ #endif
+ 
+@@ -85,7 +85,7 @@ as_tag_from_string_full (const gchar *tag, AsTagFlags flags)
+ 
+ #ifdef HAVE_GPERF
+ 	/* use a perfect hash */
+-	ky = as_tag_from_gperf (tag, strlen (tag));
++	ky = _as_tag_from_gperf (tag, (guint) strlen (tag));
+ 	if (ky != NULL)
+ 		etag = ky->etag;
+ #else
+diff --git a/libappstream-glib/as-tag.gperf b/libappstream-glib/as-tag.gperf
+index 7e13f72..3c396cd 100644
+--- a/libappstream-glib/as-tag.gperf
++++ b/libappstream-glib/as-tag.gperf
+@@ -1,7 +1,7 @@
+ %language=ANSI-C
+ %struct-type
+-%define hash-function-name as_tag_hash
+-%define lookup-function-name as_tag_from_gperf
++%define hash-function-name _as_tag_hash
++%define lookup-function-name _as_tag_from_gperf
+ %readonly-tables
+ %includes
+ %pic
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..edd6248
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+Don-t-change-ABI-when-built-with-without-gperf-123.patch
-- 
2.8.1

>From 127de9d2c11157a3e47b666e8aacc4a27fb98881 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Mon, 1 Aug 2016 17:10:13 +0100
Subject: [PATCH 5/6] Don't assume that AudioVideo apps support both Audio and
 Video
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Rhythmbox is one prominent example.

Reviewed-by: Héctor Orón Martínez <[email protected]>
[smcv: fix DEP-3 syntax, no functional change]
Signed-off-by: Simon McVittie <[email protected]>
---
 debian/changelog                                   |  3 ++
 ...not-split-up-the-main-AudioVideo-category.patch | 44 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 48 insertions(+)
 create mode 100644 debian/patches/Do-not-split-up-the-main-AudioVideo-category.patch

diff --git a/debian/changelog b/debian/changelog
index 3c3d2ce..1b81f44 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ appstream-glib (0.5.17-1) UNRELEASED; urgency=medium
     - update .symbols file
   * d/p/Don-t-change-ABI-when-built-with-without-gperf-123.patch:
     don't change ABI if gperf happens to be installed on the build system
+  * d/p/Do-not-split-up-the-main-AudioVideo-category.patch:
+    don't assume that AudioVideo apps like Rhythmbox support both Audio
+    and Video
 
  -- Simon McVittie <[email protected]>  Tue, 02 Aug 2016 15:51:06 +0100
 
diff --git a/debian/patches/Do-not-split-up-the-main-AudioVideo-category.patch b/debian/patches/Do-not-split-up-the-main-AudioVideo-category.patch
new file mode 100644
index 0000000..a94f05f
--- /dev/null
+++ b/debian/patches/Do-not-split-up-the-main-AudioVideo-category.patch
@@ -0,0 +1,44 @@
+From: Richard Hughes <[email protected]>
+Date: Thu, 28 Jul 2016 11:46:42 +0100
+Subject: Do not split up the main AudioVideo category
+
+Description:
+ Consider an app that looks (in part) like this:
+ .
+     [Desktop Entry]
+     Name=Rhythmbox
+     Categories=GNOME;GTK;AudioVideo;Audio;Player;
+ .
+ According to the Desktop Entry spec, this is correct (perhaps RB should
+ also have Music, but that's not relevant here). AudioVideo is a "main
+ category" while Audio is an "additional category", so it would not be
+ Desktop-Entry-spec-compliant to omit AudioVideo. I would expect these
+ categories to be passed through unmodified.
+ .
+ However, the result in appstream-glib is that RB is additionally placed
+ in the Video category, which is inappropriate: it can't play videos.
+Bug: https://github.com/hughsie/appstream-glib/issues/121
+Origin: upstream, 0.5.18, commit:90baa547a4a6268ae8750ece581a0ef432aca090
+---
+ libappstream-glib/as-app.c | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
+index dbb4f91..4ef39c6 100644
+--- a/libappstream-glib/as-app.c
++++ b/libappstream-glib/as-app.c
+@@ -2203,14 +2203,6 @@ as_app_add_category (AsApp *app, const gchar *category)
+ 		return;
+ 	}
+ 
+-	/* split this meta-category up */
+-	if (g_strcmp0 (category, "AudioVideo") == 0) {
+-		if (!as_app_has_category (app, "Audio"))
+-			as_app_add_category (app, "Audio");
+-		if (!as_app_has_category (app, "Video"))
+-			as_app_add_category (app, "Video");
+-	}
+-
+ 	g_ptr_array_add (priv->categories, g_strdup (category));
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index edd6248..8b2fa48 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 Don-t-change-ABI-when-built-with-without-gperf-123.patch
+Do-not-split-up-the-main-AudioVideo-category.patch
-- 
2.8.1

>From e7ff294ae4b0498398815ec337c7d1101b370858 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Tue, 2 Aug 2016 12:51:49 +0100
Subject: [PATCH 6/6] Add patches to fix monitoring for explicitly-added files

Both were already reviewed by upstream.

Signed-off-by: Simon McVittie <[email protected]>
---
 debian/changelog                                   |  3 +
 ...le_internal-don-t-redundantly-monitor-fil.patch | 85 ++++++++++++++++++++++
 ...le_internal-set-up-path-data-for-the-file.patch | 53 ++++++++++++++
 debian/patches/series                              |  2 +
 4 files changed, 143 insertions(+)
 create mode 100644 debian/patches/as_store_from_file_internal-don-t-redundantly-monitor-fil.patch
 create mode 100644 debian/patches/as_store_from_file_internal-set-up-path-data-for-the-file.patch

diff --git a/debian/changelog b/debian/changelog
index 1b81f44..a1551c7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,9 @@ appstream-glib (0.5.17-1) UNRELEASED; urgency=medium
   * d/p/Do-not-split-up-the-main-AudioVideo-category.patch:
     don't assume that AudioVideo apps like Rhythmbox support both Audio
     and Video
+  * d/p/as_store_from_file_internal-don-t-redundantly-monitor-fil.patch,
+    d/p/as_store_from_file_internal-set-up-path-data-for-the-file.patch:
+    fix monitoring for explicitly-added files
 
  -- Simon McVittie <[email protected]>  Tue, 02 Aug 2016 15:51:06 +0100
 
diff --git a/debian/patches/as_store_from_file_internal-don-t-redundantly-monitor-fil.patch b/debian/patches/as_store_from_file_internal-don-t-redundantly-monitor-fil.patch
new file mode 100644
index 0000000..742d58f
--- /dev/null
+++ b/debian/patches/as_store_from_file_internal-don-t-redundantly-monitor-fil.patch
@@ -0,0 +1,85 @@
+From: Simon McVittie <[email protected]>
+Date: Mon, 1 Aug 2016 21:35:01 +0100
+Subject: as_store_from_file_internal: don't redundantly monitor files
+
+We only need to monitor the file if we are not already monitoring
+(or intending to monitor) its parent directory, as we are in
+as_store_watch_source_added() and as_store_load_app_info_file(),
+but not as_store_from_file().
+
+Signed-off-by: Simon McVittie <[email protected]>
+Applied-upstream: 0.5.18, commit:c235c06c868b05dcc36d4755dd379bf5a8d90698
+---
+ libappstream-glib/as-store.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
+index 6a38f7d..a83dc12 100644
+--- a/libappstream-glib/as-store.c
++++ b/libappstream-glib/as-store.c
+@@ -114,6 +114,7 @@ static gboolean	as_store_from_file_internal (AsStore *store,
+ 					     GFile *file,
+ 					     const gchar *id_prefix,
+ 					     const gchar *arch,
++					     AsStoreWatchFlags watch_flags,
+ 					     GCancellable *cancellable,
+ 					     GError **error);
+ 
+@@ -1346,10 +1347,13 @@ as_store_watch_source_added (AsStore *store, const gchar *filename)
+ 		return;
+ 	}
+ 	file = g_file_new_for_path (filename);
++	/* Do not watch the file for changes: we're already watching its
++	 * parent directory */
+ 	if (!as_store_from_file_internal (store,
+ 					  file,
+ 					  path_data->id_prefix,
+ 					  path_data->arch,
++					  AS_STORE_WATCH_FLAG_NONE,
+ 					  NULL, /* cancellable */
+ 					  &error)){
+ 		g_warning ("failed to rescan: %s", error->message);
+@@ -1471,6 +1475,7 @@ as_store_from_file_internal (AsStore *store,
+ 			     GFile *file,
+ 			     const gchar *id_prefix,
+ 			     const gchar *arch,
++			     AsStoreWatchFlags watch_flags,
+ 			     GCancellable *cancellable,
+ 			     GError **error)
+ {
+@@ -1512,7 +1517,7 @@ as_store_from_file_internal (AsStore *store,
+ 	}
+ 
+ 	/* watch for file changes */
+-	if (priv->watch_flags > 0) {
++	if (watch_flags > 0) {
+ 		if (!as_monitor_add_file (priv->monitor,
+ 					  filename,
+ 					  cancellable,
+@@ -1552,9 +1557,12 @@ as_store_from_file (AsStore *store,
+ 		    GCancellable *cancellable,
+ 		    GError **error)
+ {
++	AsStorePrivate *priv = GET_PRIVATE (store);
++
+ 	return as_store_from_file_internal (store, file,
+ 					    NULL, /* id_prefix */
+ 					    NULL, /* arch */
++					    priv->watch_flags,
+ 					    cancellable, error);
+ }
+ 
+@@ -2179,10 +2187,13 @@ as_store_load_app_info_file (AsStore *store,
+ 		return FALSE;
+ 
+ 	file = g_file_new_for_path (path_xml);
++	/* Do not monitor the file: assume we are already monitoring its
++	 * directory */
+ 	return as_store_from_file_internal (store,
+ 					    file,
+ 					    id_prefix,
+ 					    arch,
++					    AS_STORE_WATCH_FLAG_NONE,
+ 					    cancellable,
+ 					    error);
+ }
diff --git a/debian/patches/as_store_from_file_internal-set-up-path-data-for-the-file.patch b/debian/patches/as_store_from_file_internal-set-up-path-data-for-the-file.patch
new file mode 100644
index 0000000..2732290
--- /dev/null
+++ b/debian/patches/as_store_from_file_internal-set-up-path-data-for-the-file.patch
@@ -0,0 +1,53 @@
+From: Simon McVittie <[email protected]>
+Date: Mon, 1 Aug 2016 21:44:49 +0100
+Subject: as_store_from_file_internal: set up path data for the file itself
+
+Otherwise, when it changes we'll just emit
+
+    As-WARNING **: no path data for /.../xmls
+
+and not actually update its contents.
+
+Signed-off-by: Simon McVittie <[email protected]>
+Applied-upstream: 0.5.18, commit:431bbb94698ee34849f1a6fdeca50374b909419e
+---
+ libappstream-glib/as-store.c | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
+index a83dc12..14ad9f2 100644
+--- a/libappstream-glib/as-store.c
++++ b/libappstream-glib/as-store.c
+@@ -1341,7 +1341,9 @@ as_store_watch_source_added (AsStore *store, const gchar *filename)
+ 	/* we helpfully saved this */
+ 	dirname = g_path_get_dirname (filename);
+ 	g_debug ("parsing new file %s from %s", filename, dirname);
+-	path_data = g_hash_table_lookup (priv->appinfo_dirs, dirname);
++	path_data = g_hash_table_lookup (priv->appinfo_dirs, filename);
++	if (path_data == NULL)
++		path_data = g_hash_table_lookup (priv->appinfo_dirs, dirname);
+ 	if (path_data == NULL) {
+ 		g_warning ("no path data for %s", dirname);
+ 		return;
+@@ -1441,13 +1443,6 @@ as_store_add_path_data (AsStore *store,
+ 		return;
+ 	}
+ 
+-	/* check is a directory */
+-	if (!g_file_test (path, G_FILE_TEST_IS_DIR)) {
+-		g_warning ("not adding path %s [%s:%s] as not a directory",
+-			   path, id_prefix, arch);
+-		return;
+-	}
+-
+ 	/* check not already exists */
+ 	path_data = g_hash_table_lookup (priv->appinfo_dirs, path);
+ 	if (path_data != NULL) {
+@@ -1518,6 +1513,7 @@ as_store_from_file_internal (AsStore *store,
+ 
+ 	/* watch for file changes */
+ 	if (watch_flags > 0) {
++		as_store_add_path_data (store, filename, id_prefix, arch);
+ 		if (!as_monitor_add_file (priv->monitor,
+ 					  filename,
+ 					  cancellable,
diff --git a/debian/patches/series b/debian/patches/series
index 8b2fa48..2bd0fde 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
 Don-t-change-ABI-when-built-with-without-gperf-123.patch
 Do-not-split-up-the-main-AudioVideo-category.patch
+as_store_from_file_internal-don-t-redundantly-monitor-fil.patch
+as_store_from_file_internal-set-up-path-data-for-the-file.patch
-- 
2.8.1

Reply via email to