[gsmartcontrol] Add patch for glib 2.31.

Eric Smith brouhaha at fedoraproject.org
Tue Dec 13 07:09:05 UTC 2011


commit 22b0a96c2d72715276034d0824bf6730c2fc50ad
Author: Eric Smith <eric at brouhaha.com>
Date:   Mon Dec 12 23:09:06 2011 -0800

    Add patch for glib 2.31.

 gsmartcontrol-0.8.6-glib-2.31-mutex.patch |   37 +++++++++++++++++++++++++++++
 gsmartcontrol.spec                        |   11 ++++++++-
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/gsmartcontrol-0.8.6-glib-2.31-mutex.patch b/gsmartcontrol-0.8.6-glib-2.31-mutex.patch
new file mode 100644
index 0000000..3ba10d9
--- /dev/null
+++ b/gsmartcontrol-0.8.6-glib-2.31-mutex.patch
@@ -0,0 +1,37 @@
+diff -up gsmartcontrol-0.8.6/src/hz/sync_policy_glib.h.gstaticmutex gsmartcontrol-0.8.6/src/hz/sync_policy_glib.h
+--- gsmartcontrol-0.8.6/src/hz/sync_policy_glib.h.gstaticmutex	2011-03-06 01:21:07.000000000 -0800
++++ gsmartcontrol-0.8.6/src/hz/sync_policy_glib.h	2011-12-12 22:45:43.000000000 -0800
+@@ -17,30 +17,14 @@
+ // Glib-based policy.
+ 
+ 
+-// Note: g_static_mutex_*lock() functions may give warnings about breaking strict-aliasing rules.
+-// The warnings are completely harmless and visible on some versions of glib only.
+-// However, due to their number, I decided to implement this workaround.
+-
+-#ifndef _WIN32
+-	// same as stock version, but an additional cast to (void*) is added.
+-	#define hz_glib_static_mutex_get_mutex(mutex) \
+-		( g_thread_use_default_impl ? ((GMutex*) ((void*)((mutex)->static_mutex.pad))) : \
+-		g_static_mutex_get_mutex_impl_shortcut(&((mutex)->runtime_mutex)) )
+-
+-#else
+-	// win32 has different definition of this macro, so default to stock version.
+-	#define hz_glib_static_mutex_get_mutex(mutex) g_static_mutex_get_mutex(mutex)
+-#endif
+-
+-
+ #define hz_glib_static_mutex_lock(mutex) \
+-	g_mutex_lock(hz_glib_static_mutex_get_mutex(mutex))
++	g_mutex_lock(g_static_mutex_get_mutex(mutex))
+ 
+ #define hz_glib_static_mutex_trylock(mutex) \
+-	g_mutex_trylock(hz_glib_static_mutex_get_mutex(mutex))
++	g_mutex_trylock(g_static_mutex_get_mutex(mutex))
+ 
+ #define hz_glib_static_mutex_unlock(mutex) \
+-	g_mutex_unlock(hz_glib_static_mutex_get_mutex(mutex))
++	g_mutex_unlock(g_static_mutex_get_mutex(mutex))
+ 
+ 
+ 
diff --git a/gsmartcontrol.spec b/gsmartcontrol.spec
index 0cd545a..b696605 100644
--- a/gsmartcontrol.spec
+++ b/gsmartcontrol.spec
@@ -1,6 +1,6 @@
 Name:		gsmartcontrol
 Version:	0.8.6
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	Graphical user interface for smartctl
 Group:		Applications/System
 
@@ -18,6 +18,11 @@ Requires:	usermode
 # as Fedora uses console-helper instead.
 Patch0:		gsmartcontrol-console-helper.patch
 
+# Patch to avoid deprecated GStaticMutex with glib 2.31, needed for
+# Fedora 17 and newer.  Patch supplied by author, and is in upstream source
+# repository, so it should be in the next release.
+Patch1:		gsmartcontrol-0.8.6-glib-2.31-mutex.patch
+
 BuildRequires:	gtkmm24-devel pcre-devel desktop-file-utils
 
 %description
@@ -30,6 +35,7 @@ data to determine its health, as well as run various tests on it.
 %prep
 %setup -q
 %patch -P 0 -p1 -b .console-helper
+%patch -P 1 -p1 -b .gstaticmutex
 
 %build
 %configure
@@ -99,6 +105,9 @@ fi
 %config(noreplace) %{_sysconfdir}/security/console.apps/%{name}
 
 %changelog
+* Mon Dec 12 2011 Eric Smith <eric at brouhaha.com>  0.8.6-3
+- Patch to work around deprecated g_static_mutex.
+
 * Sat Dec 03 2011 Eric Smith <eric at brouhaha.com>  0.8.6-2
 - Updated per package review comments.
 


More information about the scm-commits mailing list