Hello community, here is the log from the commit of package gnome-online-miners for openSUSE:Factory checked in at 2016-09-11 00:52:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gnome-online-miners (Old) and /work/SRC/openSUSE:Factory/.gnome-online-miners.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gnome-online-miners" Changes: -------- --- /work/SRC/openSUSE:Factory/gnome-online-miners/gnome-online-miners.changes 2016-03-29 14:37:37.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.gnome-online-miners.new/gnome-online-miners.changes 2016-09-11 00:52:30.000000000 +0200 @@ -1,0 +2,10 @@ +Fri Sep 2 10:44:38 UTC 2016 - zai...@opensuse.org + +- Update to version 3.20.1 (boo#997057): + + gdata: + - Query Google Drive in smaller chunks instead of getting + everything all at once (bgo#770656). + - Too many nfo:Equipment objects are needlessly created + (bgo#770658). + +------------------------------------------------------------------- Old: ---- gnome-online-miners-3.20.0.tar.xz New: ---- gnome-online-miners-3.20.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gnome-online-miners.spec ++++++ --- /var/tmp/diff_new_pack.x1lJby/_old 2016-09-11 00:52:31.000000000 +0200 +++ /var/tmp/diff_new_pack.x1lJby/_new 2016-09-11 00:52:31.000000000 +0200 @@ -18,7 +18,7 @@ Name: gnome-online-miners -Version: 3.20.0 +Version: 3.20.1 Release: 0 Summary: Crawls through your online content License: GPL-2.0+ ++++++ gnome-online-miners-3.20.0.tar.xz -> gnome-online-miners-3.20.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/NEWS new/gnome-online-miners-3.20.1/NEWS --- old/gnome-online-miners-3.20.0/NEWS 2016-03-21 17:03:35.000000000 +0100 +++ new/gnome-online-miners-3.20.1/NEWS 2016-09-02 10:25:12.000000000 +0200 @@ -1,3 +1,12 @@ +Overview of changes in 3.20.1 +============================= + +* Bugs fixed: + 770656 gdata: Query Google Drive in smaller chunks instead of getting + everything all at once + 770658 gdata: Too many nfo:Equipment objects are needlessly created + + Overview of changes in 3.20.0 ============================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/aclocal.m4 new/gnome-online-miners-3.20.1/aclocal.m4 --- old/gnome-online-miners-3.20.0/aclocal.m4 2016-03-21 17:06:04.000000000 +0100 +++ new/gnome-online-miners-3.20.1/aclocal.m4 2016-09-02 10:26:02.000000000 +0200 @@ -363,32 +363,63 @@ eliminate use of --enable-iso-cxx. See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant <sc...@netsplit.com>. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29) +dnl +dnl Copyright © 2004 Scott James Remnant <sc...@netsplit.com>. +dnl Copyright © 2012-2015 Dan Nicholson <dbn.li...@gmail.com> +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -410,18 +441,19 @@ PKG_CONFIG="" fi fi[]dnl -])# PKG_PROG_PKG_CONFIG +])dnl PKG_PROG_PKG_CONFIG -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ @@ -431,8 +463,10 @@ $3])dnl fi]) -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" @@ -444,10 +478,11 @@ else pkg_failed=untried fi[]dnl -])# _PKG_CONFIG +])dnl _PKG_CONFIG -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -455,19 +490,17 @@ else _pkg_short_errors_supported=no fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED +])dnl _PKG_SHORT_ERRORS_SUPPORTED -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl @@ -521,16 +554,40 @@ AC_MSG_RESULT([yes]) $3 fi[]dnl -])# PKG_CHECK_MODULES +])dnl PKG_CHECK_MODULES -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -541,16 +598,18 @@ AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR +])dnl PKG_INSTALLDIR -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], @@ -561,13 +620,15 @@ AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR +])dnl PKG_NOARCH_INSTALLDIR -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl @@ -576,7 +637,7 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR +])dnl PKG_CHECK_VAR # Copyright (C) 2002-2014 Free Software Foundation, Inc. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/configure new/gnome-online-miners-3.20.1/configure --- old/gnome-online-miners-3.20.0/configure 2016-03-21 17:06:04.000000000 +0100 +++ new/gnome-online-miners-3.20.1/configure 2016-09-02 10:26:03.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for GNOME Online Miners 3.20.0. +# Generated by GNU Autoconf 2.69 for GNOME Online Miners 3.20.1. # # Report bugs to <https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-online-miners>. # @@ -591,8 +591,8 @@ # Identity of this package. PACKAGE_NAME='GNOME Online Miners' PACKAGE_TARNAME='gnome-online-miners' -PACKAGE_VERSION='3.20.0' -PACKAGE_STRING='GNOME Online Miners 3.20.0' +PACKAGE_VERSION='3.20.1' +PACKAGE_STRING='GNOME Online Miners 3.20.1' PACKAGE_BUGREPORT='https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-online-miners' PACKAGE_URL='https://wiki.gnome.org/Projects/GnomeOnlineMiners' @@ -1379,7 +1379,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNOME Online Miners 3.20.0 to adapt to many kinds of systems. +\`configure' configures GNOME Online Miners 3.20.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1450,7 +1450,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNOME Online Miners 3.20.0:";; + short | recursive ) echo "Configuration of GNOME Online Miners 3.20.1:";; esac cat <<\_ACEOF @@ -1604,7 +1604,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNOME Online Miners configure 3.20.0 +GNOME Online Miners configure 3.20.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1882,7 +1882,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNOME Online Miners $as_me 3.20.0, which was +It was created by GNOME Online Miners $as_me 3.20.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2753,7 +2753,7 @@ # Define the identity of the package. PACKAGE='gnome-online-miners' - VERSION='3.20.0' + VERSION='3.20.1' cat >>confdefs.h <<_ACEOF @@ -13974,7 +13974,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNOME Online Miners $as_me 3.20.0, which was +This file was extended by GNOME Online Miners $as_me 3.20.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14041,7 +14041,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -GNOME Online Miners config.status 3.20.0 +GNOME Online Miners config.status 3.20.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/configure.ac new/gnome-online-miners-3.20.1/configure.ac --- old/gnome-online-miners-3.20.0/configure.ac 2016-03-21 17:03:17.000000000 +0100 +++ new/gnome-online-miners-3.20.1/configure.ac 2016-09-02 10:24:15.000000000 +0200 @@ -1,5 +1,5 @@ AC_INIT([GNOME Online Miners], - [3.20.0], + [3.20.1], [https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-online-miners], [gnome-online-miners], [https://wiki.gnome.org/Projects/GnomeOnlineMiners]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/src/gom-gdata-miner.c new/gnome-online-miners-3.20.1/src/gom-gdata-miner.c --- old/gnome-online-miners-3.20.0/src/gom-gdata-miner.c 2016-03-21 17:03:00.000000000 +0100 +++ new/gnome-online-miners-3.20.1/src/gom-gdata-miner.c 2016-08-31 18:40:14.000000000 +0200 @@ -35,6 +35,8 @@ #define PREFIX_DRIVE "google:drive:" #define PREFIX_PICASAWEB "google:picasaweb:" +static const guint MAX_RESULTS = 50; + G_DEFINE_TYPE (GomGDataMiner, gom_gdata_miner, GOM_TYPE_MINER) static gchar * @@ -550,30 +552,11 @@ if (make != NULL || model != NULL) { - equipment_resource = gom_tracker_sparql_connection_ensure_resource - (job->connection, - job->cancellable, error, - &resource_exists, - job->datasource_urn, resource, - "nfo:Equipment", NULL); - - if (*error != NULL) - goto out; - - gom_tracker_sparql_connection_insert_or_replace_triple - (job->connection, - job->cancellable, error, - job->datasource_urn, equipment_resource, - "nfo:manufacturer", make); - - if (*error != NULL) - goto out; - - gom_tracker_sparql_connection_insert_or_replace_triple - (job->connection, - job->cancellable, error, - job->datasource_urn, equipment_resource, - "nfo:model", model); + equipment_resource = gom_tracker_utils_ensure_equipment_resource (job->connection, + job->cancellable, + error, + make, + model); if (*error != NULL) goto out; @@ -809,34 +792,62 @@ GDataDocumentsService *service, GError **error) { - GDataDocumentsQuery *query; - GDataDocumentsFeed *feed; + GDataDocumentsQuery *query = NULL; + GDataDocumentsFeed *feed = NULL; GList *entries, *l; + gboolean succeeded_once = FALSE; - query = gdata_documents_query_new (NULL); + query = gdata_documents_query_new_with_limits (NULL, 1, MAX_RESULTS); gdata_documents_query_set_show_folders (query, TRUE); - feed = gdata_documents_service_query_documents - (service, query, - job->cancellable, NULL, NULL, error); - g_object_unref (query); + while (TRUE) + { + GError *local_error; - if (feed == NULL) - return; + local_error = NULL; + feed = gdata_documents_service_query_documents + (service, query, + job->cancellable, NULL, NULL, &local_error); + if (local_error != NULL) + { + if (succeeded_once) + { + g_warning ("Unable to query: %s", local_error->message); + g_error_free (local_error); + } + else + { + g_propagate_error (error, local_error); + } - entries = gdata_feed_get_entries (GDATA_FEED (feed)); - for (l = entries; l != NULL; l = l->next) - { - account_miner_job_process_entry (job, service, l->data, error); + break; + } - if (*error != NULL) + succeeded_once = TRUE; + + entries = gdata_feed_get_entries (GDATA_FEED (feed)); + if (entries == NULL) + break; + + for (l = entries; l != NULL; l = l->next) { - g_warning ("Unable to process entry %p: %s", l->data, (*error)->message); - g_clear_error (error); + local_error = NULL; + account_miner_job_process_entry (job, service, l->data, &local_error); + + if (local_error != NULL) + { + g_warning ("Unable to process entry %p: %s", l->data, local_error->message); + g_error_free (local_error); + } } + + gdata_query_next_page (GDATA_QUERY (query)); + g_clear_object (&feed); } - g_object_unref (feed); + out: + g_clear_object (&feed); + g_clear_object (&query); } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/src/gom-tracker.c new/gnome-online-miners-3.20.1/src/gom-tracker.c --- old/gnome-online-miners-3.20.0/src/gom-tracker.c 2014-12-09 16:44:41.000000000 +0100 +++ new/gnome-online-miners-3.20.1/src/gom-tracker.c 2016-08-31 18:40:14.000000000 +0200 @@ -393,6 +393,89 @@ return retval; } +gchar * +gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, + const gchar *make, + const gchar *model) +{ + GError *local_error; + TrackerSparqlCursor *cursor = NULL; + gboolean res; + gchar *equip_uri = NULL; + gchar *insert = NULL; + gchar *retval = NULL; + gchar *select = NULL; + + g_return_val_if_fail (TRACKER_SPARQL_IS_CONNECTION (connection), NULL); + g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + g_return_val_if_fail (make != NULL || model != NULL, NULL); + + equip_uri = tracker_sparql_escape_uri_printf ("urn:equipment:%s:%s:", + make != NULL ? make : "", + model != NULL ? model : ""); + select = g_strdup_printf ("SELECT <%s> WHERE { }", equip_uri); + + local_error = NULL; + cursor = tracker_sparql_connection_query (connection, select, cancellable, &local_error); + if (local_error != NULL) + { + g_propagate_error (error, local_error); + goto out; + } + + local_error = NULL; + res = tracker_sparql_cursor_next (cursor, cancellable, &local_error); + if (local_error != NULL) + { + g_propagate_error (error, local_error); + goto out; + } + + if (res) + { + const gchar *cursor_uri; + + cursor_uri = tracker_sparql_cursor_get_string (cursor, 0, NULL); + if (g_strcmp0 (cursor_uri, equip_uri) == 0) + { + /* return the found resource */ + retval = g_strdup (cursor_uri); + g_debug ("Found resource in the store: %s", retval); + goto out; + } + } + + /* not found, create the resource */ + insert = g_strdup_printf ("INSERT { <%s> a nfo:Equipment ; nfo:manufacturer \"%s\" ; nfo:model \"%s\" }", + equip_uri, + make, + model); + + local_error = NULL; + tracker_sparql_connection_update (connection, insert, G_PRIORITY_DEFAULT, cancellable, &local_error); + if (local_error != NULL) + { + g_propagate_error (error, local_error); + goto out; + } + + retval = equip_uri; + equip_uri = NULL; + + g_debug ("Created a new equipment resource: %s", retval); + + out: + g_clear_object (&cursor); + g_free (equip_uri); + g_free (insert); + g_free (select); + + return retval; +} + void gom_tracker_update_datasource (TrackerSparqlConnection *connection, const gchar *datasource_urn, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-online-miners-3.20.0/src/gom-tracker.h new/gnome-online-miners-3.20.1/src/gom-tracker.h --- old/gnome-online-miners-3.20.0/src/gom-tracker.h 2014-05-27 14:54:09.000000000 +0200 +++ new/gnome-online-miners-3.20.1/src/gom-tracker.h 2016-08-31 18:40:14.000000000 +0200 @@ -66,6 +66,12 @@ const gchar *email, const gchar *fullname); +gchar *gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection, + GCancellable *cancellable, + GError **error, + const gchar *make, + const gchar *model); + void gom_tracker_update_datasource (TrackerSparqlConnection *connection, const gchar *datasource_urn, gboolean resource_exists,