tracker: conditional compilation of GLib.SpawnError exception handling
authorRaul Gutierrez Segales <rgs@collabora.co.uk>
Thu, 1 Sep 2011 22:16:27 +0000 (23:16 +0100)
committerRaul Gutierrez Segales <rgs@collabora.co.uk>
Thu, 1 Sep 2011 22:16:27 +0000 (23:16 +0100)
Starting Tracker 0.10.6, the GLib.SpawnError is exception is thrown
when calling Tracker.Sparql.Connection.get (). So we need to test
for the installed version and catch or not the exception, accordingly.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=657650

configure.ac
tests/lib/tracker/Makefile.am
tests/lib/tracker/backend.vala

index b1b65c7..00ecf86 100644 (file)
@@ -131,6 +131,7 @@ TP_GLIB_REQUIRED=0.13.1
 VALA_REQUIRED=0.13.3
 VALADOC_REQUIRED=0.3.1
 TRACKER_SPARQL_REQUIRED=0.10
+TRACKER_SPARQL_NEWER_VER=0.10.6
 GCONF2_REQUIRED=2.31
 EBOOK_REQUIRED=3.1.5
 EDATASERVER_REQUIRED=3.1.5
@@ -148,8 +149,16 @@ PKG_CHECK_MODULES([GEE], [gee-1.0 < 0.7])
 PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
 
 if test x$enable_tracker_backend = xyes; then
+       # Starting Tracker 0.10.6, the GLib.SpawnError is exception is thrown
+       # when calling Tracker.Sparql.Connection.get (). So we need to test
+       # for the installed version and catch or not the exception, accordingly.
         PKG_CHECK_MODULES([TRACKER_SPARQL],
-                          [tracker-sparql-0.10 >= $TRACKER_SPARQL_REQUIRED])
+                          [tracker-sparql-0.10 >= $TRACKER_SPARQL_NEWER_VER],
+                         [AM_CONDITIONAL(HAVE_NEW_TRACKER, [ test 1 == 1 ])],
+                         [PKG_CHECK_MODULES([TRACKER_SPARQL],
+                                             [tracker-sparql-0.10 >= $TRACKER_SPARQL_REQUIRED],
+                                            [AM_CONDITIONAL(HAVE_NEW_TRACKER, [ test 0 == 1 ])])]
+                         )
 fi
 
 if test x$enable_eds_backend = xyes; then
index c8520c8..da78f65 100644 (file)
@@ -1,3 +1,7 @@
+if HAVE_NEW_TRACKER
+TRACKER_VER_CONSTANTS = -D USE_NEW_SPAWN_EXCEPTION
+endif
+
 VALAFLAGS += \
        $(ERROR_VALAFLAGS) \
        --library=tracker-test \
@@ -12,6 +16,7 @@ VALAFLAGS += \
        --pkg tracker-sparql-0.10 \
        --pkg folks-tracker \
        -g \
+       $(TRACKER_VER_CONSTANTS) \
        $(NULL)
 
 noinst_LTLIBRARIES = libtracker-test.la
index 942052e..f411ed2 100644 (file)
@@ -255,11 +255,13 @@ public class TrackerTest.Backend
           throw new BackendSetupError.ADD_CONTACT_FAILED
           ("Error fetching SPARQL connection handler : %s\n", e3.message);
         }
+#if USE_NEW_SPAWN_EXCEPTION
       catch (GLib.SpawnError e4)
         {
           throw new BackendSetupError.ADD_CONTACT_FAILED
           ("Error fetching SPARQL connection handler : %s\n", e4.message);
         }
+#endif
     }
 
   private void _add_contacts () throws BackendSetupError