[packagekit] [PATCH] Make gnome-packagekit build on Gio < 2.17.1
Debarshi Ray
debarshi.ray at gmail.com
Sat Nov 1 09:53:49 PDT 2008
I discovered that the latest Git snashots do not build on Gio < 2.17.1
(eg., in Fedora 9) due to the use of
g_file_make_directory_with_parents. I used the following ugly
workaround against the Git tree to make it work:
diff --git a/configure.ac b/configure.ac
index 9f9807f..6c412b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,14 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED
gobject-2.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
+PKG_CHECK_MODULES(GIO, gio-2.0)
+AC_SUBST(GIO_CFLAGS)
+AC_SUBST(GIO_LIBS)
+
+CPPFLAGS=$GIO_CFLAGS
+LIBS=$GIO_LIBS
+AC_CHECK_FUNCS(g_file_make_directory_with_parents)
+
PKG_CHECK_MODULES(DBUS, \
dbus-glib-1 >= $DBUS_GLIB_REQUIRED \
dbus-1 >= $DBUS_REQUIRED \
diff --git a/src/gpk-client.c b/src/gpk-client.c
index b4f417f..331676e 100644
--- a/src/gpk-client.c
+++ b/src/gpk-client.c
@@ -33,6 +33,7 @@
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
@@ -811,6 +812,7 @@ gpk_client_install_local_files_get_user_temp
(GpkClient *gclient, const gchar *s
goto out;
/* create as does not exist */
+#ifdef HAVE_G_GILE_MAKE_DIRECTORY_WITH_PARENTS
ret = g_file_make_directory_with_parents (file, NULL, error);
g_object_unref (file);
if (!ret) {
@@ -818,6 +820,15 @@ gpk_client_install_local_files_get_user_temp
(GpkClient *gclient, const gchar *s
g_free (path);
path = NULL;
}
+#else
+ g_mkdir_with_parents(path, 0755);
+ g_object_unref (file);
+ if (ret == -1) {
+ /* return nothing.. */
+ g_free (path);
+ path = NULL;
+ }
+#endif
out:
return path;
}
What do you think?
Happy hacking,
Debarshi
More information about the PackageKit
mailing list