Re: gnome-mount dependency loop, how to handle this?
- From: David Zeuthen <david fubar dk>
- To: jan jgc homeip net
- Cc: gnome-vfs-list gnome org, desktop-devel-list gnome org
- Subject: Re: gnome-mount dependency loop, how to handle this?
- Date: Sat, 04 Mar 2006 13:48:34 -0500
(adding gnome-vfs-list to the Cc)
On Fri, 2006-03-03 at 22:45 +0100, jan jgc homeip net wrote:
> As Archlinux distribution packagers, we would like to ship gnome-vfs with
> a gnome-mount dependency. This will not work somehow because of a
> recursive dependency loop:
>
> gnome-mount -> libgnomeui -> Libgnome -> gnome-vfs -> gnome-mount
True, my bad. I added build-time detection of gnome-mount to gnome-vfs
because it's kind of a mess to detect the mount helper at runtime. But I
guess there is no way around this.. it also makes it hard for
gnome-mount to e.g. provide the nautilus extension I'm working on
because of the same reasons..
> This will force us to build gnome-vfs two times: one time without
> gnome-mount and after the whole chain has been compiled, another time with
> gnome-mount support.
>
> This solution is not a nice solution and breaks autobuilders. Are other
> possibilities available to get gnome-mount integrated in gnome-vfs?
Yep, attached patch makes gnome-vfs detect gnome-mount at runtime and
rips out support for --enable-gnome-mount. This will also make it easier
for distributions offering choice of what mount programs to use - user
won't have to rebuild gnome-vfs if they want to use gnome-mount.
Patch is tested on two systems and it works great for me. I've also
tested this with --disable-hal. There are no string changes. OK to
commit?
David
$ diffstat gnome-vfs-detect-gnome-mount-at-runtime.patch
ChangeLog | 9 ++
configure.in | 33 +-------
libgnomevfs/gnome-vfs-volume-ops.c | 147 +++++++++++++++++++------------------
3 files changed, 92 insertions(+), 97 deletions(-)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.2386
diff -u -p -r1.2386 ChangeLog
--- ChangeLog 3 Mar 2006 16:09:30 -0000 1.2386
+++ ChangeLog 4 Mar 2006 18:32:04 -0000
@@ -1,3 +1,12 @@
+2006-03-04 David Zeuthen <davidz redhat com>
+
+ * configure.in: Remove build-time support for detecting
+ gnome-mount. Add useful note to --with-hal-mount and friends that
+ these parameters are not used if gnome-mount is detected
+
+ * libgnomevfs/gnome-vfs-volume-ops.c: Detect gnome-mount and
+ friends at run time instead of at build time
+
2006-03-03 Mikael Hallendal <micke imendio com>
* libgnomevfs/gnome-vfs-xfer.c:
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-vfs/configure.in,v
retrieving revision 1.413
diff -u -p -r1.413 configure.in
--- configure.in 2 Mar 2006 17:39:22 -0000 1.413
+++ configure.in 4 Mar 2006 18:32:05 -0000
@@ -735,44 +735,24 @@ else
fi
if test "$USE_HAL" != ""; then
- AC_ARG_WITH(hal-mount, [ --with-hal-mount=PROGRAM Program for mounting filesystems known to HAL],
+ AC_ARG_WITH(hal-mount, [ --with-hal-mount=PROGRAM Program for mounting filesystems known to HAL (not used if gnome-mount is installed)],
with_hal_mount="$withval", with_hal_mount="none")
if test "x$with_hal_mount" != "xnone"; then
- AC_DEFINE_UNQUOTED(HAL_MOUNT, "$with_hal_mount", [Path to program for mounting filesystems known to HAL])
+ AC_DEFINE_UNQUOTED(HAL_MOUNT, "$with_hal_mount", [Path to program for mounting filesystems known to HAL (not used if gnome-mount is installed)])
fi
- AC_ARG_WITH(hal-umount, [ --with-hal-umount=PROGRAM Program for unmounting filesystems known to HAL],
+ AC_ARG_WITH(hal-umount, [ --with-hal-umount=PROGRAM Program for unmounting filesystems known to HAL (not used if gnome-mount is installed)],
with_hal_umount="$withval", with_hal_umount="none")
if test "x$with_hal_umount" != "xnone"; then
- AC_DEFINE_UNQUOTED(HAL_UMOUNT, "$with_hal_umount", [Path to program for unmounting filesystems known to HAL])
+ AC_DEFINE_UNQUOTED(HAL_UMOUNT, "$with_hal_umount", [Path to program for unmounting filesystems known to HAL (not used if gnome-mount is installed)])
fi
- AC_ARG_WITH(hal-eject, [ --with-hal-eject=PROGRAM Program for ejecting filesystems known to HAL],
+ AC_ARG_WITH(hal-eject, [ --with-hal-eject=PROGRAM Program for ejecting filesystems known to HAL (not used if gnome-mount is installed)],
with_hal_eject="$withval", with_hal_eject="none")
if test "x$with_hal_eject" != "xnone"; then
- AC_DEFINE_UNQUOTED(HAL_EJECT, "$with_hal_eject", [Path to program for ejecting filesystems known to HAL])
+ AC_DEFINE_UNQUOTED(HAL_EJECT, "$with_hal_eject", [Path to program for ejecting filesystems known to HAL (not used if gnome-mount is installed)])
fi
fi
-msg_gnome_mount=no
-AC_ARG_ENABLE(gnome-mount,
-AC_HELP_STRING([--enable-gnome-mount],[use gnome-mount, if available]),
-[case $enableval in
-yes) ENABLE_GNOME_MOUNT=yes ;;
-no) ENABLE_GNOME_MOUNT=no ;;
-*) AC_MSG_ERROR(bad value $enableval for --enable-gnome-mount) ;;
-esac],
-[ENABLE_GNOME_MOUNT=yes]) dnl Default value
-
-if test "$ENABLE_GNOME_MOUNT" = "yes"; then
- PKG_CHECK_MODULES(GNOME_MOUNT, gnome-mount >= 0.4,
- [ AC_DEFINE(USE_GNOME_MOUNT, 1, [defined if using gnome-mount])
- msg_gnome_mount="yes, overrides --with-hal-mount et. al."],
- [ USE_GNOME_MOUNT=""])
-else
- USE_GNOME_MOUNT=""
-fi
-
-
dnl ==============================================================================
dnl Check for a supported resolver functions
dnl ==============================================================================
@@ -1237,7 +1217,6 @@ echo "
Avahi support: $msg_avahi
Howl support: $msg_howl
HAL support: $msg_hal
- gnome-mount support: $msg_gnome_mount
Gtk Doc: $enable_gtk_doc
FS monitor backends: $fs_monitor_backends
Samba method: $msg_samba
Index: libgnomevfs/gnome-vfs-volume-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c,v
retrieving revision 1.29
diff -u -p -r1.29 gnome-vfs-volume-ops.c
--- libgnomevfs/gnome-vfs-volume-ops.c 23 Feb 2006 00:40:07 -0000 1.29
+++ libgnomevfs/gnome-vfs-volume-ops.c 4 Mar 2006 18:32:06 -0000
@@ -88,8 +88,6 @@ static const char *mount_known_locations
NULL
};
-#if !defined(USE_GNOME_MOUNT)
-
static const char *pmount_known_locations [] = {
"/usr/sbin/pmount", "/usr/bin/pmount",
"/sbin/mount", "/bin/mount",
@@ -104,8 +102,6 @@ static const char *pumount_known_locatio
NULL
};
-#endif /* ! USE_GNOME_MOUNT */
-
static const char *umount_known_locations [] = {
"/sbin/umount", "/bin/umount",
"/usr/sbin/umount", "/usr/bin/umount",
@@ -170,7 +166,6 @@ typedef struct _MountThreadAuth {
} MountThreadAuth;
-#if !defined(USE_GNOME_MOUNT)
/* gnome-mount programs display their own dialogs so no use for these functions */
static char *
generate_mount_error_message (char *standard_error,
@@ -228,7 +223,6 @@ generate_unmount_error_message (char *st
return message;
}
-#endif /* !defined(USE_GNOME_MOUNT) */
static void
force_probe (void)
@@ -623,15 +617,17 @@ mount_unmount_thread (void *arg)
if (info->should_mount || info->should_unmount) {
error = NULL;
if (spawn_mount (info,
-#if defined(USE_GNOME_MOUNT)
+#if defined(USE_HAL)
/* do pass our environment when using gnome-mount progams */
((strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-mount") == 0) ||
(strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-umount") == 0) ||
- (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0)) ? NULL : envp,
-#elif defined(USE_HAL) && defined(HAL_MOUNT) && defined(HAL_UMOUNT)
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0) ||
+# if defined(HAL_MOUNT) && defined(HAL_UMOUNT)
/* do pass our environment when using hal mount progams */
- ((strcmp (info->argv[0], HAL_MOUNT) == 0) ||
- (strcmp (info->argv[0], HAL_UMOUNT) == 0)) ? NULL : envp,
+ (strcmp (info->argv[0], HAL_MOUNT) == 0) ||
+ (strcmp (info->argv[0], HAL_UMOUNT) == 0) ||
+# endif
+ FALSE) ? NULL : envp,
#else
envp,
#endif
@@ -640,34 +636,40 @@ mount_unmount_thread (void *arg)
&error)) {
if (exit_status != 0) {
info->succeeded = FALSE;
-#if defined(USE_GNOME_MOUNT)
- /* gnome-mount programs display their own dialogs */
- info->error_message = g_strdup ("");
- info->detailed_error_message = g_strdup ("");
-#else
- if (strlen (standard_error) > 0) {
- if (info->should_mount) {
- info->error_message = generate_mount_error_message (standard_error,
- info->device_type);
- } else {
- info->error_message = generate_unmount_error_message (standard_error,
- info->device_type);
- }
- info->detailed_error_message = g_strdup (standard_error);
- } else {
- /* As of 2.12 we introduce a new contract between gnome-vfs clients
- * invoking mount/unmount and the gnome-vfs-daemon:
- *
- * "don't display an error dialog if error_message and
- * detailed_error_message are both empty strings".
- *
- * We want this as we may use mount/unmount/ejects programs that
- * shows it's own dialogs.
- */
+
+ if ((strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-mount") == 0) ||
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-umount") == 0) ||
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0)) {
+ /* gnome-mount programs display their own dialogs */
info->error_message = g_strdup ("");
info->detailed_error_message = g_strdup ("");
+ } else {
+ if (strlen (standard_error) > 0) {
+ if (info->should_mount) {
+ info->error_message = generate_mount_error_message (
+ standard_error,
+ info->device_type);
+ } else {
+ info->error_message = generate_unmount_error_message (
+ standard_error,
+ info->device_type);
+ }
+ info->detailed_error_message = g_strdup (standard_error);
+ } else {
+ /* As of 2.12 we introduce a new contract between gnome-vfs clients
+ * invoking mount/unmount and the gnome-vfs-daemon:
+ *
+ * "don't display an error dialog if error_message and
+ * detailed_error_message are both empty strings".
+ *
+ * We want this as we may use mount/unmount/ejects programs that
+ * shows it's own dialogs.
+ */
+ info->error_message = g_strdup ("");
+ info->detailed_error_message = g_strdup ("");
+ }
}
-#endif
+
}
g_free (standard_error);
@@ -685,7 +687,7 @@ mount_unmount_thread (void *arg)
argv[0] = NULL;
-#if defined(USE_GNOME_MOUNT)
+#if defined(USE_HAL)
if (info->hal_udi != NULL) {
argv[0] = GNOME_VFS_BINDIR "/gnome-eject";
argv[1] = "--hal-udi";
@@ -695,8 +697,8 @@ mount_unmount_thread (void *arg)
if (!g_file_test (argv [0], G_FILE_TEST_IS_EXECUTABLE))
argv[0] = NULL;
}
-#elif defined(USE_HAL) && defined(HAL_EJECT)
- if (info->hal_udi != NULL) {
+# if defined(HAL_EJECT)
+ if (argv[0] == NULL && info->hal_udi != NULL) {
argv[0] = HAL_EJECT;
argv[1] = info->device_path;
argv[2] = NULL;
@@ -704,6 +706,7 @@ mount_unmount_thread (void *arg)
if (!g_file_test (argv [0], G_FILE_TEST_IS_EXECUTABLE))
argv[0] = NULL;
}
+# endif
#endif
if (argv[0] == NULL) {
@@ -739,14 +742,16 @@ mount_unmount_thread (void *arg)
if (exit_status != 0) {
info->succeeded = FALSE;
-#if defined(USE_GNOME_MOUNT)
- /* gnome-mount programs display their own dialogs */
- info->error_message = g_strdup ("");
- info->detailed_error_message = g_strdup ("");
-#else
- info->error_message = g_strdup (_("Unable to eject media"));
- info->detailed_error_message = g_strdup (standard_error);
-#endif
+ if ((strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-mount") == 0) ||
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-umount") == 0) ||
+ (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0)) {
+ /* gnome-mount programs display their own dialogs */
+ info->error_message = g_strdup ("");
+ info->detailed_error_message = g_strdup ("");
+ } else {
+ info->error_message = g_strdup (_("Unable to eject media"));
+ info->detailed_error_message = g_strdup (standard_error);
+ }
} else {
/* If the eject succeed then ignore the previous unmount error (if any) */
info->succeeded = TRUE;
@@ -816,45 +821,51 @@ mount_unmount_operation (const char *mou
is_in_media = mount_point != NULL ? g_str_has_prefix (mount_point, "/media") : FALSE;
- if (should_mount) {
-#if defined(USE_GNOME_MOUNT)
+ command = NULL;
+
+ if (should_mount) {
+#if defined(USE_HAL)
if (hal_udi != NULL && g_file_test (GNOME_VFS_BINDIR "/gnome-mount", G_FILE_TEST_IS_EXECUTABLE)) {
command = GNOME_VFS_BINDIR "/gnome-mount";
argument = "--hal-udi";
name = hal_udi;
} else {
- command = find_command (MOUNT_COMMAND);
+# if defined(HAL_MOUNT)
+ if (hal_udi != NULL && g_file_test (HAL_MOUNT, G_FILE_TEST_IS_EXECUTABLE))
+ command = HAL_MOUNT;
+ else
+ command = find_command (MOUNT_COMMAND);
+# else
+ ;
+# endif
}
-#elif defined(USE_HAL) && defined(HAL_MOUNT)
- if (hal_udi != NULL && g_file_test (HAL_MOUNT, G_FILE_TEST_IS_EXECUTABLE))
- command = HAL_MOUNT;
- else
- command = find_command (MOUNT_COMMAND);
-#else
- command = find_command (is_in_media ? PMOUNT_COMMAND : MOUNT_COMMAND);
#endif
+ if (command == NULL)
+ command = find_command (is_in_media ? PMOUNT_COMMAND : MOUNT_COMMAND);
#ifdef MOUNT_ARGUMENT
argument = MOUNT_ARGUMENT;
#endif
}
if (should_unmount) {
-#if defined(USE_GNOME_MOUNT)
+#if defined(USE_HAL)
if (hal_udi != NULL && g_file_test (GNOME_VFS_BINDIR "/gnome-umount", G_FILE_TEST_IS_EXECUTABLE)) {
command = GNOME_VFS_BINDIR "/gnome-umount";
argument = "--hal-udi";
name = hal_udi;
} else {
- command = find_command (UMOUNT_COMMAND);
+# if defined(HAL_UMOUNT)
+ if (hal_udi != NULL && g_file_test (HAL_UMOUNT, G_FILE_TEST_IS_EXECUTABLE))
+ command = HAL_UMOUNT;
+ else
+ command = find_command (UMOUNT_COMMAND);
+# else
+ ;
+#endif
}
-#elif defined(USE_HAL) && defined(HAL_UMOUNT)
- if (hal_udi != NULL && g_file_test (HAL_UMOUNT, G_FILE_TEST_IS_EXECUTABLE))
- command = HAL_UMOUNT;
- else
- command = find_command (UMOUNT_COMMAND);
-#else
- command = find_command (is_in_media ? PUMOUNT_COMMAND : UMOUNT_COMMAND);
#endif
+ if (command == NULL)
+ command = find_command (is_in_media ? PUMOUNT_COMMAND : UMOUNT_COMMAND);
#ifdef UNMOUNT_ARGUMENT
argument = UNMOUNT_ARGUMENT;
#endif
@@ -1035,7 +1046,6 @@ gnome_vfs_volume_unmount (GnomeVFSVolume
device_path = gnome_vfs_volume_get_device_path (volume);
hal_udi = gnome_vfs_volume_get_hal_udi (volume);
-#if defined(USE_GNOME_MOUNT)
/* Volumes from drives that are not polled may not
* have a hal_udi.. take the one from HAL to get
* gnome-mount working */
@@ -1047,7 +1057,6 @@ gnome_vfs_volume_unmount (GnomeVFSVolume
gnome_vfs_drive_unref (drive);
}
}
-#endif /* USE_GNOME_MOUNT */
mount_unmount_operation (mount_path,
device_path,
@@ -1095,7 +1104,6 @@ gnome_vfs_volume_eject (GnomeVFSVolume *
device_path = gnome_vfs_volume_get_device_path (volume);
hal_udi = gnome_vfs_volume_get_hal_udi (volume);
-#if defined(USE_GNOME_MOUNT)
/* Volumes from drives that are not polled may not
* have a hal_udi.. take the one from HAL to get
* gnome-mount working */
@@ -1107,7 +1115,6 @@ gnome_vfs_volume_eject (GnomeVFSVolume *
gnome_vfs_drive_unref (drive);
}
}
-#endif /* USE_GNOME_MOUNT */
mount_unmount_operation (mount_path,
device_path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]