rpms/ocaml-dbus/devel ocaml-dbus-example_avahi.ml, NONE, 1.1 ocaml-dbus-object-path.patch, NONE, 1.1 ocaml-dbus-string-of-ty.patch, NONE, 1.1 .cvsignore, 1.2, 1.3 ocaml-dbus.spec, 1.1, 1.2 sources, 1.2, 1.3
Richard W.M. Jones (rjones)
fedora-extras-commits at redhat.com
Sat Feb 23 14:25:52 UTC 2008
Author: rjones
Update of /cvs/pkgs/rpms/ocaml-dbus/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25942/devel
Modified Files:
.cvsignore ocaml-dbus.spec sources
Added Files:
ocaml-dbus-example_avahi.ml ocaml-dbus-object-path.patch
ocaml-dbus-string-of-ty.patch
Log Message:
* Sat Feb 23 2008 Richard W.M. Jones <rjones at redhat.com> - 0.04-1
- New upstream release 0.04.
- Added patches which have gone upstream for Avahi support.
- Added demo Avahi program.
--- NEW FILE ocaml-dbus-example_avahi.ml ---
(* Browse the local network for ssh services using Avahi and D-Bus.
* There is *zero* documentation for this. I examined a lot of code
* to do this, and the following page was also very helpful:
* http://www.amk.ca/diary/2007/04/rough_notes_python_and_dbus.html
* See also the DBus API reference:
* http://dbus.freedesktop.org/doc/dbus/api/html/index.html
* See also Dan Berrange's Perl bindings:
* http://search.cpan.org/src/DANBERR/Net-DBus-0.33.5/lib/Net/
*
* By Richard W.M. Jones <rich at annexia.org> or <rjones at redhat.com>.
* PUBLIC DOMAIN example code.
*)
open Printf
open DBus
let rec print_msg msg =
(match Message.get_type msg with
| Message.Invalid ->
printf "Invalid";
| Message.Method_call ->
printf "Method_call";
| Message.Method_return ->
printf "Method_return";
| Message.Error ->
printf "Error";
| Message.Signal ->
printf "Signal");
let print_opt f name =
match f msg with
| None -> ()
| Some value -> printf " %s=%S" name value
in
print_opt Message.get_member "member";
print_opt Message.get_path "path";
print_opt Message.get_interface "interface";
print_opt Message.get_sender "sender";
let fields = Message.get msg in
printf "(";
print_fields fields;
printf ")\n%!";
and print_fields fields =
printf "%s" (string_of_ty_list fields)
(* Perform a synchronous call to an object method. *)
let call_method ~bus ~err ~name ~path ~interface ~methd args =
(* Create the method_call message. *)
let msg = Message.new_method_call name path interface methd in
Message.append msg args;
(* Send the message, get reply. *)
let r = Connection.send_with_reply_and_block bus msg (-1) err in
Message.get r
let () =
let err = Error.init () in
let bus = Bus.get Bus.System err in
if Error.is_set err then failwith "error set after getting System bus";
(* Create a new ServiceBrowser object which emits a signal whenever
* a new network service of the type specified is found on the network.
*)
let r =
call_method ~bus ~err
~name:"org.freedesktop.Avahi"
~path:"/"
~interface:"org.freedesktop.Avahi.Server"
~methd:"ServiceBrowserNew"
[
Int32 (-1_l); (* interface, -1=AVAHI_IF_UNSPEC *)
Int32 0_l; (* 0=IPv4, 1=IPv6 *)
String "_ssh._tcp"; (* service type *)
String ""; (* XXX call GetDomainName() *)
UInt32 0_l; (* flags *)
] in
let path =
match r with
| [ ObjectPath path ] -> path
| _ -> failwith "unexpected return value" in
eprintf "ServiceBrowser path = %S\n%!" path;
(* Register a callback to accept the signals. *)
Connection.add_filter bus (
fun bus msg ->
if Message.get_type msg = Message.Signal then (
print_msg msg;
);
true
);
(* Add a match rule so we see these signals. *)
Bus.add_match bus
("type='signal',sender='org.freedesktop.Avahi.ServiceBrowser',path='" ^
path ^ "',member='ItemNew'")
err;
(* Wait for incoming signals. *)
while Connection.read_write_dispatch bus (-1) do ()
done
ocaml-dbus-object-path.patch:
--- NEW FILE ocaml-dbus-object-path.patch ---
Index: dBus.ml
===================================================================
RCS file: /home/remote/rjones/cvsroot/redhat/ocaml_dbus/dBus.ml,v
retrieving revision 1.4
diff -u -r1.4 dBus.ml
--- dBus.ml 23 Feb 2008 13:55:13 -0000 1.4
+++ dBus.ml 23 Feb 2008 13:59:55 -0000
@@ -31,6 +31,7 @@
| UInt64 of int64
| Double of float
| String of string
+ | ObjectPath of string
let string_of_ty = function
| Byte c -> sprintf "%C" c
@@ -44,6 +45,7 @@
| UInt64 i -> sprintf "long(%Ld)" i
| Double d -> sprintf "%g" d
| String s -> sprintf "%S" s
+ | ObjectPath s -> sprintf "path(%S)" s
let string_of_ty_list xs =
String.concat ", " (List.map string_of_ty xs)
Index: dBus.mli
===================================================================
RCS file: /home/remote/rjones/cvsroot/redhat/ocaml_dbus/dBus.mli,v
retrieving revision 1.4
diff -u -r1.4 dBus.mli
--- dBus.mli 23 Feb 2008 13:55:13 -0000 1.4
+++ dBus.mli 23 Feb 2008 13:59:55 -0000
@@ -28,6 +28,7 @@
| UInt64 of int64
| Double of float
| String of string
+ | ObjectPath of string
val string_of_ty : ty -> string
val string_of_ty_list : ty list -> string
Index: dbus_stubs.c
===================================================================
RCS file: /home/remote/rjones/cvsroot/redhat/ocaml_dbus/dbus_stubs.c,v
retrieving revision 1.3
diff -u -r1.3 dbus_stubs.c
--- dbus_stubs.c 23 Feb 2008 13:51:21 -0000 1.3
+++ dbus_stubs.c 23 Feb 2008 13:59:55 -0000
@@ -44,6 +44,7 @@
DBUS_TYPE_INT32, DBUS_TYPE_UINT32,
DBUS_TYPE_INT64, DBUS_TYPE_UINT64,
DBUS_TYPE_DOUBLE, DBUS_TYPE_STRING,
+ DBUS_TYPE_OBJECT_PATH,
-1
};
@@ -622,6 +623,7 @@
dbus_message_iter_append_basic(&iter, c_type, &d);
break;
}
+ case DBUS_TYPE_OBJECT_PATH:
case DBUS_TYPE_STRING: {
char *s = strdup(String_val(v));
dbus_message_iter_append_basic(&iter, c_type, &s);
@@ -698,6 +700,7 @@
Field(r, 0) = v;
break;
}
+ case DBUS_TYPE_OBJECT_PATH:
case DBUS_TYPE_STRING: {
char *s;
dbus_message_iter_get_basic(&args, &s);
ocaml-dbus-string-of-ty.patch:
--- NEW FILE ocaml-dbus-string-of-ty.patch ---
Index: dBus.ml
===================================================================
RCS file: /home/remote/rjones/cvsroot/redhat/ocaml_dbus/dBus.ml,v
retrieving revision 1.3
diff -u -r1.3 dBus.ml
--- dBus.ml 23 Feb 2008 13:51:21 -0000 1.3
+++ dBus.ml 23 Feb 2008 13:55:03 -0000
@@ -13,6 +13,8 @@
* Dbus binding
*)
+open Printf
+
type error
type bus
type message
@@ -30,6 +32,22 @@
| Double of float
| String of string
+let string_of_ty = function
+ | Byte c -> sprintf "%C" c
+ | Bool true -> sprintf "true"
+ | Bool false -> sprintf "false"
+ | Int16 i -> sprintf "short(%d)" i
+ | UInt16 i -> sprintf "ushort(%d)" i
+ | Int32 i -> sprintf "int(%ld)" i
+ | UInt32 i -> sprintf "uint(%ld)" i
+ | Int64 i -> sprintf "long(%Ld)" i
+ | UInt64 i -> sprintf "long(%Ld)" i
+ | Double d -> sprintf "%g" d
+ | String s -> sprintf "%S" s
+
+let string_of_ty_list xs =
+ String.concat ", " (List.map string_of_ty xs)
+
(******************* ERROR *********************)
module Error = struct
external init : unit -> error = "stub_dbus_error_init"
Index: dBus.mli
===================================================================
RCS file: /home/remote/rjones/cvsroot/redhat/ocaml_dbus/dBus.mli,v
retrieving revision 1.3
diff -u -r1.3 dBus.mli
--- dBus.mli 23 Feb 2008 13:51:21 -0000 1.3
+++ dBus.mli 23 Feb 2008 13:55:03 -0000
@@ -29,6 +29,9 @@
| Double of float
| String of string
+val string_of_ty : ty -> string
+val string_of_ty_list : ty list -> string
+
module Error :
sig
val init : unit -> error
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/ocaml-dbus/devel/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore 13 Feb 2008 11:24:57 -0000 1.2
+++ .cvsignore 23 Feb 2008 14:25:19 -0000 1.3
@@ -1 +1 @@
-ocaml_dbus-0.03.tar.bz2
+ocaml_dbus-0.04.tar.bz2
Index: ocaml-dbus.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ocaml-dbus/devel/ocaml-dbus.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ocaml-dbus.spec 13 Feb 2008 11:24:57 -0000 1.1
+++ ocaml-dbus.spec 23 Feb 2008 14:25:19 -0000 1.2
@@ -2,17 +2,21 @@
%define debug_package %{nil}
Name: ocaml-dbus
-Version: 0.03
-Release: 2%{?dist}
+Version: 0.04
+Release: 1%{?dist}
Summary: OCaml library for using D-Bus
Group: Development/Libraries
License: LGPLv2
URL: http://tab.snarc.org/projects/ocaml_dbus/
-Source0: http://tab.snarc.org/download/ocaml/ocaml_dbus-0.03.tar.bz2
+Source0: http://tab.snarc.org/download/ocaml/ocaml_dbus-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExcludeArch: ppc64
+Patch0: ocaml-dbus-string-of-ty.patch
+Patch1: ocaml-dbus-object-path.patch
+Source1: ocaml-dbus-example_avahi.ml
+
BuildRequires: ocaml >= 3.10.0-7, ocaml-findlib
BuildRequires: dbus-devel
@@ -39,6 +43,9 @@
%prep
%setup -q -n ocaml_dbus-%{version}
+%patch0 -p0
+%patch1 -p0
+cp %{SOURCE1} example_avahi.ml
%build
@@ -85,7 +92,7 @@
%files devel
%defattr(-,root,root,-)
-%doc README
+%doc README example_avahi.ml
%if %opt
%{_libdir}/ocaml/dbus/*.a
%{_libdir}/ocaml/dbus/*.cmxa
@@ -95,6 +102,11 @@
%changelog
+* Sat Feb 23 2008 Richard W.M. Jones <rjones at redhat.com> - 0.04-1
+- New upstream release 0.04.
+- Added patches which have gone upstream for Avahi support.
+- Added demo Avahi program.
+
* Tue Jan 8 2008 Richard W.M. Jones <rjones at redhat.com> - 0.03-2
- BR dbus-devel.
- Fix a typo in the description.
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/ocaml-dbus/devel/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sources 13 Feb 2008 11:24:57 -0000 1.2
+++ sources 23 Feb 2008 14:25:19 -0000 1.3
@@ -1 +1 @@
-7ba9095b407f919baa728e28b569308f ocaml_dbus-0.03.tar.bz2
+736b11fa87655f23ea63d94f89573a74 ocaml_dbus-0.04.tar.bz2
More information about the fedora-extras-commits
mailing list