rpms/beagle/devel beagle-0.2.7-socket-path.patch, NONE, 1.1 beagle.spec, 1.59, 1.60

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Jul 14 16:05:23 UTC 2006


Author: mclasen

Update of /cvs/dist/rpms/beagle/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv23555

Modified Files:
	beagle.spec 
Added Files:
	beagle-0.2.7-socket-path.patch 
Log Message:
Fix beagle_util_daemon_is_running with NFS homedirs


beagle-0.2.7-socket-path.patch:
 beagle-client.c |   50 +++--------------------------------------
 beagle-util.c   |   67 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 beagle-util.h   |    2 +
 3 files changed, 65 insertions(+), 54 deletions(-)

--- NEW FILE beagle-0.2.7-socket-path.patch ---
--- beagle-0.2.7/libbeagle/beagle/beagle-client.c.socket-path	2006-07-14 12:00:57.000000000 -0400
+++ beagle-0.2.7/libbeagle/beagle/beagle-client.c	2006-07-14 12:01:29.000000000 -0400
@@ -86,54 +86,12 @@
 {
 	BeagleClient *client;
 	BeagleClientPrivate *priv;
-	const gchar *beagle_home;
-	gchar *socket_dir;
 	gchar *socket_path;
-	struct stat buf;
-	
-	if (!client_name) 
-		client_name = "socket";
-
-	beagle_home = g_getenv ("BEAGLE_HOME");
-	if (beagle_home == NULL)
-		beagle_home = g_get_home_dir ();
-
-	if (! beagle_util_is_path_on_block_device (beagle_home) ||
-	    getenv ("BEAGLE_SYNCHRONIZE_LOCALLY") != NULL) {
-		gchar *remote_storage_dir = g_build_filename (beagle_home, ".beagle", "remote_storage_dir", NULL);
-		gchar *tmp;
-
-		if (! g_file_test (remote_storage_dir, G_FILE_TEST_EXISTS)) {
-			g_free (remote_storage_dir);
-			return NULL;
-		}
-
-		if (! g_file_get_contents (remote_storage_dir, &socket_dir, NULL, NULL)) {
-			g_free (remote_storage_dir);
-			return NULL;
-		}
-
-		g_free (remote_storage_dir);
-
-		/* There's a newline at the end that we want to strip off */
-		tmp = strrchr (socket_dir, '\n');
-		if (tmp != NULL)
-			*tmp = '\0';
-
-		if (! g_file_test (socket_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
-			g_free (socket_dir);
-			return NULL;
-		}
-	} else {
-		socket_dir = g_build_filename (beagle_home, ".beagle", NULL);
-	}
-
-	socket_path = g_build_filename (socket_dir, client_name, NULL);
-	g_free (socket_dir);
-	if (stat (socket_path, &buf) == -1 || !S_ISSOCK (buf.st_mode)) {
-		g_free (socket_path);
+
+	socket_path = beagle_util_get_socket_path (client_name);
+
+	if (socket_path == NULL)
 		return NULL;
-	}
 
 	client = g_object_new (BEAGLE_TYPE_CLIENT, 0);
 	priv = BEAGLE_CLIENT_GET_PRIVATE (client);
--- beagle-0.2.7/libbeagle/beagle/beagle-util.h.socket-path	2006-07-14 12:01:06.000000000 -0400
+++ beagle-0.2.7/libbeagle/beagle/beagle-util.h	2006-07-14 12:01:29.000000000 -0400
@@ -40,6 +40,8 @@
 
 gboolean beagle_util_is_path_on_block_device (const char *path);
 
+gchar *beagle_util_get_socket_path (const char *client_name);
+
 gboolean beagle_util_daemon_is_running (void);
 
 #endif /* __BEAGLE_UTIL_H */
--- beagle-0.2.7/libbeagle/beagle/beagle-util.c.socket-path	2006-07-14 12:01:15.000000000 -0400
+++ beagle-0.2.7/libbeagle/beagle/beagle-util.c	2006-07-14 12:01:29.000000000 -0400
@@ -57,28 +57,79 @@
 	return (st.st_dev >> 8 != 0);
 }
 
-gboolean
-beagle_util_daemon_is_running (void)
+char *
+beagle_util_get_socket_path (const char *client_name)
 {
 	const gchar *beagle_home;
 	gchar *socket_dir;
 	gchar *socket_path;
-	int sockfd;
-	struct sockaddr_un sun;
+	struct stat buf;
+	
+	if (!client_name) 
+		client_name = "socket";
 
 	beagle_home = g_getenv ("BEAGLE_HOME");
 	if (beagle_home == NULL)
 		beagle_home = g_get_home_dir ();
-	
-	socket_dir = g_build_filename (beagle_home, ".beagle", NULL);
-	socket_path = g_build_filename (socket_dir, "socket", NULL);
+
+	if (! beagle_util_is_path_on_block_device (beagle_home) ||
+	    getenv ("BEAGLE_SYNCHRONIZE_LOCALLY") != NULL) {
+		gchar *remote_storage_dir = g_build_filename (beagle_home, ".beagle", "remote_storage_dir", NULL);
+		gchar *tmp;
+
+		if (! g_file_test (remote_storage_dir, G_FILE_TEST_EXISTS)) {
+			g_free (remote_storage_dir);
+			return NULL;
+		}
+
+		if (! g_file_get_contents (remote_storage_dir, &socket_dir, NULL, NULL)) {
+			g_free (remote_storage_dir);
+			return NULL;
+		}
+
+		g_free (remote_storage_dir);
+
+		/* There's a newline at the end that we want to strip off */
+		tmp = strrchr (socket_dir, '\n');
+		if (tmp != NULL)
+			*tmp = '\0';
+
+		if (! g_file_test (socket_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+			g_free (socket_dir);
+			return NULL;
+		}
+	} else {
+		socket_dir = g_build_filename (beagle_home, ".beagle", NULL);
+	}
+
+	socket_path = g_build_filename (socket_dir, client_name, NULL);
+	g_free (socket_dir);
+	if (stat (socket_path, &buf) == -1 || !S_ISSOCK (buf.st_mode)) {
+		g_free (socket_path);
+		return NULL;
+	}
+
+	return socket_path;
+
+}
+
+gboolean
+beagle_util_daemon_is_running (void)
+{
+	gchar *socket_path;
+	int sockfd;
+	struct sockaddr_un sun;
+
+	socket_path = beagle_util_get_socket_path (NULL);
+
+	if (socket_path == NULL)
+		return FALSE;
 
 	bzero (&sun, sizeof (sun));
 	sun.sun_family = AF_UNIX;
 	snprintf (sun.sun_path, sizeof (sun.sun_path), socket_path);
 
 	g_free (socket_path);
-	g_free (socket_dir);
 
 	sockfd = socket (AF_UNIX, SOCK_STREAM, 0);
 	if (sockfd < 0) {


Index: beagle.spec
===================================================================
RCS file: /cvs/dist/rpms/beagle/devel/beagle.spec,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- beagle.spec	12 Jul 2006 05:26:24 -0000	1.59
+++ beagle.spec	14 Jul 2006 16:05:20 -0000	1.60
@@ -1,6 +1,6 @@
 Name:           beagle
 Version:        0.2.7
-Release:        2.1
+Release:       	3 
 Summary:        The Beagle Search Infrastructure
 Group:          User Interface/Desktops
 License:        LGPL
@@ -33,6 +33,8 @@
 Patch3: beagle-0.2.1-spew.patch
 Patch4: beagle-0.2.7-beagle-index-username.patch
 Patch5: beagle-0.2.7-runuser.patch
+# fixed in upstream cvs
+Patch6:		beagle-0.2.7-socket-path.patch
 
 # Mono only available on these:
 ExclusiveArch: %ix86 x86_64 ppc ia64 armv4l sparc
@@ -72,6 +74,7 @@
 %patch3 -p1 -b .spew
 %patch4 -p1 -b .beagleidx
 %patch5 -p1 -b .runuser
+%patch6 -p1 -b .socket-path
 
 %build
 export MONO_SHARED_DIR=%{_builddir}/%{?buildsubdir}
@@ -213,7 +216,10 @@
 %{_libdir}/python*/site-packages/beagle.so
 
 %changelog
-* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - sh: line 0: fg: no job control
+* Fri Jul 14 2006 Matthias Clasen <mclasen at redhat.com> - 0.2.7-3
+- Make beagle_util_daemon_is_running work with NFS homedirs
+
+* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 0.2.7-2.1
 - rebuild
 
 * Thu Jun 22 2006 Alexander Larsson <alexl at redhat.com> - 0.2.7-2




More information about the fedora-cvs-commits mailing list