rpms/hardinfo/devel hardinfo-0.4.2.3-libsoup24.patch, NONE, 1.1 hardinfo.spec, 1.22, 1.23

Adel Gadllah (drago01) fedora-extras-commits at redhat.com
Sat Feb 9 12:00:51 UTC 2008


Author: drago01

Update of /cvs/pkgs/rpms/hardinfo/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15172

Modified Files:
	hardinfo.spec 
Added Files:
	hardinfo-0.4.2.3-libsoup24.patch 
Log Message:
add libsoup-2.4 patch

hardinfo-0.4.2.3-libsoup24.patch:

--- NEW FILE hardinfo-0.4.2.3-libsoup24.patch ---
Index: configure
===================================================================
--- configure	(revision 178)
+++ configure	(working copy)
@@ -153,16 +153,16 @@
 # ---------------------------------------------------------------------------
 
 SOUP=-1
-MIN_VERSION="2.2.7"
+MIN_VERSION="2.3.0"
 echo -n "Checking for libsoup version >= ${MIN_VERSION}... "
 for i in `which pkg-config`; do
-	$i --errors-to-stdout libsoup-2.2 \
+	$i --errors-to-stdout libsoup-2.4 \
 		--atleast-version=$MIN_VERSION > /dev/null
 	case $? in
 		0)
-			SOUP_FLAGS=`pkg-config libsoup-2.2 --cflags --static`
-			SOUP_LIBS=`pkg-config libsoup-2.2 --libs --static`
-			echo "found `pkg-config libsoup-2.2 --modversion`"
+			SOUP_FLAGS=`pkg-config libsoup-2.4 --cflags --static`
+			SOUP_LIBS=`pkg-config libsoup-2.4 --libs --static`
+			echo "found `pkg-config libsoup-2.4 --modversion`"
 			SOUP=1
 			break ;;
 		*)
Index: syncmanager.c
===================================================================
--- syncmanager.c	(revision 178)
+++ syncmanager.c	(working copy)
@@ -23,8 +23,6 @@
 
 #ifdef HAS_LIBSOUP
 #include <libsoup/soup.h>
-#include <libsoup/soup-xmlrpc-message.h>
-#include <libsoup/soup-xmlrpc-response.h>
 
 #include <stdarg.h>
 #include <string.h>
@@ -140,11 +138,10 @@
 }
 
 #ifdef HAS_LIBSOUP
-static SoupXmlrpcValue *_soup_get_xmlrpc_value(SoupMessage * msg,
-					       SyncNetAction * sna)
+static gint _soup_get_xmlrpc_value_int(SoupMessage * msg,
+				       SyncNetAction * sna)
 {
-    SoupXmlrpcResponse *response = NULL;
-    SoupXmlrpcValue *value = NULL;
+    gint int_value = -1;
 
     sna->error = NULL;
 
@@ -154,57 +151,35 @@
 	goto bad;
     }
 
-    response =
-	soup_xmlrpc_message_parse_response(SOUP_XMLRPC_MESSAGE(msg));
-    if (!response) {
+    if (!soup_xmlrpc_extract_method_response(msg->response_body->data,
+					     msg->response_body->length,
+					     NULL,
+					     G_TYPE_INT, &int_value)) {
 	SNA_ERROR(2, "Could not parse XML-RPC response");
-	goto bad;
     }
 
-    value = soup_xmlrpc_response_get_value(response);
-    if (!value) {
-	SNA_ERROR(3, "No response value in XML-RPC response");
-    }
-
-    /*g_object_unref(response); */
   bad:
-    return value;
-}
-
-static long _soup_get_xmlrpc_value_int(SoupMessage * msg,
-				       SyncNetAction * sna)
-{
-    SoupXmlrpcValue *value;
-    long int_value = -1;
-
-    value = _soup_get_xmlrpc_value(msg, sna);
-    if (!value) {
-	SNA_ERROR(4, "Could not extract result from XML-RPC response");
-	goto bad;
-    }
-
-    if (!soup_xmlrpc_value_get_int(value, &int_value)) {
-	SNA_ERROR(4, "Could not extract result from XML-RPC response");
-    }
-
-  bad:
     return int_value;
 }
 
 static gchar *_soup_get_xmlrpc_value_string(SoupMessage * msg,
 					    SyncNetAction * sna)
 {
-    SoupXmlrpcValue *value;
     gchar *string = NULL;
 
-    value = _soup_get_xmlrpc_value(msg, sna);
-    if (!value) {
-	SNA_ERROR(4, "Could not extract result from XML-RPC response");
+    sna->error = NULL;
+
+    if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+	SNA_ERROR(1, "%s (error #%d)", msg->reason_phrase,
+		  msg->status_code);
 	goto bad;
     }
 
-    if (!soup_xmlrpc_value_get_string(value, &string)) {
-	SNA_ERROR(4, "Could not extract result from XML-RPC response");
+    if (!soup_xmlrpc_extract_method_response(msg->response_body->data,
+					     msg->response_body->length,
+					     NULL,
+					     G_TYPE_STRING, &string)) {
+	SNA_ERROR(2, "Could not parse XML-RPC response");
     }
 
   bad:
@@ -212,23 +187,20 @@
 }
 
 static gboolean _soup_xmlrpc_call(gchar * method, SyncNetAction * sna,
-				  SoupMessageCallbackFn callback)
+				  SoupSessionCallback callback)
 {
-    SoupXmlrpcMessage *msg;
+    SoupMessage *msg;
 
     sna->error = NULL;
 
-    msg = soup_xmlrpc_message_new(XMLRPC_SERVER_URI);
+    msg = soup_xmlrpc_request_new(XMLRPC_SERVER_URI, method,
+				  G_TYPE_INVALID);
     if (!msg)
 	return FALSE;
 
     DEBUG("calling xmlrpc method %s", method);
-    soup_xmlrpc_message_start_call(msg, method);
-    soup_xmlrpc_message_end_call(msg);
 
-    soup_xmlrpc_message_persist(msg);
-
-    soup_session_queue_message(session, SOUP_MESSAGE(msg), callback, sna);
+    soup_session_queue_message(session, msg, callback, sna);
     g_main_run(loop);
 
     return TRUE;
@@ -236,49 +208,51 @@
 
 static gboolean _soup_xmlrpc_call_with_parameters(gchar * method,
 						  SyncNetAction * sna,
-						  SoupMessageCallbackFn
+						  SoupSessionCallback
 						  callback, ...)
 {
-    SoupXmlrpcMessage *msg;
-    gchar *argument;
+    SoupMessage *msg;
+    GValueArray *parameters;
+    gchar *argument, *body;
     va_list ap;
 
     sna->error = NULL;
 
-    msg = soup_xmlrpc_message_new(XMLRPC_SERVER_URI);
+    msg = soup_message_new("POST", XMLRPC_SERVER_URI);
+
+    DEBUG("calling xmlrpc method %s", method);
     if (!msg)
 	return FALSE;
 
-    DEBUG("calling xmlrpc method %s", method);
-    soup_xmlrpc_message_start_call(msg, method);
-
+    parameters = g_value_array_new(1);
     va_start(ap, callback);
     while ((argument = va_arg(ap, gchar *))) {
-	soup_xmlrpc_message_start_param(msg);
-	soup_xmlrpc_message_write_string(msg, argument);
-	soup_xmlrpc_message_end_param(msg);
-
+	soup_value_array_append(parameters, G_TYPE_STRING, argument);
 	DEBUG("with parameter: %s", argument);
     }
     va_end(ap);
 
-    soup_xmlrpc_message_end_call(msg);
-    soup_xmlrpc_message_persist(msg);
+    body = soup_xmlrpc_build_method_call(method, parameters->values,
+					 parameters->n_values);
+    g_value_array_free(parameters);
+    soup_message_set_request(msg, "text/xml",
+			     SOUP_MEMORY_TAKE, body, strlen (body));
 
-    soup_session_queue_message(session, SOUP_MESSAGE(msg), callback, sna);
+    soup_session_queue_message(session, msg, callback, sna);
     g_main_run(loop);
 
     return TRUE;
 }
 
-static void _action_check_api_version_got_response(SoupMessage * msg,
+static void _action_check_api_version_got_response(SoupSession * session,
+						   SoupMessage * msg,
 						   gpointer user_data)
 {
     SyncNetAction *sna = (SyncNetAction *) user_data;
-    long version = _soup_get_xmlrpc_value_int(msg, sna);
+    gint version = _soup_get_xmlrpc_value_int(msg, sna);
 
     if (version != XMLRPC_SERVER_API_VERSION) {
-	SNA_ERROR(5, "Server says it supports API version %ld, but "
+	SNA_ERROR(5, "Server says it supports API version %d, but "
 		  "this version of HardInfo only supports API "
 		  "version %d.", version, XMLRPC_SERVER_API_VERSION);
     }
@@ -298,7 +272,8 @@
     return sna->error ? FALSE : TRUE;
 }
 
-static void _action_call_function_got_response(SoupMessage * msg,
+static void _action_call_function_got_response(SoupSession * session,
+					       SoupMessage * msg,
 					       gpointer user_data)
 {
     SyncNetAction *sna = (SyncNetAction *) user_data;
@@ -312,19 +287,7 @@
 
 	DEBUG("saving to %s", filename);
 
-#ifdef g_file_set_contents
 	g_file_set_contents(filename, string, -1, NULL);
-#else
-	{
-	    FILE *f;
-
-	    f = fopen(filename, "w+");
-	    if (f) {
-		fwrite(string, 1, strlen(string), f);
-		fclose(f);
-	    }
-	}
-#endif
 	g_free(filename);
     }
 
@@ -411,7 +374,7 @@
     return actions;
 }
 
-static SoupUri *sync_manager_get_proxy(void)
+static SoupURI *sync_manager_get_proxy(void)
 {
     const gchar *conf;
 
@@ -430,7 +393,7 @@
     SyncNetAction *actions;
 
     if (!session) {
-	SoupUri *proxy = sync_manager_get_proxy();
+	SoupURI *proxy = sync_manager_get_proxy();
 
 	session =
 	    soup_session_async_new_with_options(SOUP_SESSION_TIMEOUT, 10,



Index: hardinfo.spec
===================================================================
RCS file: /cvs/pkgs/rpms/hardinfo/devel/hardinfo.spec,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- hardinfo.spec	29 Jan 2008 16:39:51 -0000	1.22
+++ hardinfo.spec	9 Feb 2008 12:00:13 -0000	1.23
@@ -1,6 +1,6 @@
 Name: hardinfo
 Version: 0.4.2.3
-Release: 3%{?dist}
+Release: 4%{?dist}
 Summary: System Profiler and Benchmark      
 
 Group: Applications/System     
@@ -9,12 +9,14 @@
 Source0:  http://download.berlios.de/hardinfo/%{name}-%{version}.tar.bz2  
 Patch0: fixuserdsp.patch
 Patch1: libzfix.patch
+Patch2: hardinfo-0.4.2.3-libsoup24.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  gtk2-devel
 BuildRequires:  libsoup-devel
 BuildRequires:  desktop-file-utils
-BuildRequires:  pciutils 
+BuildRequires:  pciutils
+BuildRequires:  libtasn1-devel
 
 Requires:  pciutils 
 
@@ -27,6 +29,7 @@
 %setup -q
 %patch0 -p1 -b .fixuserdsp
 %patch1 -p1 -b .libzfix
+%patch2 -p0 -b .libsoup24
 
 %build
 export LIBDIR=%{_libdir}
@@ -57,6 +60,9 @@
 
 
 %changelog
+* Sat Feb 09 2008 Adel Gadllah <adel.gadllah at gmail.com> 0.4.2.3-4
+- Add libsoup-2.4 patch (RH#430960)
+
 * Tue Jan 29 2008 Adel Gadllah <adel.gadllah at gmail.com> 0.4.2.3-3
 - Rebuild for new libsoup
 




More information about the fedora-extras-commits mailing list