From 9c8f0e1ee5a072359bfb04166dc99cf2b595f4d5 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 17 Jan 2012 14:43:28 +0100 Subject: [PATCH] New upstream release 0.8 Various small specfile improvements Enable vala bindings --- .gitignore | 1 + 0001-Handle-spice_audio_new-failures.patch | 32 ++++ ...low-calling-spice_msg_out_send-from-.patch | 141 ++++++++++++++++++ sources | 2 +- spice-gtk-controller-includes.patch | 20 --- spice-gtk.spec | 85 +++++++---- 6 files changed, 234 insertions(+), 47 deletions(-) create mode 100644 0001-Handle-spice_audio_new-failures.patch create mode 100644 0002-spice-channel-Allow-calling-spice_msg_out_send-from-.patch delete mode 100644 spice-gtk-controller-includes.patch diff --git a/.gitignore b/.gitignore index c87e041..57e959b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /spice-gtk-0.7.tar.bz2 /spice-gtk-0.7.1-d5a8.tar.bz2 /spice-gtk-0.7.39-ab64.tar.bz2 +/spice-gtk-0.8.tar.bz2 diff --git a/0001-Handle-spice_audio_new-failures.patch b/0001-Handle-spice_audio_new-failures.patch new file mode 100644 index 0000000..17fb08f --- /dev/null +++ b/0001-Handle-spice_audio_new-failures.patch @@ -0,0 +1,32 @@ +From 424c67ab1e6be34a35a5133f6037950b8bcb25b7 Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Fri, 13 Jan 2012 19:19:40 +0100 +Subject: [PATCH spice-gtk 1/3] Handle spice_audio_new failures + +spice_audio_new can return a NULL pointer when there's a failure +during the initialization of the audio system. When this happens, +we shouldn't keep initializing the spice audio channel as if nothing +happened, but just stop the connection. +This can be tested by forcing the "self" variable to NULL in +spice_audio_new +This should fix https://bugzilla.redhat.com/show_bug.cgi?id=772118 +--- + gtk/spice-audio.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c +index f58a81e..3d6e34c 100644 +--- a/gtk/spice-audio.c ++++ b/gtk/spice-audio.c +@@ -221,6 +221,8 @@ SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context, + #ifdef WITH_GSTAUDIO + self = SPICE_AUDIO(spice_gstaudio_new(session, context, name)); + #endif ++ if (!self) ++ return NULL; + + spice_g_signal_connect_object(session, "notify::enable-audio", G_CALLBACK(session_enable_audio), self, 0); + spice_g_signal_connect_object(session, "channel-new", G_CALLBACK(channel_new), self, 0); +-- +1.7.7.4 + diff --git a/0002-spice-channel-Allow-calling-spice_msg_out_send-from-.patch b/0002-spice-channel-Allow-calling-spice_msg_out_send-from-.patch new file mode 100644 index 0000000..c512854 --- /dev/null +++ b/0002-spice-channel-Allow-calling-spice_msg_out_send-from-.patch @@ -0,0 +1,141 @@ +From 3cf733aa98df7cdceaf8ac25b25802a606a9d6e6 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 16 Jan 2012 15:28:00 +0100 +Subject: [PATCH spice-gtk 3/3] spice-channel: Allow calling + spice_msg_out_send from any context + +spice_msg_out can be not only called from system context and usb event +handling thread context, but also from co-routine context. Calling from +co-routine context happens when a response gets send synchronously from +the handle_msg handler for a certain received packet. This happens with +certain usbredir commands. + +This triggers the following assert in the coroutine code: +"GSpice-CRITICAL **: g_coroutine_wakeup: assertion `coroutine != + g_coroutine_self()' failed" + +This patch fixes this by making spice_msg_out_send callable from any +context and at the same time changing the code to not do unnecessary +wakeups. + +Signed-off-by: Hans de Goede +--- + gtk/spice-channel-priv.h | 2 +- + gtk/spice-channel.c | 52 ++++++++++++++++++++++++++++++++++----------- + 2 files changed, 40 insertions(+), 14 deletions(-) + +diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h +index ebdc5ce..5cd7ddb 100644 +--- a/gtk/spice-channel-priv.h ++++ b/gtk/spice-channel-priv.h +@@ -102,7 +102,7 @@ struct _SpiceChannelPrivate { + GQueue xmit_queue; + gboolean xmit_queue_blocked; + GStaticMutex xmit_queue_lock; +- GThread *main_thread; ++ guint xmit_queue_wakeup_id; + + char name[16]; + enum spice_channel_state state; +diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c +index 83cd344..bdfb02b 100644 +--- a/gtk/spice-channel.c ++++ b/gtk/spice-channel.c +@@ -110,7 +110,6 @@ static void spice_channel_init(SpiceChannel *channel) + spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_MINI_HEADER); + g_queue_init(&c->xmit_queue); + g_static_mutex_init(&c->xmit_queue_lock); +- c->main_thread = g_thread_self(); + } + + static void spice_channel_constructed(GObject *gobject) +@@ -649,14 +648,32 @@ void spice_msg_out_unref(SpiceMsgOut *out) + static gboolean spice_channel_idle_wakeup(gpointer user_data) + { + SpiceChannel *channel = SPICE_CHANNEL(user_data); ++ SpiceChannelPrivate *c = channel->priv; ++ ++ /* ++ * Note: ++ * ++ * - This must be done before the wakeup as that may eventually ++ * call channel_reset() which checks this. ++ * - The lock calls are really necessary, this fixes the following race: ++ * 1) usb-event-thread calls spice_msg_out_send() ++ * 2) spice_msg_out_send calls g_timeout_add_full(...) ++ * 3) we run, set xmit_queue_wakeup_id to 0 ++ * 4) spice_msg_out_send stores the result of g_timeout_add_full() in ++ * xmit_queue_wakeup_id, overwriting the 0 we just stored ++ * 5) xmit_queue_wakeup_id now says there is a wakeup pending which is ++ * false ++ */ ++ g_static_mutex_lock(&c->xmit_queue_lock); ++ c->xmit_queue_wakeup_id = 0; ++ g_static_mutex_unlock(&c->xmit_queue_lock); + + spice_channel_wakeup(channel, FALSE); +- g_object_unref(channel); + + return FALSE; + } + +-/* system context */ ++/* any context (system/co-routine/usb-event-thread) */ + G_GNUC_INTERNAL + void spice_msg_out_send(SpiceMsgOut *out) + { +@@ -664,17 +681,23 @@ void spice_msg_out_send(SpiceMsgOut *out) + g_return_if_fail(out->channel != NULL); + + g_static_mutex_lock(&out->channel->priv->xmit_queue_lock); +- if (!out->channel->priv->xmit_queue_blocked) ++ if (!out->channel->priv->xmit_queue_blocked) { ++ gboolean was_empty; ++ ++ was_empty = g_queue_is_empty(&out->channel->priv->xmit_queue); + g_queue_push_tail(&out->channel->priv->xmit_queue, out); +- g_static_mutex_unlock(&out->channel->priv->xmit_queue_lock); + +- /* TODO: we currently flush/wakeup immediately all buffered messages */ +- if (g_thread_self() != out->channel->priv->main_thread) +- /* We use g_timeout_add_full so that can specify the priority */ +- g_timeout_add_full(G_PRIORITY_HIGH, 0, spice_channel_idle_wakeup, +- g_object_ref(out->channel), NULL); +- else +- spice_channel_wakeup(out->channel, FALSE); ++ /* One wakeup is enough to empty the entire queue -> only do a wakeup ++ if the queue was empty, and there isn't one pending already. */ ++ if (was_empty && !out->channel->priv->xmit_queue_wakeup_id) { ++ out->channel->priv->xmit_queue_wakeup_id = ++ /* Use g_timeout_add_full so that can specify the priority */ ++ g_timeout_add_full(G_PRIORITY_HIGH, 0, ++ spice_channel_idle_wakeup, ++ out->channel, NULL); ++ } ++ } ++ g_static_mutex_unlock(&out->channel->priv->xmit_queue_lock); + } + + /* coroutine context */ +@@ -1688,7 +1711,6 @@ error: + } + + /* system context */ +-/* TODO: we currently flush/wakeup immediately all buffered messages */ + G_GNUC_INTERNAL + void spice_channel_wakeup(SpiceChannel *channel, gboolean cancel) + { +@@ -2344,6 +2366,10 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating) + c->xmit_queue_blocked = TRUE; /* Disallow queuing new messages */ + g_queue_foreach(&c->xmit_queue, (GFunc)spice_msg_out_unref, NULL); + g_queue_clear(&c->xmit_queue); ++ if (c->xmit_queue_wakeup_id) { ++ g_source_remove(c->xmit_queue_wakeup_id); ++ c->xmit_queue_wakeup_id = 0; ++ } + g_static_mutex_unlock(&c->xmit_queue_lock); + + g_array_set_size(c->remote_common_caps, 0); +-- +1.7.7.4 + diff --git a/sources b/sources index d4045f9..0001c9e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7043735c55396bf634c27c5a8adb94a1 spice-gtk-0.7.39-ab64.tar.bz2 +761b6c3d74d962d437bdd72f54292498 spice-gtk-0.8.tar.bz2 diff --git a/spice-gtk-controller-includes.patch b/spice-gtk-controller-includes.patch deleted file mode 100644 index e138587..0000000 --- a/spice-gtk-controller-includes.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/gtk/controller/controller.c -+++ b/gtk/controller/controller.c -@@ -15,6 +15,7 @@ - - #include - #include -+#include - #include - #include - #include ---- a/gtk/controller/menu.c -+++ b/gtk/controller/menu.c -@@ -15,6 +15,7 @@ - - #include - #include -+#include - #include - #include - #include diff --git a/spice-gtk.spec b/spice-gtk.spec index 5dfba5b..cc7a533 100644 --- a/spice-gtk.spec +++ b/spice-gtk.spec @@ -8,23 +8,26 @@ %if 0%{?fedora} >= 15 %define with_gtk3 1 %endif -%define _version_suffix -ab64 + +#define _version_suffix -ab64 Name: spice-gtk -Version: 0.7.39 -Release: 3%{?dist} -Summary: A GTK2 widget for SPICE clients +Version: 0.8 +Release: 1%{?dist} +Summary: A GTK+ widget for SPICE clients Group: System Environment/Libraries License: LGPLv2+ URL: http://spice-space.org/page/Spice-Gtk Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# 2 fixes from upstream git +Patch0: 0001-Handle-spice_audio_new-failures.patch +Patch1: 0002-spice-channel-Allow-calling-spice_msg_out_send-from-.patch BuildRequires: intltool BuildRequires: gtk2-devel >= 2.14 -BuildRequires: spice-protocol >= 0.9.0 -BuildRequires: usbredir-devel >= 0.3.1 +BuildRequires: spice-protocol >= 0.10.1 +BuildRequires: usbredir-devel >= 0.3.3 BuildRequires: libusb1-devel >= 1.0.9 BuildRequires: libgudev1-devel BuildRequires: perl-Text-CSV @@ -34,12 +37,16 @@ BuildRequires: pygtk2-devel python-devel zlib-devel BuildRequires: cyrus-sasl-devel BuildRequires: libcacard-devel BuildRequires: gobject-introspection-devel +BuildRequires: libacl-devel +BuildRequires: polkit-devel BuildRequires: gtk-doc +BuildRequires: vala-tools %if %{with_gtk3} BuildRequires: gtk3-devel %endif # Hack because of bz #613466 BuildRequires: libtool +Requires: spice-glib%{?_isa} = %{version}-%{release} ExclusiveArch: %{ix86} x86_64 @@ -49,8 +56,8 @@ Client libraries for SPICE desktop servers. %package devel Summary: Development files to build GTK2 applications with spice-gtk-2.0 Group: Development/Libraries -Requires: %{name} = %{version}-%{release} -Requires: spice-glib-devel = %{version}-%{release} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: spice-glib-devel%{?_isa} = %{version}-%{release} Requires: pkgconfig Requires: gtk2-devel @@ -69,7 +76,7 @@ spice-client-glib-2.0 is a SPICE client library for GLib2. %package -n spice-glib-devel Summary: Development files to build Glib2 applications with spice-glib-2.0 Group: Development/Libraries -Requires: spice-glib = %{version}-%{release} +Requires: spice-glib%{?_isa} = %{version}-%{release} Requires: pkgconfig Requires: glib2-devel @@ -83,6 +90,7 @@ Libraries, includes, etc. to compile with the spice-glib-2.0 libraries %package -n spice-gtk3 Summary: A GTK3 widget for SPICE clients Group: Development/Libraries +Requires: spice-glib%{?_isa} = %{version}-%{release} %description -n spice-gtk3 spice-client-glib-3.0 is a SPICE client library for Gtk3. @@ -90,8 +98,8 @@ spice-client-glib-3.0 is a SPICE client library for Gtk3. %package -n spice-gtk3-devel Summary: Development files to build GTK3 applications with spice-gtk-3.0 Group: Development/Libraries -Requires: spice-gtk3 = %{version}-%{release} -Requires: spice-glib-devel = %{version}-%{release} +Requires: spice-gtk3%{?_isa} = %{version}-%{release} +Requires: spice-glib-devel%{?_isa} = %{version}-%{release} Requires: pkgconfig Requires: gtk3-devel @@ -99,6 +107,15 @@ Requires: gtk3-devel spice-client-gtk-3.0 provides a SPICE viewer widget for GTK3. Libraries, includes, etc. to compile with the spice-gtk3 libraries + +%package -n spice-gtk3-vala +Summary: Vala bindings for the spice-gtk-3.0 library +Group: Development/Libraries +Requires: spice-gtk3%{?_isa} = %{version}-%{release} +Requires: spice-gtk3-devel%{?_isa} = %{version}-%{release} + +%description -n spice-gtk3-vala +A module allowing use of the spice-gtk-3.0 widget from vala %endif %package python @@ -120,9 +137,15 @@ Simple clients for interacting with SPICE servers. spicy is a client to a SPICE desktop server. snappy is a tool to capture screen-shots of a SPICE desktop. + %prep %setup -q -n spice-gtk-%{version}%{?_version_suffix} -c +pushd spice-gtk-%{version}%{?_version_suffix} +%patch0 -p1 +%patch1 -p1 +popd + if [ -n '%{?_version_suffix}' ]; then mv spice-gtk-%{version}%{?_version_suffix} spice-gtk-%{version} fi @@ -135,20 +158,19 @@ cp -a spice-gtk-%{version} spice-gtk3-%{version} %build cd spice-gtk-%{version} -%configure --enable-gtk-doc --with-gtk=2.0 +%configure --with-gtk=2.0 --enable-gtk-doc --with-usb-acl-helper-dir=%{_libexecdir}/spice-gtk/ make %{?_smp_mflags} cd .. %if %{with_gtk3} cd spice-gtk3-%{version} -%configure --with-gtk=3.0 +%configure --with-gtk=3.0 --enable-vala --with-usb-acl-helper-dir=%{_libexecdir}/spice-gtk/ make %{?_smp_mflags} cd .. %endif %install -rm -rf %{buildroot} %if %{with_gtk3} cd spice-gtk3-%{version} @@ -166,15 +188,20 @@ rm -f %{buildroot}%{_libdir}/python*/site-packages/*.a rm -f %{buildroot}%{_libdir}/python*/site-packages/*.la %find_lang %{name} -%clean -rm -rf %{buildroot} %post -p /sbin/ldconfig - %postun -p /sbin/ldconfig +%post -n spice-glib -p /sbin/ldconfig +%postun -n spice-glib -p /sbin/ldconfig + +%if %{with_gtk3} +%post -n spice-gtk3 -p /sbin/ldconfig +%postun -n spice-gtk3 -p /sbin/ldconfig +%endif + + %files -%defattr(-,root,root,-) %doc spice-gtk-%{version}/AUTHORS %doc spice-gtk-%{version}/COPYING %doc spice-gtk-%{version}/README @@ -183,20 +210,19 @@ rm -rf %{buildroot} %{_libdir}/girepository-1.0/SpiceClientGtk-2.0.typelib %files devel -%defattr(-,root,root,-) %{_libdir}/libspice-client-gtk-2.0.so %{_includedir}/spice-client-gtk-2.0 %{_libdir}/pkgconfig/spice-client-gtk-2.0.pc %{_datadir}/gir-1.0/SpiceClientGtk-2.0.gir %files -n spice-glib -f %{name}.lang -%defattr(-,root,root,-) %{_libdir}/libspice-client-glib-2.0.so.* %{_libdir}/libspice-controller.so.* %{_libdir}/girepository-1.0/SpiceClientGLib-2.0.typelib +%{_libexecdir}/spice-gtk/spice-client-glib-usb-acl-helper +%{_datadir}/polkit-1/actions/org.spice-space.lowlevelusbaccess.policy %files -n spice-glib-devel -%defattr(-,root,root,-) %{_libdir}/libspice-client-glib-2.0.so %{_libdir}/libspice-controller.so %{_includedir}/spice-client-glib-2.0 @@ -209,29 +235,36 @@ rm -rf %{buildroot} %if %{with_gtk3} %files -n spice-gtk3 -%defattr(-,root,root,-) %{_libdir}/libspice-client-gtk-3.0.so.* %{_libdir}/girepository-1.0/SpiceClientGtk-3.0.typelib %files -n spice-gtk3-devel -%defattr(-,root,root,-) %{_libdir}/libspice-client-gtk-3.0.so %{_includedir}/spice-client-gtk-3.0 %{_libdir}/pkgconfig/spice-client-gtk-3.0.pc %{_datadir}/gir-1.0/SpiceClientGtk-3.0.gir + +%files -n spice-gtk3-vala +%{_datadir}/vala/vapi/spice-client-glib-2.0.deps +%{_datadir}/vala/vapi/spice-client-glib-2.0.vapi +%{_datadir}/vala/vapi/spice-client-gtk-3.0.deps +%{_datadir}/vala/vapi/spice-client-gtk-3.0.vapi %endif %files python -%defattr(-,root,root,-) %{_libdir}/python*/site-packages/SpiceClientGtk.so %files tools -%defattr(-,root,root,-) %{_bindir}/snappy %{_bindir}/spicy %{_bindir}/spicy-stats %changelog +* Mon Jan 16 2012 Hans de Goede - 0.8-1 +- New upstream release 0.8 +- Various small specfile improvements +- Enable vala bindings + * Sat Jan 14 2012 Fedora Release Engineering - 0.7.39-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild