[tracker] Make raptor mandatory



commit 1d50a58de7b5a7cf1c82272d107839203f2eb5a8
Author: Jürg Billeter <j bitron ch>
Date:   Wed Apr 8 10:08:57 2009 +0200

    Make raptor mandatory
    
    rasqal depends on raptor.
---
 configure.ac                                   |    6 +---
 src/libtracker-data/tracker-data-backup.c      |   20 ---------------
 src/libtracker-data/tracker-turtle.c           |   32 +-----------------------
 src/libtracker-data/tracker-turtle.h           |   15 -----------
 src/tracker-indexer/tracker-removable-device.c |   18 -------------
 5 files changed, 2 insertions(+), 89 deletions(-)

diff --git a/configure.ac b/configure.ac
index 281c0e7..8454c26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,14 +204,10 @@ AC_SUBST(GCONF_LIBS)
 AM_CONDITIONAL(HAVE_GCONF, test "$have_gconf" = "yes")
 
 # Check for Raptor
-PKG_CHECK_MODULES(RAPTOR, [raptor >= 1.4.17], have_raptor=yes, have_raptor=no)
+PKG_CHECK_MODULES(RAPTOR, [raptor >= 1.4.17])
 AC_SUBST(RAPTOR_CFLAGS)
 AC_SUBST(RAPTOR_LIBS)
 
-if test x$have_raptor == "xyes"; then
-  AC_DEFINE(HAVE_RAPTOR, 1, [Raptor RDF parsers])
-fi
-
 # Check we have the DBUS binding tool we need
 AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool)
 if test -z $DBUSBINDINGTOOL; then
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 4db9165..e08e403 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -23,17 +23,13 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#ifdef HAVE_RAPTOR
 #include <raptor.h>
-#endif
 
 #include <libtracker-data/tracker-data-query.h>
 #include <libtracker-data/tracker-turtle.h>
 
 #include "tracker-data-backup.h"
 
-#ifdef HAVE_RAPTOR
-
 typedef struct BackupRestoreData BackupRestoreData;
 
 struct BackupRestoreData {
@@ -104,13 +100,10 @@ restore_backup_triple (gpointer                user_data,
 		      data->user_data);
 }
 
-#endif /* HAVE_RAPTOR */
-
 gboolean
 tracker_data_backup_save (const gchar  *turtle_filename,
 			  GError      **error)
 {
-#ifdef HAVE_RAPTOR
 	TrackerDBResultSet *data;
 	TrackerClass *service;
 	TurtleFile *turtle_file;
@@ -135,12 +128,6 @@ tracker_data_backup_save (const gchar  *turtle_filename,
 	tracker_turtle_close (turtle_file);
 
 	return TRUE;
-#else
-	g_set_error (error, 0, 0,
-		     "Turtle files are not supported, could not save backup");
-
-	return FALSE;
-#endif /* HAVE_RAPTOR */
 }
 
 gboolean
@@ -149,7 +136,6 @@ tracker_data_backup_restore (const gchar                   *turtle_filename,
 			     gpointer                       user_data,
 			     GError                       **error)
 {
-#ifdef HAVE_RAPTOR
 	BackupRestoreData data;
 
 	data.func = restore_func;
@@ -168,10 +154,4 @@ tracker_data_backup_restore (const gchar                   *turtle_filename,
 				(TurtleTripleCallback) restore_backup_triple,
 				&data);
 	return TRUE;
-#else
-	g_set_error (error, 0, 0,
-		     "Turtle files are not supported, could not restore backup");
-
-	return FALSE;
-#endif /* HAVE_RAPTOR */
 }
diff --git a/src/libtracker-data/tracker-turtle.c b/src/libtracker-data/tracker-turtle.c
index fa16a0e..f67ff79 100644
--- a/src/libtracker-data/tracker-turtle.c
+++ b/src/libtracker-data/tracker-turtle.c
@@ -35,27 +35,21 @@ static gboolean initialized = FALSE;
 
 struct TurtleFile {
 	FILE              *file;
-#ifdef HAVE_RAPTOR
 	raptor_uri        *uri;
 	raptor_serializer *serializer;
-#endif /* HAVE_RAPTOR */
 };
 
-#ifdef HAVE_RAPTOR
 typedef struct {
 	gchar             *last_subject;
 	raptor_serializer *serializer;
 	GHashTable        *hash;
 } TurtleOptimizerInfo;
-#endif /* HAVE_RAPTOR */
 
 void
 tracker_turtle_init (void)
 {
 	if (!initialized) {
-#ifdef HAVE_RAPTOR
 		raptor_init ();
-#endif /* HAVE_RAPTOR */
 		initialized = TRUE;
 	}
 }
@@ -64,14 +58,11 @@ void
 tracker_turtle_shutdown (void)
 {
 	if (initialized) {
-#ifdef HAVE_RAPTOR
 		raptor_finish ();
-#endif /* HAVE_RAPTOR */
 		initialized = FALSE;
 	}
 }
 
-#ifdef HAVE_RAPTOR
 
 static void
 foreach_in_hash (gpointer key,
@@ -200,12 +191,10 @@ foreach_in_metadata (TrackerProperty *field,
 
 	g_free (statement);
 }
-#endif /* HAVE_RAPTOR */
 
 TurtleFile *
 tracker_turtle_open (const gchar *turtle_file)
 {
-#ifdef HAVE_RAPTOR
 	TurtleFile *turtle;
 
 	g_return_val_if_fail (initialized, NULL);
@@ -224,11 +213,6 @@ tracker_turtle_open (const gchar *turtle_file)
 					       turtle->file);
 
 	return turtle;
-#else 
-	g_return_val_if_fail (initialized, NULL);
-
-	return NULL;
-#endif
 }
 
 void
@@ -237,20 +221,17 @@ tracker_turtle_add_triple (TurtleFile   *turtle,
 			   TrackerProperty *property,
 			   const gchar  *value)
 {
-#ifdef HAVE_RAPTOR
 	TrackerTurtleMetadataItem *item = g_slice_new (TrackerTurtleMetadataItem);
 	item->about_uri = (gchar *) uri;
 	item->turtle = turtle;
 	foreach_in_metadata (property, (gpointer) value, item);
 	g_slice_free (TrackerTurtleMetadataItem, item);
-#endif
 }
 
 
 void
 tracker_turtle_close (TurtleFile *turtle)
 {
-#ifdef HAVE_RAPTOR
 	raptor_free_uri (turtle->uri);
 	raptor_serialize_end (turtle->serializer);
 	raptor_free_serializer(turtle->serializer);
@@ -260,10 +241,8 @@ tracker_turtle_close (TurtleFile *turtle)
 	}
 
 	g_free (turtle);
-#endif
 }
 
-#ifdef HAVE_RAPTOR
 static void 
 raptor_error (void           *user_data, 
 	      raptor_locator *locator, 
@@ -273,7 +252,6 @@ raptor_error (void           *user_data,
 		   message, 
 		   (gchar *) user_data);
 }
-#endif
 
 void
 tracker_turtle_process (const gchar          *turtle_file,
@@ -281,17 +259,14 @@ tracker_turtle_process (const gchar          *turtle_file,
 			TurtleTripleCallback  callback,
 			void                 *user_data)
 {
-#ifdef HAVE_RAPTOR
 	unsigned char  *uri_string;
 	raptor_uri     *uri, *buri;
 	raptor_parser  *parser;
-#endif
+
 	if (!initialized) {
 		g_critical ("Using tracker_turtle module without initialization");
 	}
 
-#ifdef HAVE_RAPTOR
-
 	parser = raptor_new_parser ("turtle");
 
 	raptor_set_statement_handler (parser, user_data, (raptor_statement_handler) callback);
@@ -310,24 +285,20 @@ tracker_turtle_process (const gchar          *turtle_file,
 	raptor_free_uri (buri);
 
 	raptor_free_parser (parser);
-#endif 	
 }
 
 void
 tracker_turtle_optimize (const gchar *turtle_file)
 {
-#ifdef HAVE_RAPTOR
 	raptor_uri          *suri;
 	TurtleOptimizerInfo *info;
 	gchar               *tmp_file, *base_uri;
 	FILE                *target_file;
-#endif
 
 	if (!initialized) {
 		g_critical ("Using tracker_turtle module without initialization");
 	}
 
-#ifdef HAVE_RAPTOR
 	tmp_file = g_strdup_printf ("%s.tmp", turtle_file);
 
 	target_file = g_fopen (tmp_file, "a");
@@ -371,5 +342,4 @@ tracker_turtle_optimize (const gchar *turtle_file)
 	g_rename (tmp_file, turtle_file);
 
 	g_free (tmp_file);
-#endif /* HAVE_RAPTOR */
 }
diff --git a/src/libtracker-data/tracker-turtle.h b/src/libtracker-data/tracker-turtle.h
index e51430a..8ea31c1 100644
--- a/src/libtracker-data/tracker-turtle.h
+++ b/src/libtracker-data/tracker-turtle.h
@@ -27,28 +27,13 @@
 
 #include <libtracker-data/tracker-data-metadata.h>
 
-#ifdef HAVE_RAPTOR
 #include <raptor.h>
-#endif
 
 /*
  * TODO: Is it possible to do this in the .c file? Dont expose raptor here. 
 */
 
-#ifdef HAVE_RAPTOR
 typedef raptor_statement TrackerRaptorStatement;
-#else
-typedef struct {
-  gconstpointer subject;
-  gint subject_type;
-  gconstpointer predicate;
-  gint predicate_type;
-  gconstpointer object;
-  gint object_type;
-  gpointer object_literal_datatype;
-  const guchar *object_literal_language;
-} TrackerRaptorStatement;
-#endif
 
 G_BEGIN_DECLS
 
diff --git a/src/tracker-indexer/tracker-removable-device.c b/src/tracker-indexer/tracker-removable-device.c
index ad56d5c..d9dfa7f 100644
--- a/src/tracker-indexer/tracker-removable-device.c
+++ b/src/tracker-indexer/tracker-removable-device.c
@@ -36,8 +36,6 @@
 #include "config.h"
 
 
-#ifdef HAVE_RAPTOR
-
 #include <stdlib.h>
 #include <string.h>
 #include <sys/statvfs.h>
@@ -52,13 +50,10 @@
 #include <libtracker-data/tracker-data-query.h>
 #include <libtracker-data/tracker-data-update.h>
 
-#endif
-
 #include <libtracker-data/tracker-turtle.h>
 
 #include "tracker-removable-device.h"
 
-#ifdef HAVE_RAPTOR
 #include "tracker-module-metadata-private.h"
 
 typedef struct {
@@ -260,8 +255,6 @@ consume_triple_storer (void                   *user_data,
 	}
 }
 
-#endif /* HAVE_RAPTOR */
-
 void
 tracker_removable_device_optimize (TrackerIndexer *indexer,
 				   const gchar    *mount_point)
@@ -285,7 +278,6 @@ void
 tracker_removable_device_load (TrackerIndexer *indexer,
 			       const gchar    *mount_point)
 {
-#ifdef HAVE_RAPTOR
 	gchar *filename;
 
 	filename = g_build_filename (mount_point,
@@ -335,11 +327,8 @@ tracker_removable_device_load (TrackerIndexer *indexer,
 	}
 
 	g_free (filename);
-#endif /* HAVE_RAPTOR */
 }
 
-#ifdef HAVE_RAPTOR
-
 static void
 set_metadata (const gchar *key, 
 	      const gchar *value, 
@@ -398,7 +387,6 @@ foreach_in_metadata_set_metadata (TrackerProperty *field,
 	}
 
 }
-#endif /* HAVE_RAPTOR */
 
 void
 tracker_removable_device_add_metadata (TrackerIndexer        *indexer, 
@@ -407,7 +395,6 @@ tracker_removable_device_add_metadata (TrackerIndexer        *indexer,
 				       const gchar           *rdf_type,
 				       TrackerModuleMetadata *metadata)
 {
-#ifdef HAVE_RAPTOR
 	AddMetadataInfo *info;
 	gchar           *filename, *muri;
 	FILE            *target_file;
@@ -477,7 +464,6 @@ tracker_removable_device_add_metadata (TrackerIndexer        *indexer,
 	g_slice_free (AddMetadataInfo, info);
 
 	tracker_file_close (target_file, FALSE);
-#endif /* HAVE_RAPTOR */
 }
 
 /* TODO URI branch: path -> uri */
@@ -488,7 +474,6 @@ tracker_removable_device_add_removal (TrackerIndexer *indexer,
 				      const gchar    *path,
 				      const gchar    *rdf_type)
 {
-#ifdef HAVE_RAPTOR
 	gchar               *filename, *about_uri, *muri;
 	FILE                *target_file;
 	raptor_uri          *suri;
@@ -553,7 +538,6 @@ tracker_removable_device_add_removal (TrackerIndexer *indexer,
 	raptor_free_serializer (serializer);
 
 	tracker_file_close (target_file, FALSE);
-#endif /* HAVE_RAPTOR */
 }
 
 /* TODO URI branch: path -> uri */
@@ -565,7 +549,6 @@ tracker_removable_device_add_move (TrackerIndexer *indexer,
 				   const gchar    *to_path,
 				   const gchar    *rdf_type)
 {
-#ifdef HAVE_RAPTOR
 	gchar               *filename, *about_uri, *to_uri, *muri;
 	FILE                *target_file;
 	raptor_uri          *suri;
@@ -631,6 +614,5 @@ tracker_removable_device_add_move (TrackerIndexer *indexer,
 	raptor_free_uri (suri);
 
 	tracker_file_close (target_file, FALSE);
-#endif /* HAVE_RAPTOR */
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]