rpms/yelp/FC-6 yelp-2.16.0-dynamic-beagle.patch, NONE, 1.1 yelp.spec, 1.78, 1.79

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Oct 24 07:26:04 UTC 2006


Author: alexl

Update of /cvs/dist/rpms/yelp/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv26118

Modified Files:
	yelp.spec 
Added Files:
	yelp-2.16.0-dynamic-beagle.patch 
Log Message:
* Tue Oct 24 2006 Alexander Larsson <alexl at redhat.com> - 2.16.0-5.fc6
- Dynamically use beagle if availible




yelp-2.16.0-dynamic-beagle.patch:
 yelp-search-pager.c |  168 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 164 insertions(+), 4 deletions(-)

--- NEW FILE yelp-2.16.0-dynamic-beagle.patch ---
--- yelp-2.16.0/src/yelp-search-pager.c.beagle	2006-10-13 00:47:41.000000000 +0200
+++ yelp-2.16.0/src/yelp-search-pager.c	2006-10-13 00:47:14.000000000 +0200
@@ -42,9 +42,166 @@
 #include <libxslt/xsltInternals.h>
 #include <libxslt/xsltutils.h>
 
-#ifdef ENABLE_BEAGLE
-#include <beagle/beagle.h>
-#endif /* ENABLE_BEAGLE */
+#include <gmodule.h>
+typedef struct _BeagleHit BeagleHit;
+typedef struct _BeagleQuery BeagleQuery;
+typedef struct _BeagleClient BeagleClient;
+typedef struct _BeagleRequest BeagleRequest;
+typedef struct _BeagleFinishedResponse BeagleFinishedResponse;
+typedef struct _BeagleHitsAddedResponse BeagleHitsAddedResponse;
+typedef struct _BeagleQueryPartProperty BeagleQueryPartProperty;
+typedef struct _BeagleQueryPart BeagleQueryPart;
+typedef struct _BeagleHitsSubtractedResponse BeagleHitsSubtractedResponse;
+typedef struct _BeagleSnippetRequest BeagleSnippetRequest;
+typedef struct _BeagleSnippetResponse BeagleSnippetResponse;
+
+/* We dlopen() all the following from libbeagle at runtime */
+#define BEAGLE_HIT(x) ((BeagleHit *)(x))
+#define BEAGLE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), beagle_request_get_type(), BeagleRequest))
+#define BEAGLE_QUERY_PART(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), beagle_query_part_get_type(), BeagleQueryPart))
+
+typedef enum {
+        BEAGLE_QUERY_PART_LOGIC_REQUIRED   = 1,
+	BEAGLE_QUERY_PART_LOGIC_PROHIBITED = 2
+} BeagleQueryPartLogic;
+
+typedef enum {
+	BEAGLE_PROPERTY_TYPE_UNKNOWN = 0,
+	BEAGLE_PROPERTY_TYPE_TEXT    = 1,
+	BEAGLE_PROPERTY_TYPE_KEYWORD = 2,
+	BEAGLE_PROPERTY_TYPE_DATE    = 3,
+	BEAGLE_PROPERTY_TYPE_LAST    = 4
+} BeaglePropertyType;
+
+/* *static* wrapper function pointers */
+static gboolean (*beagle_client_send_request_async) (BeagleClient  *client,
+                                                    BeagleRequest  *request,
+                                                    GError        **err) = NULL;
+static G_CONST_RETURN char *(*beagle_hit_get_uri) (BeagleHit *hit) = NULL;
+static GSList *(*beagle_hits_added_response_get_hits) (BeagleHitsAddedResponse *response) = NULL;
+static BeagleQuery *(*beagle_query_new) (void) = NULL;
+static void (*beagle_query_add_text) (BeagleQuery     *query,
+				      const char      *str) = NULL;
+static void (*beagle_query_add_hit_type) (BeagleQuery *query,
+					  const char  *hit_type) = NULL;
+static BeagleQueryPartProperty *(*beagle_query_part_property_new) (void) = NULL;
+static void (*beagle_query_part_set_logic) (BeagleQueryPart      *part, 
+					    BeagleQueryPartLogic  logic) = NULL;
+static void (*beagle_query_part_property_set_key) (BeagleQueryPartProperty *part, 
+						   const char              *key) = NULL;
+static void (*beagle_query_part_property_set_value) (BeagleQueryPartProperty *part, 
+						     const char *             value) = NULL;
+static void (*beagle_query_part_property_set_property_type) (BeagleQueryPartProperty *part, 
+							     BeaglePropertyType       prop_type) = NULL;
+static void (*beagle_query_add_part) (BeagleQuery     *query, 
+				      BeagleQueryPart *part) = NULL;
+static GType (*beagle_request_get_type) (void) = NULL;
+static GType (*beagle_query_part_get_type) (void) = NULL;
+static gboolean (*beagle_util_daemon_is_running) (void) = NULL;
+static BeagleClient *(*beagle_client_new_real) (const char *client_name) = NULL;
+static void (*beagle_query_set_max_hits) (BeagleQuery *query, 
+					  int max_hits) = NULL;
+static void (*beagle_query_add_mime_type) (BeagleQuery *query,
+					   const char  *mime_type) = NULL;
+static GSList *(*beagle_hits_subtracted_response_get_uris) (BeagleHitsSubtractedResponse *response) = NULL;
+static const char * (*beagle_snippet_response_get_snippet) (BeagleSnippetResponse *response) = NULL;
+static BeagleHit * (*beagle_hit_ref) (BeagleHit *hit) = NULL;
+static void (*beagle_hit_unref) (BeagleHit *hit) = NULL;
+
+static gboolean  (*beagle_hit_get_one_property)   (BeagleHit   *hit,
+						   const char  *key,
+						   const char **value) = NULL;
+static double (*beagle_hit_get_score) (BeagleHit *hit) = NULL;
+static const char *(*beagle_hit_get_parent_uri) (BeagleHit *hit) = NULL;
+static BeagleSnippetRequest *(*beagle_snippet_request_new) (void) = NULL;
+static void (*beagle_snippet_request_set_hit) (BeagleSnippetRequest *request,
+					       BeagleHit *hit) = NULL;
+static void (*beagle_snippet_request_set_query) (BeagleSnippetRequest *request,
+						 BeagleQuery          *query) = NULL;
+static void (*beagle_query_add_source) (BeagleQuery *query,
+					const char  *source) = NULL;
+
+static struct BeagleDlMapping
+{
+  const char *fn_name;
+  gpointer *fn_ptr_ref;
+} beagle_dl_mapping[] =
+{
+#define MAP(a) { #a, (gpointer *)&a }
+  MAP (beagle_client_send_request_async),
+  MAP (beagle_hit_get_uri),
+  MAP (beagle_hits_added_response_get_hits),
+  MAP (beagle_query_new),
+  MAP (beagle_query_add_text),
+  MAP (beagle_query_add_hit_type),
+  MAP (beagle_query_part_property_new),
+  MAP (beagle_query_part_set_logic),
+  MAP (beagle_query_part_property_set_key),
+  MAP (beagle_query_part_property_set_value),
+  MAP (beagle_query_part_property_set_property_type),
+  MAP (beagle_query_add_part),
+  MAP (beagle_request_get_type),
+  MAP (beagle_query_part_get_type),
+  MAP (beagle_util_daemon_is_running),
+  MAP (beagle_query_set_max_hits),
+  MAP (beagle_query_add_mime_type),
+  MAP (beagle_hits_subtracted_response_get_uris),
+  MAP (beagle_snippet_response_get_snippet),
+  MAP (beagle_hit_ref),
+  MAP (beagle_hit_unref),
+  MAP (beagle_hit_get_one_property),
+  MAP (beagle_hit_get_score),
+  MAP (beagle_hit_get_parent_uri),
+  MAP (beagle_snippet_request_new),
+  MAP (beagle_snippet_request_set_hit),
+  MAP (beagle_snippet_request_set_query),
+  MAP (beagle_query_add_source),
+#undef MAP
+  { "beagle_client_new", (gpointer *)&beagle_client_new_real },
+};
+
+static void 
+open_libbeagle (void)
+{
+  static gboolean done = FALSE;
+
+  if (!done)
+    {
+      int i;
+      GModule *beagle;
+      
+      done = TRUE;
+ 
+      beagle = g_module_open ("libbeagle.so.0", G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+      if (!beagle)
+	return;
+      
+      for (i = 0; i < G_N_ELEMENTS (beagle_dl_mapping); i++)
+	{
+	  if (!g_module_symbol (beagle, beagle_dl_mapping[i].fn_name,
+				beagle_dl_mapping[i].fn_ptr_ref))
+	    {
+	      g_warning ("Missing symbol '%s' in libbeagle\n",
+			 beagle_dl_mapping[i].fn_name);
+	      g_module_close (beagle);
+
+	      for (i = 0; i < G_N_ELEMENTS (beagle_dl_mapping); i++)
+		beagle_dl_mapping[i].fn_ptr_ref = NULL;
+
+	      return;
+	    }
+	}
+    }
+}
+
+static BeagleClient *
+beagle_client_new (const char *client_name)
+{
+  if (beagle_client_new_real)
+    return beagle_client_new_real (client_name);
+
+  return NULL;
+}
 
 #include "yelp-error.h"
 #include "yelp-settings.h"
@@ -223,9 +380,12 @@
     YelpPagerClass *pager_class  = YELP_PAGER_CLASS (klass);
 
     parent_class = g_type_class_peek_parent (klass);
+    
+    open_libbeagle ();
 
 #ifdef ENABLE_BEAGLE
-    if (beagle_util_daemon_is_running()) {
+    if (beagle_util_daemon_is_running != NULL &&
+	beagle_util_daemon_is_running()) {
 	beagle_client = beagle_client_new (NULL);
 	debug_print (DB_DEBUG, "client: %p\n", beagle_client);
     } else {


Index: yelp.spec
===================================================================
RCS file: /cvs/dist/rpms/yelp/FC-6/yelp.spec,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- yelp.spec	12 Oct 2006 17:41:59 -0000	1.78
+++ yelp.spec	24 Oct 2006 07:25:57 -0000	1.79
@@ -1,8 +1,3 @@
-%{?!WITH_MONO:  %define WITH_MONO 1}
-%ifarch ppc64 s390 s390x
-%define WITH_MONO 0
-%endif
-
 %define pango_version 1.0.99
 %define gtk2_version 2.6.0
 %define gecko_version 1.8.0.7
@@ -19,12 +14,13 @@
 Summary: A system documentation reader from the Gnome project
 Name: yelp
 Version: 2.16.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 Source: %{name}-%{version}.tar.bz2
 # http://bugzilla.gnome.org/show_bug.cgi?id=319096
 Patch1: yelp-2.15.5-fedora-docs.patch
 Patch2: yelp-2.13.2-add-mime-handling.patch
 Patch3: yelp-2.15.91-use-pango.patch 
+Patch4: yelp-2.16.0-dynamic-beagle.patch
 License: GPL
 Group: Applications/System
 BuildRoot: %{_tmppath}/%{name}-root
@@ -65,11 +61,6 @@
 BuildRequires: dbus-devel
 BuildRequires: gettext-devel
 
-
-%if %{WITH_MONO}
-BuildRequires:  libbeagle-devel
-%endif
-
 %description
 Yelp is the Gnome 2 help/documentation browser. It is designed
 to help you browse all the documentation on your system in
@@ -80,9 +71,10 @@
 %patch1 -p1 -b .fedora-docs
 %patch2 -p1 -b .add-mime-handling
 %patch3 -p1 -b .use-pango
+%patch4 -p1 -b .dynamic-beagle
 
 %build
-%configure 			\
+CFLAGS="$RPM_OPT_FLAGS -DENABLE_SEARCH -DENABLE_BEAGLE" %configure	\
 	--enable-search		\
 	--with-mozilla=firefox 	\
 	--enable-man 		\
@@ -132,6 +124,9 @@
 %{_datadir}/yelp
 
 %changelog
+* Tue Oct 24 2006 Alexander Larsson <alexl at redhat.com> - 2.16.0-5.fc6
+- Dynamically use beagle if availible
+
 * Thu Oct 12 2006 Christopher Aillon <caillon at redhat.com> - 2.16.0-4.fc6
 - Update requires to the virtual gecko version instead of a specific app
 




More information about the fedora-cvs-commits mailing list