backport upstream rss fixes

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko 2015-07-24 10:15:47 +03:00
parent 35f10eb924
commit 579aeb8143
5 changed files with 232 additions and 13 deletions

View File

@ -1,29 +1,27 @@
From ae76cb8c7aa3f4aff89f78bc124eeab06a58e083 Mon Sep 17 00:00:00 2001
From 68990f25f322e29b041bb47c20348021f8e5787f Mon Sep 17 00:00:00 2001
From: David King <amigadave@amigadave.com>
Date: Wed, 22 Jul 2015 13:31:55 +0100
Subject: [PATCH] libtracker-data: Fix printf string format
Subject: [PATCH 1/4] libtracker-data: Fix printf string format
Introduced by commit 81135ae19c727df716d0c0945869462e75a53497.
https://bugzilla.gnome.org/show_bug.cgi?id=752717
---
src/libtracker-data/tracker-db-interface-sqlite.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
src/libtracker-data/tracker-db-interface-sqlite.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 7ea87c8..17ea88d 100644
index 7ea87c8..a1d4d83 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -1304,7 +1304,8 @@ tracker_db_interface_sqlite_fts_delete_id (TrackerDBInterface *db_interface,
@@ -1304,6 +1304,7 @@ tracker_db_interface_sqlite_fts_delete_id (TrackerDBInterface *db_interface,
stmt = tracker_db_interface_create_statement (db_interface,
TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE,
&error,
- db_interface->fts_delete_str);
+ "%s",
+ db_interface->fts_delete_str);
db_interface->fts_delete_str);
if (!stmt || error) {
if (error) {
g_warning ("Could not create FTS delete statement: %s",
--
2.4.6

View File

@ -0,0 +1,42 @@
From ca48064339d58a9b5a87e005629d671fe663256b Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 22 Jul 2015 20:19:20 +0200
Subject: [PATCH 2/4] libtracker-miner: Fallback to basename checks on hidden
files
When we receive DELETED events on files, the TrackerFileNotifier/
TrackerIndexingTree attempt to find out if its hidden and should
thus be ignored. However the g_file_query_info() evidently fails
at that time, with the file already deleted, so we think the file
is not hidden and the delete operation gets propagated to the
TrackerMineFS.
Fix this by resorting to basename checks as a last resort, so
we do the right thing even after the file is gone.
---
src/libtracker-common/tracker-file-utils.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index 6fca87e..123d347 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -743,6 +743,15 @@ tracker_file_is_hidden (GFile *file)
/* Check if GIO says the file is hidden */
is_hidden = g_file_info_get_is_hidden (file_info);
g_object_unref (file_info);
+ } else {
+ gchar *basename;
+
+ /* Resort last to basename checks, this might happen on
+ * already deleted files.
+ */
+ basename = g_file_get_basename (file);
+ is_hidden = basename[0] == '.';
+ g_free (basename);
}
return is_hidden;
--
2.4.6

View File

@ -0,0 +1,144 @@
From e6dbeb6ea1b386ef22a6e530810ad38cb55ce8c5 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 23 Jul 2015 22:28:00 +0200
Subject: [PATCH 3/4] rss: Set website url as a nfo:WebSite
nco:websiteUrl has to point to a rdfs:Resource according to the
ontology, so make the string a full blown nfo:WebSite, with its
nie:url.
---
src/miners/rss/tracker-miner-rss.c | 64 ++++++++++++++++++++++++++++++++------
1 file changed, 55 insertions(+), 9 deletions(-)
diff --git a/src/miners/rss/tracker-miner-rss.c b/src/miners/rss/tracker-miner-rss.c
index 5b349ab..a0f55ad 100644
--- a/src/miners/rss/tracker-miner-rss.c
+++ b/src/miners/rss/tracker-miner-rss.c
@@ -679,14 +679,36 @@ feed_item_insert_cb (GObject *source,
feed_item_insert_data_free (fiid);
}
+static gchar *
+sparql_add_website (TrackerSparqlBuilder *sparql,
+ const gchar *uri)
+{
+ gchar *website_urn;
+
+ website_urn = tracker_sparql_escape_uri_printf ("urn:website:%s", uri);
+
+ tracker_sparql_builder_insert_silent_open (sparql, NULL);
+ tracker_sparql_builder_subject_iri (sparql, website_urn);
+ tracker_sparql_builder_predicate (sparql, "a");
+ tracker_sparql_builder_object (sparql, "nie:DataObject");
+ tracker_sparql_builder_object (sparql, "nfo:Website");
+
+ tracker_sparql_builder_predicate (sparql, "nie:url");
+ tracker_sparql_builder_object_unvalidated (sparql, uri);
+
+ tracker_sparql_builder_insert_close (sparql);
+
+ return website_urn;
+}
+
static void
sparql_add_contact (TrackerSparqlBuilder *sparql,
const gchar *alias,
- GrssPerson *contact)
+ GrssPerson *contact,
+ const gchar *website_urn)
{
const gchar *name = grss_person_get_name (contact);
const gchar *email = grss_person_get_email (contact);
- const gchar *uri = grss_person_get_uri (contact);
tracker_sparql_builder_subject (sparql, alias);
tracker_sparql_builder_predicate (sparql, "a");
@@ -708,9 +730,9 @@ sparql_add_contact (TrackerSparqlBuilder *sparql,
tracker_sparql_builder_object_blank_close (sparql);
}
- if (uri != NULL) {
+ if (website_urn) {
tracker_sparql_builder_predicate (sparql, "nco:websiteUrl");
- tracker_sparql_builder_object_unvalidated (sparql, uri);
+ tracker_sparql_builder_object_iri (sparql, website_urn);
}
}
@@ -736,6 +758,8 @@ feed_item_check_exists_cb (GObject *source_object,
const GList *contributors;
const GList *list, *l;
GList *contrib_aliases = NULL;
+ gchar *website_urn = NULL;
+ GHashTable *contributor_websites;
fiid = user_data;
connection = TRACKER_SPARQL_CONNECTION (source_object);
@@ -785,7 +809,28 @@ feed_item_check_exists_cb (GObject *source_object,
g_message ("Inserting feed item for '%s'", url);
+ contributor_websites = g_hash_table_new_full (NULL, NULL, NULL,
+ (GDestroyNotify) g_free);
sparql = tracker_sparql_builder_new_update ();
+ author = grss_feed_item_get_author (fiid->item);
+ contributors = grss_feed_item_get_contributors (fiid->item);
+
+ for (l = contributors; l; l = l->next) {
+ const gchar *url;
+ gchar *urn;
+
+ url = grss_person_get_uri (l->data);
+
+ if (!url)
+ continue;
+
+ urn = sparql_add_website (sparql, url);
+ g_hash_table_insert (contributor_websites, l->data, urn);
+ }
+
+ if (author && grss_person_get_uri (author)) {
+ website_urn = sparql_add_website (sparql, grss_person_get_uri (author));
+ }
has_geolocation = grss_feed_item_get_geo_point (fiid->item, &latitude, &longitude);
tracker_sparql_builder_insert_open (sparql, NULL);
@@ -804,14 +849,11 @@ feed_item_check_exists_cb (GObject *source_object,
tracker_sparql_builder_object_double (sparql, longitude);
}
- author = grss_feed_item_get_author (fiid->item);
if (author != NULL) {
g_message (" Author:'%s'", grss_person_get_name (author));
- sparql_add_contact (sparql, "_:author", author);
+ sparql_add_contact (sparql, "_:author", author, website_urn);
}
- contributors = grss_feed_item_get_contributors (fiid->item);
-
for (l = contributors; l; l = l->next) {
gchar *subject;
gint i = 0;
@@ -820,7 +862,9 @@ feed_item_check_exists_cb (GObject *source_object,
subject = g_strdup_printf ("_:contrib%d", i++);
contrib_aliases = g_list_prepend (contrib_aliases, subject);
- sparql_add_contact (sparql, subject, l->data);
+ sparql_add_contact (sparql, subject, l->data,
+ g_hash_table_lookup (contributor_websites, l->data));
+ g_free (subject);
}
tracker_sparql_builder_subject (sparql, "_:message");
@@ -918,6 +962,8 @@ feed_item_check_exists_cb (GObject *source_object,
g_object_unref (cursor);
g_object_unref (sparql);
+ g_free (website_urn);
+ g_hash_table_free (contributor_websites);
}
static void
--
2.4.6

26
0004-rss-fix-typo.patch Normal file
View File

@ -0,0 +1,26 @@
From c40e1750d8f948e50d3b6c4c5194be7085af1138 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 24 Jul 2015 00:22:41 +0200
Subject: [PATCH 4/4] rss: fix typo
Destroy, not free.
---
src/miners/rss/tracker-miner-rss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/miners/rss/tracker-miner-rss.c b/src/miners/rss/tracker-miner-rss.c
index a0f55ad..566cf54 100644
--- a/src/miners/rss/tracker-miner-rss.c
+++ b/src/miners/rss/tracker-miner-rss.c
@@ -963,7 +963,7 @@ feed_item_check_exists_cb (GObject *source_object,
g_object_unref (cursor);
g_object_unref (sparql);
g_free (website_urn);
- g_hash_table_free (contributor_websites);
+ g_hash_table_destroy (contributor_websites);
}
static void
--
2.4.6

View File

@ -16,7 +16,7 @@
Name: tracker
Version: 1.5.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Desktop-neutral search tool and indexer
Group: Applications/System
@ -28,8 +28,11 @@ Source0: https://download.gnome.org/sources/%{name}/1.5/%{name}-%{version
# https://bugzilla.redhat.com/show_bug.cgi?id=771601
Patch0: 0001-Only-autostart-in-GNOME-771601.patch
# Fix broken printf format string.
Patch1: tracker-1.5.1-fix-printf-string-format.patch
# Hotfixes from master
Patch1: 0001-libtracker-data-Fix-printf-string-format.patch
Patch2: 0002-libtracker-miner-Fallback-to-basename-checks-on-hidd.patch
Patch3: 0003-rss-Set-website-url-as-a-nfo-WebSite.patch
Patch4: 0004-rss-fix-typo.patch
BuildRequires: desktop-file-utils
BuildRequires: firefox
@ -177,7 +180,10 @@ This package contains the documentation for tracker
%setup -q
%patch0 -p1 -b .autostart-gnome
%patch1 -p1 -b .tracker-printf
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
## nuke unwanted rpaths, see also
## https://fedoraproject.org/wiki/Packaging/Guidelines#Beware_of_Rpath
@ -329,6 +335,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%changelog
* Fri Jul 24 2015 Igor Gnatenko <ignatenko@src.gnome.org> - 1.5.1-2
- Backport rss fixes from upstream
* Wed Jul 22 2015 David King <amigadave@amigadave.com> - 1.5.1-1
- Update to 1.5.1