diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/autobuild.sh /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/autobuild.sh --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/autobuild.sh 2006-07-06 00:34:17.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/autobuild.sh 2006-11-05 22:47:57.000000000 +0100 @@ -48,13 +48,9 @@ NOW=`date +"%s"` EXTRA_RELEASE=".$USER$NOW" fi - rpmbuild -ta --define "extra_release $EXTRA_RELEASE" --clean $NAME-*.tar.gz + # The --nodeps bit is a nasty hack to force build + # against the dbus from autobuild, rather than a + # (non-existant) installed RPM + rpmbuild -ta --define "extra_release $EXTRA_RELEASE" --clean $NAME-*.tar.gz --nodeps fi -# Skip debian pkg for now -exit 0 - -if [ -f /usr/bin/fakeroot ]; then - fakeroot debian/rules clean - fakeroot debian/rules DESTDIR=$HOME/packages/debian binary -fi diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/CHANGES /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/CHANGES --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/CHANGES 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/CHANGES 2006-11-05 22:47:57.000000000 +0100 @@ -1,3 +1,31 @@ +Changes since 0.33.3 + + - Fixed service owner used for org.freedesktop.DBus object + to make signal handling on the bus work again + + - Pass return value for signal handling callbacks all the + way back to DBus + + - Fix multiple problems with marshalling of variant data + types + + - Replace use of dbus_connection_disconnect with _close + when compiling against dbus >= 0.90 + + - Call dbus_connection_unref in the DESTROY method of + connection object + + - Fix reference counting in connection & pending call + objects + + - Added example of galago desktop notifications + + - Fix test suite errors + + - Added missing import statement + + - Throw Net::DBus::Error if an async call fails + Changes since 0.33.2 - Fixed parsing of introspection data if there are processing diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/DBus.xs /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/DBus.xs --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/DBus.xs 2007-04-11 10:53:39.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/DBus.xs 2006-11-05 22:47:57.000000000 +0100 @@ -23,10 +23,11 @@ #include -#if PD_DO_DEBUG -#define PD_DEBUG(...) if (getenv("PD_DEBUG")) fprintf(stderr, __VA_ARGS__) +#if NET_DBUS_DEBUG +static int net_dbus_debug = 0; +#define DEBUG_MSG(...) if (net_dbus_debug) fprintf(stderr, __VA_ARGS__) #else -#define PD_DEBUG(...) +#define DEBUG_MSG(...) #endif @@ -39,7 +40,7 @@ void _object_release(void *obj) { - PD_DEBUG("Releasing object count on %p\n", obj); + DEBUG_MSG("Releasing object count on %p\n", obj); SvREFCNT_dec((SV*)obj); } @@ -51,7 +52,7 @@ SV *h_sv; dSP; - PD_DEBUG("Watch generic callback %p %p %s %d\n", watch, data, key, server); + DEBUG_MSG("Watch generic callback %p %p %s %d\n", watch, data, key, server); if (server) { selfref = (SV*)dbus_server_get_data((DBusServer*)data, server_data_slot); @@ -60,7 +61,7 @@ } self = (HV*)SvRV(selfref); - PD_DEBUG("Got owner %p\n", self); + DEBUG_MSG("Got owner %p\n", self); call = hv_fetch(self, key, strlen(key), 0); @@ -198,7 +199,7 @@ return; } - PD_DEBUG("Created connection in callback %p\n", new_connection); + DEBUG_MSG("Created connection in callback %p\n", new_connection); /* The DESTROY method will de-ref it later */ dbus_connection_ref(new_connection); @@ -234,11 +235,11 @@ selfref = (SV*)dbus_connection_get_data(con, connection_data_slot); self = (HV*)SvRV(selfref); - PD_DEBUG("Create message in filter %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("Create message in filter %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); /* Will be de-refed in the DESTROY method */ dbus_message_ref(msg); value = sv_newmortal(); @@ -254,14 +255,14 @@ PUTBACK; count = call_method("_message_filter", G_SCALAR); - /* XXX POPi prints use of uninitialized value ?!?!?! */ -if (0) { + SPAGAIN; if (count == 1) { handled = POPi; } else { handled = 0; } -} + PUTBACK; + DEBUG_MSG("Handled %d %d\n", count, handled); FREETMPS; LEAVE; @@ -275,6 +276,7 @@ HV *self; dSP; + DEBUG_MSG("In pending call callback %p\n", call); selfref = (SV*)dbus_pending_call_get_data(call, pending_call_data_slot); self = (HV*)SvRV(selfref); @@ -317,11 +319,11 @@ SV *value; dSP; - PD_DEBUG("Got message in callback %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("Got message in callback %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); /* Will be de-refed in the DESTROY method */ dbus_message_ref(msg); value = sv_newmortal(); @@ -402,6 +404,9 @@ { HV *constants; + if (getenv("NET_DBUS_DEBUG")) + net_dbus_debug = 1; + /* not the 'standard' way of doing perl constants, but a lot easier to maintain */ constants = perl_get_hv("Net::DBus::Binding::Bus::_constants", TRUE); @@ -459,6 +464,7 @@ CODE: dbus_error_init(&error); con = dbus_connection_open(address, &error); + dbus_connection_ref(con); if (!con) { _croak_error (&error); } @@ -477,7 +483,22 @@ dbus_connection_set_data(con, connection_data_slot, owner, _object_release); void -dbus_connection_close(con) +dbus_connection_disconnect(con) + DBusConnection *con; + CODE: + DEBUG_MSG("Closing connection %p\n", con); +#if HAVE_CONN_DISCONNECT + dbus_connection_disconnect(con); +#else + dbus_connection_close(con); +#endif + +void +dbus_connection_ref(con) + DBusConnection *con; + +void +dbus_connection_unref(con) DBusConnection *con; int @@ -519,13 +540,11 @@ if (!(reply = dbus_connection_send_with_reply_and_block(con, msg, timeout, &error))) { _croak_error(&error); } - PD_DEBUG("Create msg reply %p\n", reply); - PD_DEBUG(" Type %d\n", dbus_message_get_type(reply)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(reply) ? dbus_message_get_interface(reply) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(reply) ? dbus_message_get_path(reply) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(reply) ? dbus_message_get_member(reply) : ""); - // XXX needed ? - //dbus_message_ref(reply); + DEBUG_MSG("Create msg reply %p\n", reply); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(reply)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(reply) ? dbus_message_get_interface(reply) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(reply) ? dbus_message_get_path(reply) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(reply) ? dbus_message_get_member(reply) : ""); RETVAL = reply; OUTPUT: RETVAL @@ -542,9 +561,7 @@ if (!dbus_connection_send_with_reply(con, msg, &reply, timeout)) { croak("not enough memory to send message"); } - PD_DEBUG("Create pending call %p\n", reply); - // XXX needed ? - //dbus_pending_call_ref(reply); + DEBUG_MSG("Create pending call %p\n", reply); RETVAL = reply; OUTPUT: RETVAL @@ -571,7 +588,9 @@ _dispatch(con) DBusConnection *con; CODE: + DEBUG_MSG("IN dispatch\n"); while(dbus_connection_dispatch(con) == DBUS_DISPATCH_DATA_REMAINS); + DEBUG_MSG("Completed \n"); void _set_watch_callbacks(con) @@ -637,7 +656,7 @@ SV *code; CODE: SvREFCNT_inc(code); - PD_DEBUG("Adding filter %p\n", code); + DEBUG_MSG("Adding filter %p\n", code); dbus_connection_add_filter(con, _message_filter, code, _filter_release); dbus_bool_t @@ -661,7 +680,7 @@ DBusError error; CODE: dbus_error_init(&error); - PD_DEBUG("Adding match %s\n", rule); + DEBUG_MSG("Adding match %s\n", rule); dbus_bus_add_match(con, rule, &error); if (dbus_error_is_set(&error)) { _croak_error(&error); @@ -675,7 +694,7 @@ DBusError error; CODE: dbus_error_init(&error); - PD_DEBUG("Removeing match %s\n", rule); + DEBUG_MSG("Removeing match %s\n", rule); dbus_bus_remove_match(con, rule, &error); if (dbus_error_is_set(&error)) { _croak_error(&error); @@ -704,11 +723,9 @@ void DESTROY(con) DBusConnection *con; - CODE: - PD_DEBUG("Destroying connection %p\n", con); - dbus_connection_close(con); - // XXX do we need this or not ? - //dbus_connection_unref(con); + CODE: + DEBUG_MSG("Unrefing connection %p\n", con); + dbus_connection_unref(con); MODULE = Net::DBus::Binding::Server PACKAGE = Net::DBus::Binding::Server @@ -724,7 +741,7 @@ CODE: dbus_error_init(&error); server = dbus_server_listen(address, &error); - PD_DEBUG("Created server %p on address %s", server, address); + DEBUG_MSG("Created server %p on address %s\n", server, address); if (!server) { _croak_error(&error); } @@ -792,7 +809,7 @@ DESTROY(server) DBusServer *server; CODE: - PD_DEBUG("Destroying server %p\n", server); + DEBUG_MSG("Destroying server %p\n", server); dbus_server_unref(server); @@ -809,6 +826,7 @@ CODE: dbus_error_init(&error); con = dbus_bus_get(type, &error); + dbus_connection_ref(con); if (!con) { _croak_error(&error); } @@ -830,8 +848,8 @@ if (!msg) { croak("No memory to allocate message"); } - PD_DEBUG("Create msg new %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG("Create msg new %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); RETVAL = msg; OUTPUT: RETVAL @@ -863,11 +881,11 @@ DESTROY(msg) DBusMessage *msg; CODE: - PD_DEBUG("De-referencing message %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("De-referencing message %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); dbus_message_unref(msg); dbus_bool_t @@ -941,11 +959,11 @@ if (!msg) { croak("No memory to allocate message"); } - PD_DEBUG("Create msg new signal %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("Create msg new signal %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); RETVAL = msg; OUTPUT: RETVAL @@ -967,11 +985,11 @@ if (!msg) { croak("No memory to allocate message"); } - PD_DEBUG("Create msg new method call %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("Create msg new method call %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); RETVAL = msg; OUTPUT: RETVAL @@ -993,11 +1011,11 @@ dbus_message_set_interface(msg, dbus_message_get_interface(call)); dbus_message_set_path(msg, dbus_message_get_path(call)); dbus_message_set_member(msg, dbus_message_get_member(call)); - PD_DEBUG("Create msg new method return %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("Create msg new method return %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); RETVAL = msg; OUTPUT: RETVAL @@ -1018,11 +1036,11 @@ if (!msg) { croak("No memory to allocate message"); } - PD_DEBUG("Create msg new error %p\n", msg); - PD_DEBUG(" Type %d\n", dbus_message_get_type(msg)); - PD_DEBUG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); - PD_DEBUG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); - PD_DEBUG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); + DEBUG_MSG("Create msg new error %p\n", msg); + DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg)); + DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : ""); + DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : ""); + DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : ""); RETVAL = msg; OUTPUT: RETVAL @@ -1032,8 +1050,18 @@ PROTOTYPES: ENABLE DBusMessage * -dbus_pending_call_steal_reply(call) +_steal_reply(call) DBusPendingCall *call; + PREINIT: + DBusMessage *msg; + CODE: + DEBUG_MSG("Stealing pending call reply %p\n", call); + msg = dbus_pending_call_steal_reply(call); + dbus_message_ref(msg); + DEBUG_MSG("Got reply message %p\n", msg); + RETVAL = msg; + OUTPUT: + RETVAL void dbus_pending_call_block(call) @@ -1053,14 +1081,14 @@ SV *code; CODE: SvREFCNT_inc(code); - PD_DEBUG("Adding pending call notify %p\n", code); + DEBUG_MSG("Adding pending call notify %p\n", code); dbus_pending_call_set_notify(call, _pending_call_callback, code, _pending_call_notify_release); void DESTROY (call) DBusPendingCall *call; CODE: - PD_DEBUG("Unrefing pending call %p", call); + DEBUG_MSG("Unrefing pending call %p", call); dbus_pending_call_unref(call); MODULE = Net::DBus::Binding::C::Watch PACKAGE = Net::DBus::Binding::C::Watch @@ -1094,7 +1122,7 @@ DBusWatch *watch; unsigned int flags; CODE: - PD_DEBUG("Handling event %d on fd %d (%p)\n", flags, dbus_watch_get_fd(watch), watch); + DEBUG_MSG("Handling event %d on fd %d (%p)\n", flags, dbus_watch_get_fd(watch), watch); dbus_watch_handle(watch, flags); @@ -1136,7 +1164,7 @@ handle(timeout) DBusTimeout *timeout; CODE: - PD_DEBUG("Handling timeout event %p\n", timeout); + DEBUG_MSG("Handling timeout event %p\n", timeout); dbus_timeout_handle(timeout); void * @@ -1426,7 +1454,7 @@ DESTROY(iter) DBusMessageIter *iter; CODE: - PD_DEBUG("Destroying iterator %p\n", iter); + DEBUG_MSG("Destroying iterator %p\n", iter); dbus_free(iter); MODULE = Net::DBus PACKAGE = Net::DBus diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/debian/changelog /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/debian/changelog --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/debian/changelog 2007-04-11 10:53:39.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/debian/changelog 2007-04-11 10:53:39.000000000 +0200 @@ -1,3 +1,14 @@ +libnet-dbus-perl (0.33.4-1) unstable; urgency=low + + * New upstream release + - Closes: #408881 + * Acknowledge NMU. Thanks Michael Ablassmeier! + - Closes: #386925 + * Disable tests until next upstream release. CPAN bug #22850 + - Closes: #395861 + + -- Jack Bates Wed, 7 Mar 2007 01:04:06 -0800 + libnet-dbus-perl (0.33.3-1.1) unstable; urgency=low * Non-maintainer upload. diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/debian/rules /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/debian/rules --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/debian/rules 2007-04-11 10:53:39.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/debian/rules 2007-04-11 10:53:39.000000000 +0200 @@ -53,7 +53,8 @@ dh_clean -k # Add commands to install the package into debian/$PACKAGE_NAME here - $(MAKE) test + # TODO: Re-enable tests for next upstream release. CPAN bug #22850 + #$(MAKE) test $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr # As this is a architecture dependent package, we are not diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/examples/example-service-async.pl /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/examples/example-service-async.pl --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/examples/example-service-async.pl 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/examples/example-service-async.pl 2006-11-05 22:47:57.000000000 +0100 @@ -35,6 +35,22 @@ return ["Hello", " from example-service-async.pl"]; } +dbus_method("GetDict", [], [["dict", "string", "string"]]); +sub GetDict { + my $self = shift; + print "Do get dict\n"; + sleep 10; + return {"first" => "Hello Dict", "second" => " from example-service.pl"}; +} + +dbus_method("GetTuple", [], [["struct", "string", "string"]]); +sub GetTuple { + my $self = shift; + print "Do get tuple\n"; + sleep 10; + return ["Hello Tuple", " from example-service.pl"]; +} + package main; my $bus = Net::DBus->session(); diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/examples/notification.pl /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/examples/notification.pl --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/examples/notification.pl 1970-01-01 01:00:00.000000000 +0100 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/examples/notification.pl 2006-11-05 22:47:57.000000000 +0100 @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use Net::DBus qw(:typing); + + +my $bus = Net::DBus->session; + +my $svc = $bus->get_service("org.freedesktop.Notifications"); +my $obj = $svc->get_object("/org/freedesktop/Notifications"); + +$obj->Notify("notification.pl", + 0, + '', + "Demo notification", + "Demonstrating using of desktop\n" . + "notifications from Net::DBus\n", + ["done", "Done"], + {"desktop-entry" => "virt-manager", x => dbus_variant(dbus_int32(200)), y => dbus_variant(dbus_int32(200))}, + 2_000); diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/ASyncReply.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/ASyncReply.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/ASyncReply.pm 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/ASyncReply.pm 2006-11-05 22:47:57.000000000 +0100 @@ -154,6 +154,13 @@ my $reply = $self->{pending_call}->get_reply; + if ($reply->isa("Net::DBus::Binding::Message::Error")) { + my $iter = $reply->iterator(); + my $desc = $iter->get_string(); + die Net::DBus::Error->new(name => $reply->get_error_name, + message => $desc); + } + my @reply; if ($self->{introspector}) { @reply = $self->{introspector}->decode($reply, "methods", $self->{method_name}, "returns"); diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Binding/Connection.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Binding/Connection.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Binding/Connection.pm 2007-04-11 10:53:39.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Binding/Connection.pm 2006-11-05 22:47:57.000000000 +0100 @@ -144,7 +144,7 @@ sub disconnect { my $self = shift; - $self->{connection}->dbus_connection_close(); + $self->{connection}->dbus_connection_disconnect(); } =item $con->flush() @@ -555,7 +555,7 @@ my $replyto = shift; my $name = shift; my $description = shift; - + return Net::DBus::Binding::Message::Error->new(replyto => $replyto, name => $name, description => $description); diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Binding/Introspector.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Binding/Introspector.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Binding/Introspector.pm 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Binding/Introspector.pm 2006-11-05 22:47:57.000000000 +0100 @@ -140,8 +140,8 @@ $self->{children} = exists $params{children} ? $params{children} : []; } - # XXX it is really a bug that these aren't included in the introspection - # data the bus generates + # Some versions of dbus failed to include signals in introspection data + # so this code adds them, letting us keep compatability with old versions if ($self->{object_path} eq "/org/freedesktop/DBus") { if (!$self->has_signal("NameOwnerChanged")) { $self->add_signal("NameOwnerChanged", ["string","string","string"], "org.freedesktop.DBus"); @@ -702,7 +702,7 @@ $current = pop @cont; } } elsif ($type eq "v") { - push @{$current}, "variant"; + push @{$current}, ["variant"]; if ($current->[0] eq "array") { $current = pop @cont; } diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Binding/PendingCall.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Binding/PendingCall.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Binding/PendingCall.pm 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Binding/PendingCall.pm 2006-11-05 22:47:57.000000000 +0100 @@ -130,14 +130,12 @@ sub get_reply { my $self = shift; - my $reply = $self->{pending_call}->dbus_pending_call_steal_reply(); + my $reply = $self->{pending_call}->_steal_reply(); my $type = $reply->dbus_message_get_type; if ($type == &Net::DBus::Binding::Message::MESSAGE_TYPE_ERROR) { - return $self->{connection}->make_error_message($self->{method_call}, - $reply); + return $self->{connection}->make_raw_message($reply); } elsif ($type == &Net::DBus::Binding::Message::MESSAGE_TYPE_METHOD_RETURN) { - return $self->{connection}->make_method_return_message($self->{method_call}, - $reply); + return $self->{connection}->make_raw_message($reply); } else { die "unknown method reply type $type"; } diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Test/MockConnection.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Test/MockConnection.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Test/MockConnection.pm 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Test/MockConnection.pm 2006-11-05 22:47:57.000000000 +0100 @@ -62,6 +62,7 @@ use strict; use warnings; +use Net::DBus::Error; use Net::DBus::Test::MockMessage; use Net::DBus::Binding::Message::MethodCall; use Net::DBus::Binding::Message::MethodReturn; diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Test/MockIterator.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Test/MockIterator.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus/Test/MockIterator.pm 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus/Test/MockIterator.pm 2006-11-05 22:47:57.000000000 +0100 @@ -113,8 +113,8 @@ sub next { my $self = shift; - if ($self->{position} < $#{$self->{data}}) { - $self->{position}++; + $self->{position}++; + if ($self->{position} <= $#{$self->{data}}) { return 1; } return 0; @@ -456,7 +456,7 @@ sub get_dict { my $self = shift; - + my $iter = $self->_recurse(); my $type = $iter->get_arg_type(); my $dict = {}; @@ -483,7 +483,7 @@ sub get_array { my $self = shift; my $array_type = shift; - + my $iter = $self->_recurse(); my $type = $iter->get_arg_type(); my $array = []; @@ -525,7 +525,7 @@ sub get_struct { my $self = shift; - + my $iter = $self->_recurse(); my $type = $iter->get_arg_type(); my $struct = []; @@ -843,7 +843,7 @@ sub get_arg_type { my $self = shift; - + return &Net::DBus::Binding::Message::TYPE_INVALID if $self->{position} > $#{$self->{data}}; @@ -868,7 +868,7 @@ if ($data->[0] != &Net::DBus::Binding::Message::TYPE_ARRAY) { die "current element is not an array"; } - return $data->[2]; + return $data->[1]->[0]->[0]; } @@ -885,8 +885,9 @@ my $type = $data->[0]; if ($type != &Net::DBus::Binding::Message::TYPE_STRUCT && $type != &Net::DBus::Binding::Message::TYPE_ARRAY && + $type != &Net::DBus::Binding::Message::TYPE_DICT_ENTRY && $type != &Net::DBus::Binding::Message::TYPE_VARIANT) { - die "current data element is not a container"; + die "current data element '$type' is not a container"; } return $self->_new(data => $data->[1], diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus.pm /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus.pm --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/lib/Net/DBus.pm 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/lib/Net/DBus.pm 2006-11-05 22:47:57.000000000 +0100 @@ -87,7 +87,7 @@ use warnings; BEGIN { - our $VERSION = '0.33.3'; + our $VERSION = '0.33.4'; require XSLoader; XSLoader::load('Net::DBus', $VERSION); } @@ -250,10 +250,9 @@ # ... Add support for GLib and POE } - $self->get_connection->add_filter(sub { $self->_signal_func(@_) }); + $self->get_connection->add_filter(sub { return $self->_signal_func(@_); }); - # XXX is it ok to fix '1:0' as the owner of this ? - $self->{bus} = Net::DBus::RemoteService->new($self, ":1.0", "org.freedesktop.DBus"); + $self->{bus} = Net::DBus::RemoteService->new($self, "org.freedesktop.DBus", "org.freedesktop.DBus"); return $self; } diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/Makefile.PL /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/Makefile.PL --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/Makefile.PL 2006-07-06 00:34:17.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/Makefile.PL 2006-11-05 22:47:57.000000000 +0100 @@ -3,6 +3,9 @@ # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. +`pkg-config --atleast-version=0.90 dbus-1`; +my $has_0_90 = (($? >> 8) == 0 ? 1 : 0); + my $DBUS_LIBS = `pkg-config --libs dbus-1`; my $DBUS_CFLAGS = `pkg-config --cflags dbus-1`; @@ -21,10 +24,11 @@ 'Time::HiRes' => 0, 'XML::Twig' => 0, }, -# 'ABSTRACT_FROM' => 'lib/Net/DBus.pm', 'AUTHOR' => 'Daniel Berrange ', - 'LIBS' => [$DBUS_LIBS], - 'DEFINE' => "-DDBUS_API_SUBJECT_TO_CHANGE -DPD_DO_DEBUG=1", + 'LIBS' => [$DBUS_LIBS], + 'DEFINE' => ($has_0_90 ? + "-DDBUS_API_SUBJECT_TO_CHANGE -DHAVE_CONN_DISCONNECT=0 -DNET_DBUS_DEBUG=1" : + "-DDBUS_API_SUBJECT_TO_CHANGE -DHAVE_CONN_DISCONNECT=1 -DNET_DBUS_DEBUG=1"), 'INC' => "-Wall $DBUS_CFLAGS", 'depend' => { Net-DBus.spec => '$(VERSION_FROM)', diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/MANIFEST /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/MANIFEST --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/MANIFEST 2006-07-06 00:51:44.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/MANIFEST 2006-11-05 23:35:13.000000000 +0100 @@ -13,6 +13,7 @@ examples/example-signal-emitter.pl examples/example-signal-receiver.pl examples/lshal.pl +examples/notification.pl lib/Net/DBus.pm lib/Net/DBus/Annotation.pm lib/Net/DBus/ASyncReply.pm @@ -48,7 +49,6 @@ Makefile.PL MANIFEST This list of files MANIFEST.SKIP -META.yml Net-DBus.spec.PL README t/00-constants.t @@ -67,5 +67,7 @@ t/60-object-props.t t/65-object-magic.t t/70-errors.t +t/75-notifications.t typemap Net-DBus.spec +META.yml Module meta-data (added by MakeMaker) diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/META.yml /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/META.yml --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/META.yml 2006-07-06 00:52:07.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/META.yml 2006-11-05 23:35:13.000000000 +0100 @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Net-DBus -version: 0.33.3 +version: 0.33.4 version_from: lib/Net/DBus.pm installdirs: site requires: @@ -10,4 +10,4 @@ XML::Twig: 0 distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 +generated_by: ExtUtils::MakeMaker version 6.30 diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/Net-DBus.spec /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/Net-DBus.spec --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/Net-DBus.spec 2006-07-06 00:51:52.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/Net-DBus.spec 2006-11-05 23:34:48.000000000 +0100 @@ -12,7 +12,7 @@ Summary: Perl API to the DBus message system Name: perl-%{appname} -Version: 0.33.3 +Version: 0.33.4 Release: 1%{_extra_release} License: GPL Group: Applications/Internet @@ -21,12 +21,12 @@ #BuildArchitectures: noarch Requires: perl = %{perlversion} # For XML::Twig -Requires: perl-XML-Twig +Requires: perl(XML::Twig) # For Time::HiRes -Requires: perl-Time-HiRes +Requires: perl(Time::HiRes) Requires: dbus >= 0.33 BuildRequires: dbus-devel >= 0.33 -BuildRequires: perl-XML-Twig +BuildRequires: perl(XML::Twig) %description Provides a Perl API to the DBus message system diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/Net-DBus.spec.PL /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/Net-DBus.spec.PL --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/Net-DBus.spec.PL 2006-07-06 00:34:17.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/Net-DBus.spec.PL 2006-11-05 22:47:57.000000000 +0100 @@ -50,12 +50,12 @@ #BuildArchitectures: noarch Requires: perl = %{perlversion} # For XML::Twig -Requires: perl-XML-Twig +Requires: perl(XML::Twig) # For Time::HiRes -Requires: perl-Time-HiRes +Requires: perl(Time::HiRes) Requires: dbus >= 0.33 BuildRequires: dbus-devel >= 0.33 -BuildRequires: perl-XML-Twig +BuildRequires: perl(XML::Twig) %description Provides a Perl API to the DBus message system diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/t/30-server.t /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/t/30-server.t --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/t/30-server.t 2006-07-06 00:34:37.000000000 +0200 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/t/30-server.t 2006-11-05 22:47:57.000000000 +0100 @@ -4,7 +4,7 @@ use strict; use warnings; -BEGIN { +BEGIN { use_ok('Net::DBus::Binding::Server'); use_ok('Net::DBus::Binding::Connection'); use_ok('Net::DBus::Reactor'); @@ -20,6 +20,7 @@ my $incoming; $server->set_connection_callback(sub { + $server = shift; $incoming = shift; }); diff -Nru /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/t/75-notifications.t /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/t/75-notifications.t --- /tmp/i8IRuFUeZO/libnet-dbus-perl-0.33.3/t/75-notifications.t 1970-01-01 01:00:00.000000000 +0100 +++ /tmp/hhQc2kJzIF/libnet-dbus-perl-0.33.4/t/75-notifications.t 2006-11-05 22:47:57.000000000 +0100 @@ -0,0 +1,71 @@ +# -*- perl -*- +use Test::More tests => 10; + +# This test case is primarily about variants - but +# in particular the signature of org.freedesktop.Notifications.Notify + +use strict; +use warnings; + +BEGIN { + use_ok('Net::DBus') or die; + use_ok('Net::DBus::Object') or die; +}; + + +package MyObject; + +use base qw(Net::DBus::Object); +use Net::DBus::Exporter qw(org.cpan.Net.DBus.Test.Notify); + +sub new { + my $class = shift; + my $service = shift; + my $self = $class->SUPER::new($service, "/org/cpan/Net/DBus/Test/Notify"); + + bless $self, $class; + + $self->{data} = {}; + + return $self; +} + +dbus_method("Notify", ["string", "uint32", "string", "string", "string", ["array", "string"], [ "dict", "string", ["variant"]], "int32"],["uint32"]); +sub Notify { + my $self = shift; + + $self->{data} = \@_; + + return 0; +} + +package main; + +my $bus = Net::DBus->test; + +my $svc = $bus->export_service("org.cpan.Net.DBus.Test.Notify"); +my $obj = MyObject->new($svc); + +my $rsvc = $bus->get_service("org.cpan.Net.DBus.Test.Notify"); +my $robj = $rsvc->get_object("/org/cpan/Net/DBus/Test/Notify"); + +my $res = $robj->Notify( + "dbus-test", # Application name + 7, # replaces_id (0 -> nothing) + 'someicon', #app_icon ("" -> no icon) + 'Test event', # summary + "This is a test to see if DBUS works nicely in Perl.\nI hope that this works.", # body + ["frob", "wibble"], # actions + {"ooh" => "eek", "bar" => "wizz"}, # hints + 2_000 # expire_timeout in milliseconds + ); + +is($obj->{data}->[0], "dbus-test", "name is correct"); +is($obj->{data}->[1], 7, "replacesid is correct"); +is($obj->{data}->[2], "someicon", "icon is correct"); +is($obj->{data}->[3], "Test event", "summary is correct"); +is($obj->{data}->[4], "This is a test to see if DBUS works nicely in Perl.\nI hope that this works.", "name is correct"); +is_deeply($obj->{data}->[5], ["frob", "wibble"], "actions is correct"); +is_deeply($obj->{data}->[6], {"ooh" => "eek", "bar" => "wizz"}, "hints is correct"); +is($obj->{data}->[7], 2_000, "timeout is correct"); +