From 5dcb7aff447a4412989d22799c2fb9d9eb3f0227 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Apr 14 2009 16:19:06 +0000 Subject: - Backport 4 important patches from upstream. --- diff --git a/PackageKit-0.4.6-check-package-ids-length.patch b/PackageKit-0.4.6-check-package-ids-length.patch new file mode 100644 index 0000000..7b84df2 --- /dev/null +++ b/PackageKit-0.4.6-check-package-ids-length.patch @@ -0,0 +1,52 @@ +commit 79ace3ef67c14b435b2c0d8330aaa7a8774b482c +Author: Richard Hughes +Date: Mon Apr 6 17:12:33 2009 +0100 + + bugfix: pk_package_ids_check is not valid when the packageids array is zero length + +diff --git a/lib/packagekit-glib/pk-package-ids.c b/lib/packagekit-glib/pk-package-ids.c +index e4a39be..623fff5 100644 +--- a/lib/packagekit-glib/pk-package-ids.c ++++ b/lib/packagekit-glib/pk-package-ids.c +@@ -114,7 +114,7 @@ pk_package_ids_check (gchar **package_ids) + { + guint i; + guint size; +- gboolean ret; ++ gboolean ret = FALSE; + const gchar *package_id; + + g_return_val_if_fail (package_ids != NULL, FALSE); +@@ -125,9 +125,10 @@ pk_package_ids_check (gchar **package_ids) + package_id = package_ids[i]; + ret = pk_package_id_check (package_id); + if (!ret) +- return FALSE; ++ goto out; + } +- return TRUE; ++out: ++ return ret; + } + + /** +@@ -214,6 +215,7 @@ void + pk_package_ids_test (EggTest *test) + { + gboolean ret; ++ gchar *package_ids_blank[] = {}; + gchar **package_ids; + guint size; + +@@ -234,6 +236,11 @@ pk_package_ids_test (EggTest *test) + egg_test_assert (test, size == 2); + + /************************************************************/ ++ egg_test_title (test, "verify blank"); ++ ret = pk_package_ids_check (package_ids_blank); ++ egg_test_assert (test, !ret); ++ ++ /************************************************************/ + egg_test_title (test, "verify"); + ret = pk_package_ids_check (package_ids); + egg_test_assert (test, ret); diff --git a/PackageKit-0.4.6-command-not-found-length.patch b/PackageKit-0.4.6-command-not-found-length.patch new file mode 100644 index 0000000..2509d97 --- /dev/null +++ b/PackageKit-0.4.6-command-not-found-length.patch @@ -0,0 +1,25 @@ +commit b55842c2243c41850b839f900fe333ff3dbef2ab +Author: Richard Hughes +Date: Tue Apr 14 13:32:10 2009 +0100 + + bugfix: still use command not found for commands one character long + +diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c +index 2df80e9..f6aba8e 100644 +--- a/contrib/command-not-found/pk-command-not-found.c ++++ b/contrib/command-not-found/pk-command-not-found.c +@@ -545,11 +545,12 @@ main (int argc, char *argv[]) + /* get policy config */ + pk_cnf_get_config (&config); + +- /* generate swizzles */ ++ /* get length */ + len = egg_strlen (argv[1], 1024); +- if (len < 2) ++ if (len < 1) + goto out; + ++ /* generate swizzles */ + array = pk_cnf_find_alternatives (argv[1], len); + + /* TRANSLATORS: the prefix of all the output telling the user why it's not executing */ diff --git a/PackageKit-0.4.6-correct-sync-logic.patch b/PackageKit-0.4.6-correct-sync-logic.patch new file mode 100644 index 0000000..2f2ae91 --- /dev/null +++ b/PackageKit-0.4.6-correct-sync-logic.patch @@ -0,0 +1,74 @@ +commit 28151ea72bcdd826a2d3a3f9109a073e90962169 +Author: Richard Hughes +Date: Thu Apr 9 11:23:18 2009 +0100 + + bugfix: correct the logic for pk_client_set_synchronous so we can set this false without returning in the duplicate check + +diff --git a/lib/packagekit-glib/pk-client.c b/lib/packagekit-glib/pk-client.c +index c293677..f4294e0 100644 +--- a/lib/packagekit-glib/pk-client.c ++++ b/lib/packagekit-glib/pk-client.c +@@ -383,9 +383,10 @@ pk_client_set_synchronous (PkClient *client, gboolean synchronous, GError **erro + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + /* are we doing this without any need? */ +- if (client->priv->synchronous) { ++ if ((client->priv->synchronous && synchronous) || ++ (!client->priv->synchronous && !synchronous)) { + if (error != NULL) +- *error = g_error_new (PK_CLIENT_ERROR, PK_CLIENT_ERROR_FAILED, "already set synchronous!"); ++ *error = g_error_new (PK_CLIENT_ERROR, PK_CLIENT_ERROR_FAILED, "already synchronous : %i!", synchronous); + return FALSE; + } + +@@ -4732,13 +4733,33 @@ pk_client_test (EggTest *test) + g_free (file); + + /************************************************************/ +- egg_test_title (test, "get client, then unref"); ++ egg_test_title (test, "get client"); + client = pk_client_new (); ++ egg_test_assert (test, client != NULL); ++ ++ /************************************************************/ ++ egg_test_title (test, "set non synchronous (fail)"); ++ ret = pk_client_set_synchronous (client, FALSE, NULL); ++ egg_test_assert (test, !ret); ++ ++ /************************************************************/ ++ egg_test_title (test, "set synchronous (pass)"); ++ ret = pk_client_set_synchronous (client, TRUE, NULL); ++ egg_test_assert (test, ret); ++ ++ /************************************************************/ ++ egg_test_title (test, "set synchronous again (fail)"); ++ ret = pk_client_set_synchronous (client, TRUE, NULL); ++ egg_test_assert (test, !ret); ++ ++ /************************************************************/ ++ egg_test_title (test, "set non synchronous (pass)"); ++ ret = pk_client_set_synchronous (client, FALSE, NULL); ++ egg_test_assert (test, ret); + g_object_unref (client); +- egg_test_success (test, NULL); + + /************************************************************/ +- egg_test_title (test, "get client"); ++ egg_test_title (test, "get new client"); + client = pk_client_new (); + egg_test_assert (test, client != NULL); + +@@ -4751,8 +4772,12 @@ pk_client_test (EggTest *test) + g_signal_connect (client, "finished", + G_CALLBACK (pk_client_test_finished_cb), test); + ++ /************************************************************/ ++ egg_test_title (test, "set synchronous after reset (pass)"); ++ ret = pk_client_set_synchronous (client, TRUE, NULL); ++ egg_test_assert (test, ret); ++ + /* run the method */ +- pk_client_set_synchronous (client, TRUE, NULL); + ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, "power", NULL); + + /************************************************************/ diff --git a/PackageKit-0.4.6-dont-use-obsolete-interfaces.patch b/PackageKit-0.4.6-dont-use-obsolete-interfaces.patch new file mode 100644 index 0000000..d2ed59d --- /dev/null +++ b/PackageKit-0.4.6-dont-use-obsolete-interfaces.patch @@ -0,0 +1,161 @@ +diff --git a/contrib/gstreamer-plugin/pk-gstreamer-install.c b/contrib/gstreamer-plugin/pk-gstreamer-install.c +index ba2f660..9c7a83f 100644 +--- a/contrib/gstreamer-plugin/pk-gstreamer-install.c ++++ b/contrib/gstreamer-plugin/pk-gstreamer-install.c +@@ -274,18 +274,16 @@ main (int argc, char **argv) + { + DBusGConnection *connection; + DBusGProxy *proxy = NULL; +- GPtrArray *array = NULL; +- GValueArray *varray; +- GValue *value; + gboolean ret; +- GType array_type; + GOptionContext *context; + GError *error = NULL; + guint i; ++ guint len; + gchar **codecs = NULL; + gint xid = 0; + gint retval = GST_INSTALL_PLUGINS_ERROR; + const gchar *suffix; ++ gchar **resources = NULL; + + const GOptionEntry options[] = { + { "transient-for", '\0', 0, G_OPTION_ARG_INT, &xid, "The XID of the parent window", NULL }, +@@ -326,7 +324,7 @@ main (int argc, char **argv) + proxy = dbus_g_proxy_new_for_name (connection, + "org.freedesktop.PackageKit", + "/org/freedesktop/PackageKit", +- "org.freedesktop.PackageKit"); ++ "org.freedesktop.PackageKit.Modify"); + if (proxy == NULL) { + g_print ("Cannot connect to PackageKit session service\n"); + goto out; +@@ -335,9 +333,11 @@ main (int argc, char **argv) + /* use a ()(64bit) suffix for 64 bit */ + suffix = pk_gst_get_arch_suffix (); + ++ len = g_strv_length (codecs); ++ resources = g_new0 (gchar*, len+1); ++ + /* process argv */ +- array = g_ptr_array_new (); +- for (i = 0; codecs[i] != NULL; i++) { ++ for (i=0; icodec_name); +- g_value_array_append (varray, value); +- g_value_reset (value); +- g_value_set_string (value, type); +- g_value_array_append (varray, value); +- g_value_unset (value); +- g_free (value); +- +- /* add to array of (ss) */ +- g_ptr_array_add (array, varray); ++ /* "encode" */ ++ resources[i] = g_strdup_printf ("%s|%s", info->codec_name, type); + + /* free codec structure */ + pk_gst_codec_free (info); + } + +- /* marshall a(ss) */ +- array_type = dbus_g_type_get_collection ("GPtrArray", +- dbus_g_type_get_struct("GValueArray", +- G_TYPE_STRING, +- G_TYPE_STRING, +- G_TYPE_INVALID)); +- + /* don't timeout, as dbus-glib sets the timeout ~25 seconds */ + dbus_g_proxy_set_default_timeout (proxy, INT_MAX); + + /* invoke the method */ +- ret = dbus_g_proxy_call (proxy, "InstallGStreamerCodecs", &error, ++ ret = dbus_g_proxy_call (proxy, "InstallGStreamerResources", &error, + G_TYPE_UINT, xid, +- G_TYPE_UINT, 0, +- array_type, array, ++ G_TYPE_STRV, resources, ++ G_TYPE_STRING, "hide-finished", + G_TYPE_INVALID, + G_TYPE_INVALID); + if (!ret) { +@@ -411,10 +392,7 @@ main (int argc, char **argv) + retval = GST_INSTALL_PLUGINS_SUCCESS; + + out: +- if (array != NULL) { +- g_ptr_array_foreach (array, (GFunc) g_value_array_free, NULL); +- g_ptr_array_free (array, TRUE); +- } ++ g_strfreev (resources); + if (proxy != NULL) + g_object_unref (proxy); + return retval; +diff --git a/contrib/gtk-module/README b/contrib/gtk-module/README +index 4cfb5fc..2e9200b 100644 +--- a/contrib/gtk-module/README ++++ b/contrib/gtk-module/README +@@ -8,7 +8,7 @@ GTK_MODULES="$GTK_MODULES:/usr/lib/gtk-2.0/modules/pk-gtk-module.so" application + The module installs a custom default pangocairo font map during gtk_init(). + Pango will then call back with any languages which need installing, and these + are queued up. In an idle callback these are emitted as an asyncronous D-BUS +-method to the session PackageKit InstallFonts() method. ++method to the session PackageKit InstallFontconfigResources() method. + + If configured to do so, this will prompt the user to install new fonts. + +@@ -16,5 +16,5 @@ Notes: + + * At the moment the window XID is not detected correctly, which means focus + stealing prevention may not work properly. We're working on this. +- * gnome-packagekit 0.4.x is needed for the InstallFonts method. ++ * gnome-packagekit 2.17.2 is needed for the InstallFontconfigResources method. + +diff --git a/contrib/gtk-module/pk-gtk-module.c b/contrib/gtk-module/pk-gtk-module.c +index 0c38bad..0997a4b 100644 +--- a/contrib/gtk-module/pk-gtk-module.c ++++ b/contrib/gtk-module/pk-gtk-module.c +@@ -119,7 +119,7 @@ pk_install_fonts_idle_cb (gpointer data G_GNUC_UNUSED) + proxy = dbus_g_proxy_new_for_name (connection, + "org.freedesktop.PackageKit", + "/org/freedesktop/PackageKit", +- "org.freedesktop.PackageKit"); ++ "org.freedesktop.PackageKit.Modify"); + if (proxy == NULL) { + g_warning ("Could not connect to PackageKit session service\n"); + goto out; +@@ -129,18 +129,18 @@ pk_install_fonts_idle_cb (gpointer data G_GNUC_UNUSED) + dbus_g_proxy_set_default_timeout (proxy, INT_MAX); + + /* invoke the method */ +- call = dbus_g_proxy_begin_call (proxy, "InstallFonts", ++ call = dbus_g_proxy_begin_call (proxy, "InstallFontconfigResources", + pk_install_fonts_dbus_notify_cb, NULL, NULL, + G_TYPE_UINT, xid, +- G_TYPE_UINT, 0, + G_TYPE_STRV, font_tags, ++ G_TYPE_STRING, "hide-finished", + G_TYPE_INVALID); + if (call == NULL) { + g_warning ("Could not send method"); + goto out; + } + +- g_debug ("InstallFonts method invoked"); ++ g_debug ("InstallFontconfigResources method invoked"); + + out: + g_strfreev (font_tags); diff --git a/PackageKit.spec b/PackageKit.spec index 7e43969..48df24a 100644 --- a/PackageKit.spec +++ b/PackageKit.spec @@ -10,7 +10,7 @@ Summary: Package management service Name: PackageKit Version: 0.4.6 #Release: 0.3.%{?alphatag}git%{?dist} -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: System Environment/Libraries URL: http://www.packagekit.org @@ -30,6 +30,18 @@ Patch2: PackageKit-0.4.6-fix-FakeRepository-for-unicode-paths.patch # Already upstream: 826973135802ee453e014dc601168690b49af25d Patch3: PackageKit-0.4.6-correct-allow-cancel-duplicate-logic.patch +# Already upstream: 79ace3ef67c14b435b2c0d8330aaa7a8774b482c +Patch4: PackageKit-0.4.6-check-package-ids-length.patch + +# Already upstream: b55842c2243c41850b839f900fe333ff3dbef2ab +Patch5: PackageKit-0.4.6-command-not-found-length.patch + +# Already upstream: 28151ea72bcdd826a2d3a3f9109a073e90962169 +Patch6: PackageKit-0.4.6-correct-sync-logic.patch + +# Already upstream: 31b85c79d516d0b97b87c2b205e9fea00c9190ed..426e6a8ba3be3408347af1d8f200956818e230cf +Patch7: PackageKit-0.4.6-dont-use-obsolete-interfaces.patch + Requires: dbus >= %{dbus_version} Requires: dbus-glib >= %{dbus_glib_version} Requires: PackageKit-glib = %{version}-%{release} @@ -232,6 +244,10 @@ using PackageKit. %patch1 -p1 -b .no-time %patch2 -p1 -b .fake-repo-unicode %patch3 -p1 -b .correct-allow-cancel +%patch4 -p1 -b .check-lengths +%patch5 -p1 -b .cmd-not-found-lengths +%patch6 -p1 -b .sync-logic +%patch7 -p1 -b .dont-use-obsolete %build %configure --enable-yum --enable-smart --with-default-backend=yum --disable-local --disable-ruck @@ -426,6 +442,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || : %{_includedir}/PackageKit/backend/*.h %changelog +* Tue Apr 14 2009 Richard Hughes - 0.4.6-3 +- Backport 4 important patches from upstream. + * Thu Apr 02 2009 Richard Hughes - 0.4.6-2 - Fix installing local files with a unicode path. Fixes rh#486720 - Fix the allow cancel duplicate filtering with a patch from upstream.