Bug 69705

Summary: [1.0] Logger: port to tp-glib 0.99.1
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: loggerAssignee: Guillaume Desmottes <guillaume.desmottes>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 69814, 69846    
Bug Blocks: 69431    
Attachments: include telepathy-glib-dbus.h
stop using NUM_TP_*
stop using tp_account_is_prepared()
move tp_tests_copy_dir() to logger-test-helper

Description Guillaume Desmottes 2013-09-23 12:48:40 UTC
.
Comment 1 Guillaume Desmottes 2013-09-27 13:34:41 UTC
Created attachment 86723 [details] [review]
include telepathy-glib-dbus.h
Comment 2 Guillaume Desmottes 2013-09-27 13:34:53 UTC
Created attachment 86724 [details] [review]
stop using NUM_TP_*
Comment 3 Guillaume Desmottes 2013-09-27 13:35:04 UTC
Created attachment 86725 [details] [review]
stop using tp_account_is_prepared()
Comment 4 Guillaume Desmottes 2013-09-27 13:35:17 UTC
Created attachment 86726 [details] [review]
move tp_tests_copy_dir() to logger-test-helper
Comment 5 Guillaume Desmottes 2013-09-27 13:35:37 UTC
Those patches should be merged to 'master' before branching for 'next'.
Comment 6 Simon McVittie 2013-09-27 13:36:48 UTC
Comment on attachment 86723 [details] [review]
include telepathy-glib-dbus.h

Review of attachment 86723 [details] [review]:
-----------------------------------------------------------------

Sure, as long as it depends on at least 0.20
Comment 7 Simon McVittie 2013-09-27 13:37:00 UTC
Comment on attachment 86724 [details] [review]
stop using NUM_TP_*

Review of attachment 86724 [details] [review]:
-----------------------------------------------------------------

ya rly
Comment 8 Guillaume Desmottes 2013-09-27 13:39:35 UTC
(In reply to comment #6)
> Comment on attachment 86723 [details] [review] [review]
> include telepathy-glib-dbus.h
> 
> Review of attachment 86723 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> Sure, as long as it depends on at least 0.20

We do, merging.
Comment 9 Simon McVittie 2013-09-27 13:42:24 UTC
Comment on attachment 86725 [details] [review]
stop using tp_account_is_prepared()

Review of attachment 86725 [details] [review]:
-----------------------------------------------------------------

yes
Comment 10 Simon McVittie 2013-09-27 13:45:21 UTC
Comment on attachment 86726 [details] [review]
move tp_tests_copy_dir() to logger-test-helper

Review of attachment 86726 [details] [review]:
-----------------------------------------------------------------

::: tests/lib/logger-test-helper.c
@@ +69,5 @@
> +tp_tests_copy_dir (const gchar *from_dir, const gchar *to_dir)
> +{
> +  gchar *command;
> +
> +  // If destination directory exist erase it

We use /* */ comments, but this isn't a regression so never mind.

@@ +70,5 @@
> +{
> +  gchar *command;
> +
> +  // If destination directory exist erase it
> +  command = g_strdup_printf ("rm -rf %s", to_dir);

Ugh, horrible. But it's not a regression so yeah I suppose so. Hopefully we don't call this on anything with shell metacharacters in?
Comment 11 Simon McVittie 2013-09-27 13:50:47 UTC
g_spawn_sync() would be better. Something like this maybe:

gchar *argv[] = { "rm", "-rf", to_dir, NULL };
gchar *stdout;
gchar *stderr;
gint status;

g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, &stdout, &stderr, &status, &error);
g_assert_no_error (error);

if (stdout != NULL)
  g_assert_cmpstr (stdout, ==, "");

if (stderr != NULL)
  g_assert_cmpstr (stderr, ==, "");

g_spawn_check_exit_status (status, &error);
g_assert_no_error (error);
g_free (stdout);
g_free (stderr);

(You could have a helper function that takes argv.)
Comment 12 Simon McVittie 2013-09-27 13:51:18 UTC
(In reply to comment #11)
> g_spawn_check_exit_status (status, &error);

requires GLib 2.34, but I think that'd be OK for master now
Comment 13 Guillaume Desmottes 2013-09-27 13:56:53 UTC
Here is what I have so far (not finished or ready for review)
http://cgit.collabora.com/git/user/cassidy/telepathy-logger/log/?h=next

TODO:
- fix "make check"
- remove all instances of "org.freedesktop.Telepathy"
- Suffix library binary file with -1
- Same for the .pc files
- rename gir to TelepathyLogger-1.gir
- Install headers to telepathy-logger-1/telepathy-logger
Comment 14 Simon McVittie 2013-09-27 14:32:47 UTC
If the introspected API is sufficiently different that API users will have to alter their code anyway, then TelepathyLogger1-1.gir might be better. I'm probably going to do a similar rename on telepathy-glib.

Don't forget to change the installation location for the docs (we forgot to do that for telepathy-glib).
Comment 15 Xavier Claessens 2013-09-27 14:40:53 UTC
Review of your branch so far:

1) telepathy-logger/telepathy-logger-0.2-uninstalled.pc.in:
-Requires: telepathy-glib libxml-2.0
+Requires: telepathy-glib telepathy-glib-1-dbus libxml-2.0

You forgot to change to telepathy-glib-1

2) telepathy-logger/text-channel.c:
 - depends_on[1] = TP_CHANNEL_FEATURE_CONTACTS;

Actually no, CORE is not enough because GROUP is not part of CORE anymore. To get all channel's TpContact prepared you now have to prepare GROUP feature.
Comment 16 Guillaume Desmottes 2013-09-30 09:52:22 UTC
http://cgit.collabora.com/git/user/cassidy/telepathy-logger/log/?h=next updated and should be ready now.

Xavier: I incorporated your branch into mine.

Simon: done; assuming that's the proper way to do it.
Comment 17 Simon McVittie 2013-09-30 11:02:47 UTC
For now, ship it. However, after that:

> -#define GSETTINGS_SCHEMA "org.freedesktop.Telepathy.Logger"
> +#define GSETTINGS_SCHEMA "im.telepathy1.Logger"

We'll need a migration path for this later, but for now I think it's OK to have it be completely independent.

> + <interface name="im.telepathy1.Logger.DRAFT"

Please rename to im.telepathy1.Logger1 (or just Logger if we think it has the same level of stability as Account, but I doubt that) and copy it into telepathy-spec next.

> + namespace="...">FavouriteContactsIsReady</tp:dbus-ref> property.

Can we rename this to FavouriteContactsReady or FavouriteContactsAreReady so I don't get annoyed every time I read it? :-)
Comment 18 Guillaume Desmottes 2013-09-30 12:12:40 UTC
(In reply to comment #17)
> For now, ship it. However, after that:

I just noticed that there is already an old 'next' branch upstream :\
http://cgit.freedesktop.org/telepathy/telepathy-logger/log/?h=next

I'd be tempted to just drop it and replace it with mine tbh.

> > -#define GSETTINGS_SCHEMA "org.freedesktop.Telepathy.Logger"
> > +#define GSETTINGS_SCHEMA "im.telepathy1.Logger"
> 
> We'll need a migration path for this later, but for now I think it's OK to
> have it be completely independent.

Actually do we really want to want that? The GSettings's schema path is completely unrelated to the TP D-Bus namespace. Can't we just keep the current schema as it?

> > + <interface name="im.telepathy1.Logger.DRAFT"
> 
> Please rename to im.telepathy1.Logger1 (or just Logger if we think it has
> the same level of stability as Account, but I doubt that) and copy it into
> telepathy-spec next.
> 
> > + namespace="...">FavouriteContactsIsReady</tp:dbus-ref> property.
> 
> Can we rename this to FavouriteContactsReady or FavouriteContactsAreReady so
> I don't get annoyed every time I read it? :-)

Will do.
Comment 19 Guillaume Desmottes 2013-09-30 12:29:41 UTC
(In reply to comment #17)
+ <interface name="im.telepathy1.Logger.DRAFT"
> 
> Please rename to im.telepathy1.Logger1 (or just Logger if we think it has
> the same level of stability as Account, but I doubt that) and copy it into
> telepathy-spec next.

done (same branch)

> > + namespace="...">FavouriteContactsIsReady</tp:dbus-ref> property.
> 
> Can we rename this to FavouriteContactsReady or FavouriteContactsAreReady so
> I don't get annoyed every time I read it? :-)

Actually it's has been removed so I just updated the doc.
Comment 20 Simon McVittie 2013-09-30 15:13:50 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > > -#define GSETTINGS_SCHEMA "org.freedesktop.Telepathy.Logger"
> > > +#define GSETTINGS_SCHEMA "im.telepathy1.Logger"
> > 
> > We'll need a migration path for this later, but for now I think it's OK to
> > have it be completely independent.
> 
> Actually do we really want to want that? The GSettings's schema path is
> completely unrelated to the TP D-Bus namespace. Can't we just keep the
> current schema as it?

If it's co-installable (i.e. you can install the old and new Logger on the same machine), fine.

If it isn't co-installable, it's still OK for now, but it's an issue we'll need to solve before 1.0.
Comment 21 Guillaume Desmottes 2013-10-01 14:04:11 UTC
I reverted the schema change and pushed to origin.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.