After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763046 - lua-factory: keep old API before next release :)
lua-factory: keep old API before next release :)
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
unspecified
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks: 732879
 
 
Reported: 2016-03-03 15:53 UTC by Victor Toso
Modified: 2016-03-21 23:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lua-factory: use wrapper for lua_pcall (7.69 KB, patch)
2016-03-09 01:21 UTC, Victor Toso
none Details | Review
lua-factory: Make grl and grl.lua read-only (4.70 KB, patch)
2016-03-09 01:21 UTC, Victor Toso
none Details | Review
lua-factory: introduce source state table (12.42 KB, patch)
2016-03-09 01:21 UTC, Victor Toso
none Details | Review
lua-factory: set state of all operations (5.19 KB, patch)
2016-03-09 01:21 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()" (8.60 KB, patch)
2016-03-09 01:21 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_media_keys() into the static table" (4.36 KB, patch)
2016-03-09 01:22 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_options() into the static table" (19.98 KB, patch)
2016-03-09 01:22 UTC, Victor Toso
none Details | Review
Revert "tests: port lua-factory fake sources to new API" (3.94 KB, patch)
2016-03-09 01:22 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-guardianvideos.lua to the new lua system" (2.27 KB, patch)
2016-03-09 01:22 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-euronews.lua to the new lua system" (1.71 KB, patch)
2016-03-09 01:22 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-appletrailers.lua to the new lua system" (3.15 KB, patch)
2016-03-09 01:22 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-metrolyrics.lua to the new lua system" (2.80 KB, patch)
2016-03-09 01:23 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system" (2.07 KB, patch)
2016-03-09 01:23 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-pocket.lua to the new lua system" (2.19 KB, patch)
2016-03-09 01:23 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-spotify-cover.lua to the new lua system" (2.52 KB, patch)
2016-03-09 01:23 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-radiofrance.lua to the new lua system" (1.68 KB, patch)
2016-03-09 01:23 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system" (2.71 KB, patch)
2016-03-09 01:23 UTC, Victor Toso
none Details | Review
lua-factory: use wrapper for lua_pcall (7.84 KB, patch)
2016-03-11 01:31 UTC, Victor Toso
none Details | Review
lua-factory: Make grl and grl.lua read-only (4.70 KB, patch)
2016-03-11 01:32 UTC, Victor Toso
none Details | Review
lua-factory: introduce source state table (12.40 KB, patch)
2016-03-11 01:32 UTC, Victor Toso
none Details | Review
lua-factory: set state of all operations (5.06 KB, patch)
2016-03-11 01:32 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()" (6.25 KB, patch)
2016-03-11 01:32 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_media_keys() into the static table" (4.39 KB, patch)
2016-03-11 01:32 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_options() into the static table" (20.35 KB, patch)
2016-03-11 01:32 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_options() into the static table" (20.66 KB, patch)
2016-03-11 13:01 UTC, Victor Toso
none Details | Review
lua-factory: use wrapper for lua_pcall (7.84 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
lua-factory: Make grl and grl.lua read-only (4.70 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
lua-factory: introduce source state table (12.48 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
lua-factory: set state of all operations (4.95 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()" (7.50 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_media_keys() into the static table" (4.41 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
Revert "lua-factory: change grl.get_options() into the static table" (21.14 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
lua-factory: watchdog for lua-sources (7.44 KB, patch)
2016-03-13 23:02 UTC, Victor Toso
none Details | Review
tests: include tests for erros in lua sources (10.14 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "tests: port lua-factory fake sources to new API" (3.94 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-guardianvideos.lua to the new lua system" (2.27 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-euronews.lua to the new lua system" (1.71 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-appletrailers.lua to the new lua system" (3.15 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-metrolyrics.lua to the new lua system" (2.80 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system" (2.07 KB, patch)
2016-03-13 23:03 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-pocket.lua to the new lua system" (2.19 KB, patch)
2016-03-13 23:04 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-spotify-cover.lua to the new lua system" (2.52 KB, patch)
2016-03-13 23:04 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-radiofrance.lua to the new lua system" (1.68 KB, patch)
2016-03-13 23:04 UTC, Victor Toso
none Details | Review
Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system" (2.71 KB, patch)
2016-03-13 23:04 UTC, Victor Toso
none Details | Review
lua-factory: use wrapper for lua_pcall (9.69 KB, patch)
2016-03-21 15:53 UTC, Victor Toso
committed Details | Review
lua-factory: Create a proxy for grl and grl.lua (5.81 KB, patch)
2016-03-21 15:54 UTC, Victor Toso
committed Details | Review
lua-factory: introduce source state table (18.74 KB, patch)
2016-03-21 15:54 UTC, Victor Toso
committed Details | Review
lua-factory: set state of all operations (6.28 KB, patch)
2016-03-21 15:54 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()" (7.79 KB, patch)
2016-03-21 15:54 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: change grl.get_media_keys() into the static table" (4.71 KB, patch)
2016-03-21 15:54 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: change grl.get_options() into the static table" (21.73 KB, patch)
2016-03-21 15:55 UTC, Victor Toso
committed Details | Review
lua-factory: watchdog for lua-sources (9.07 KB, patch)
2016-03-21 15:55 UTC, Victor Toso
committed Details | Review
tests: include tests for errors in lua sources (12.62 KB, patch)
2016-03-21 15:55 UTC, Victor Toso
committed Details | Review
Revert "tests: port lua-factory fake sources to new API" (3.94 KB, patch)
2016-03-21 15:55 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-guardianvideos.lua to the new lua system" (2.27 KB, patch)
2016-03-21 15:55 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-euronews.lua to the new lua system" (1.71 KB, patch)
2016-03-21 15:55 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-appletrailers.lua to the new lua system" (3.15 KB, patch)
2016-03-21 15:56 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-metrolyrics.lua to the new lua system" (2.80 KB, patch)
2016-03-21 15:56 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system" (2.07 KB, patch)
2016-03-21 15:56 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-pocket.lua to the new lua system" (2.19 KB, patch)
2016-03-21 15:56 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-spotify-cover.lua to the new lua system" (2.52 KB, patch)
2016-03-21 15:56 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-radiofrance.lua to the new lua system" (1.68 KB, patch)
2016-03-21 15:56 UTC, Victor Toso
committed Details | Review
Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system" (2.71 KB, patch)
2016-03-21 15:57 UTC, Victor Toso
committed Details | Review
lua-factory: make grl and grl.lua read-only (2.18 KB, patch)
2016-03-21 15:57 UTC, Victor Toso
committed Details | Review

Description Victor Toso 2016-03-03 15:53:28 UTC
As per request, thinking about moving back the lua-sources API but without removing the internal benefits that Bug 753141 introduced.

That would be, basically, using grl.callback (instead of callback() as argument) and grl.get_options("something") (instead of options table)

Callback and Options are bounded to the operation.

My initial plan is to use an userdata with __gc set so when we call lua_gc we can handle an internal state of lua-source as it could be:
- on an async operation: grl.fetch or grl.unzip
- ended: grl.callback()
- error: none of above

This is pretty much what is being done with grl_l_callback in order to call grl_util_operation_spec_gc

Let's see how it goes.
Comment 1 Bastien Nocera 2016-03-03 16:11:07 UTC
To be clear, what I don't like is the source developer having to do things like:
local userdata = {callback = callback, skip = skip, count = count}
[...]
grl.fetch(url, fetch_results_cb, userdata)

The developers shouldn't have to keep track of the user data (or rather, metadata pertaining to the current operation) themselves.
Comment 2 Victor Toso 2016-03-09 01:19:50 UTC
(In reply to Victor Toso from comment #0)
> This is pretty much what is being done with grl_l_callback in order to call
> grl_util_operation_spec_gc
> 
> Let's see how it goes.

This idea was naive. I was thinking about having a closure accesible during the 
operation, that could store as upvalue and return the OperationSpec. The main
issue is with multiple ongoing operations which would need to bound the closure
to the operation-id and seems messy.

The current approach is similar to what we had before, storing the OperationSpec
in the stack. I think it makes more sense to have it in the grl library instead
of _G. I also thought that it could be benefitial to have it as read-only from
Lua side, so I have created a proxy for it. 

I realized a bit late that the whole code related to the grl table and its 
metatable and metamethods could be done in an external lua file and loaded by
lua-library code. Dealing with stack operations in C is not that much of fun.
But it works for now IMHO ;)

Make test works, I did some browse with grilo-test-ui-0.3 and had some bug fixing. Let me know what you think :)

PS: I guess we can squash all revert lua-source api changes?
Comment 3 Victor Toso 2016-03-09 01:21:25 UTC
Created attachment 323443 [details] [review]
lua-factory: use wrapper for lua_pcall

Due improvements later in the patch series, it becames useful to have
such wrapper. We always call the lua_gc after lua_pcall as current logic
flow expects it.
Comment 4 Victor Toso 2016-03-09 01:21:32 UTC
Created attachment 323444 [details] [review]
lua-factory: Make grl and grl.lua read-only

By creating a proxy table with custom metatable in order to avoid
changes in grl and grl.lua by Lua sources.

The proxy redirects read access (__index metamethod) to the original
table but the write access (__newindex metamethod) triggers an error.

We still can do read-write but only internally; For this, we get a
reference to the original table using the __call metamethod. The handler
expects an userdata argument which makes nontrivial to retrieve it from
Lua sources.
Comment 5 Victor Toso 2016-03-09 01:21:40 UTC
Created attachment 323445 [details] [review]
lua-factory: introduce source state table

The major point is being able to track and retrieve ongoing Grilo
operations data under the same Lua Source.

Before d809be39ed2bbd4c410be we were using the global env in lua (_G) in
order to store the operation and retrieve it but the design of the code
was lacking improvements.
e.g. grl.fetch() and grl.unzip() were bounded to OperationSpec

After d809be39ed2bbd4c410be we removed the the OperationSpec opaque from
othe global context and utilities functions but the API changed for
that.

From now on, we will be able to move back to the former API by storing
again the operation details but without losing the benefits from
d809be39ed2bbd4c410be.

The specifics from each operation will now be stored into our
lua-library table: grl
* grl.__priv_state.current_operation hold the operation being executed;
* grl.__priv_state.operations hole a table of all ongoing operations;

The operation is defined by a state table which has three fields at the
moment:
* op_id: the unique operation id given by Grilo
* data: an userdata which points to our opaque (OperationSpec)
* state: holds a string related to the Operation state
  - running: The current ongoing operation
  - waiting: An async call is being performed
  - finalized: Callback was called and this will soon be removed by
    garbage collector
Comment 6 Victor Toso 2016-03-09 01:21:48 UTC
Created attachment 323446 [details] [review]
lua-factory: set state of all operations

This commit uses the functions introduced in previous commit in order to
track the state of each operation and save its state
Comment 7 Victor Toso 2016-03-09 01:21:55 UTC
Created attachment 323447 [details] [review]
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()"

This reverts commit d809be39ed2bbd4c410be7aa527b36902362511a.

This breaks the current plugins by changing the callback passed as
argument back to grl.callback()

This is not 100% revert. We are keeping the changes to grl.fetch and
grl.unzip.
Comment 8 Victor Toso 2016-03-09 01:22:02 UTC
Created attachment 323448 [details] [review]
Revert "lua-factory: change grl.get_media_keys() into the static table"

This reverts commit 3e409b7727f803e2be4427c7544c679373a7d926.

This breaks the current plugins by changing the static table passed as
argument back grl.get_media_keys()

This is not 100% revert. We are keeping some fixes.
Comment 9 Victor Toso 2016-03-09 01:22:11 UTC
Created attachment 323449 [details] [review]
Revert "lua-factory: change grl.get_options() into the static table"

This reverts commit 2bfcff90d589d4335105a6423616c7de61cf4c71.
Comment 10 Victor Toso 2016-03-09 01:22:37 UTC
Created attachment 323450 [details] [review]
Revert "tests: port lua-factory fake sources to new API"

This reverts commit d322e89e6e78ac7810b7eaf314421659b77d5ca7.

But keeps grl.fetch callback as function instead of string
Comment 11 Victor Toso 2016-03-09 01:22:44 UTC
Created attachment 323451 [details] [review]
Revert "lua-factory: port grl-guardianvideos.lua to the new lua system"

This reverts commit ccfa70cfe911129c8bdb936fda99dd11cc60bff4.

But keeps grl.fetch callback as function instead of string
Comment 12 Victor Toso 2016-03-09 01:22:52 UTC
Created attachment 323452 [details] [review]
Revert "lua-factory: port grl-euronews.lua to the new lua system"

This reverts commit 592bb1c7a5315e4f2582dad415e03e42f5a43cad.

But keeps grl.fetch callback as function instead of string
Comment 13 Victor Toso 2016-03-09 01:22:59 UTC
Created attachment 323453 [details] [review]
Revert "lua-factory: port grl-appletrailers.lua to the new lua system"

This reverts commit bea8e082da513d90660de84f9213a4fd9552d2eb.

But keeps grl.fetch callback as function instead of string
Comment 14 Victor Toso 2016-03-09 01:23:08 UTC
Created attachment 323454 [details] [review]
Revert "lua-factory: port grl-metrolyrics.lua to the new lua system"

This reverts commit 0e71278f1616a55e4e0a3b719abbe978a4ad71af.

But keeps grl.fetch callback as function instead of string
Comment 15 Victor Toso 2016-03-09 01:23:16 UTC
Created attachment 323455 [details] [review]
Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system"

This reverts commit 46b127a9ccee3a01f95bee47e81305238ab17f3a.
Comment 16 Victor Toso 2016-03-09 01:23:24 UTC
Created attachment 323456 [details] [review]
Revert "lua-factory: port grl-pocket.lua to the new lua system"

This reverts commit 368693b7a8599941d5bfe3b73f440e16ff115a24.

But keeps grl.fetch callback as function instead of string
Comment 17 Victor Toso 2016-03-09 01:23:31 UTC
Created attachment 323457 [details] [review]
Revert "lua-factory: port grl-spotify-cover.lua to the new lua system"

This reverts commit 9b329f3e5246477f039a1fb2b129706370237c89.

But keeps grl.fetch callback as function instead of string
Comment 18 Victor Toso 2016-03-09 01:23:39 UTC
Created attachment 323458 [details] [review]
Revert "lua-factory: port grl-radiofrance.lua to the new lua system"

This reverts commit 93547ac94797cdea6670b0d458e838bcdb578f77.

But keeps grl.fetch callback as function instead of string
Comment 19 Victor Toso 2016-03-09 01:23:47 UTC
Created attachment 323459 [details] [review]
Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system"

This reverts commit fbb244ee962ddcf483dc4c6adec30de6c2616436.

But keeps grl.fetch callback as function instead of string
Comment 20 Bastien Nocera 2016-03-09 11:26:45 UTC
Review of attachment 323443 [details] [review]:

::: src/lua-factory/grl-lua-library.c
@@ +1924,3 @@
+ * order.
+ */
+void

You should return a boolean here, with FALSE on error.

In every grl_lua_library_pcall() call, make sure to check the retval rather than whether error is set.

@@ +1931,3 @@
+{
+  if (lua_pcall (L, nargs, 0, 0)) {
+    gint error_code = (os) ? os->error_code : GRL_CORE_ERROR_OPERATION_CANCELLED;

GRL_CORE_ERROR_OPERATION_CANCELLED or G_IO_ERROR_CANCELLED?
Comment 21 Bastien Nocera 2016-03-09 15:29:03 UTC
Review of attachment 323445 [details] [review]:

::: src/lua-factory/grl-lua-library.c
@@ +64,3 @@
 } UnzipOperation;
 
+static const gchar *source_op_state_str[] = {

[NUM_STATES]?
Comment 22 Bastien Nocera 2016-03-09 15:32:23 UTC
(In reply to Victor Toso from comment #2)
> (In reply to Victor Toso from comment #0)
> > This is pretty much what is being done with grl_l_callback in order to call
> > grl_util_operation_spec_gc
> > 
> > Let's see how it goes.
> 
> This idea was naive. I was thinking about having a closure accesible during
> the 
> operation, that could store as upvalue and return the OperationSpec. The main
> issue is with multiple ongoing operations which would need to bound the
> closure
> to the operation-id and seems messy.
> 
> The current approach is similar to what we had before, storing the
> OperationSpec
> in the stack. I think it makes more sense to have it in the grl library
> instead
> of _G. I also thought that it could be benefitial to have it as read-only
> from
> Lua side, so I have created a proxy for it. 
> 
> I realized a bit late that the whole code related to the grl table and its 
> metatable and metamethods could be done in an external lua file and loaded by
> lua-library code. Dealing with stack operations in C is not that much of fun.
> But it works for now IMHO ;)
> 
> Make test works, I did some browse with grilo-test-ui-0.3 and had some bug
> fixing. Let me know what you think :)

I'm not really in a position to review all those Lua factory patches I'm afraid.

I'd just want to make sure that we still get warnings (as in 0.2.x) when a source fails to return a result, or returns a result twice, or has a syntax error.

> PS: I guess we can squash all revert lua-source api changes?

Separately would be better, and as you've already tweaked them.
Comment 23 Victor Toso 2016-03-10 13:20:45 UTC
(In reply to Bastien Nocera from comment #20)
> Review of attachment 323443 [details] [review] [review]:
> 
> ::: src/lua-factory/grl-lua-library.c
> @@ +1924,3 @@
> + * order.
> + */
> +void
> 
> You should return a boolean here, with FALSE on error.
> 
> In every grl_lua_library_pcall() call, make sure to check the retval rather
> than whether error is set.

Sure, I'll fix it

> 
> @@ +1931,3 @@
> +{
> +  if (lua_pcall (L, nargs, 0, 0)) {
> +    gint error_code = (os) ? os->error_code :
> GRL_CORE_ERROR_OPERATION_CANCELLED;
> 
> GRL_CORE_ERROR_OPERATION_CANCELLED or G_IO_ERROR_CANCELLED?

To be honest, this was a bit hacky in order to not fail at this specific commit. All grl_lua_library_pcall after patch "lua-factory: set state of all operations" should have the OperationSpec and the proper error_code related to the operation.

I'll remove this in the later patch and include an assert_nonnull (os) instead
Comment 24 Victor Toso 2016-03-10 13:26:52 UTC
(In reply to Bastien Nocera from comment #22)
> I'm not really in a position to review all those Lua factory patches I'm
> afraid.
> 
> I'd just want to make sure that we still get warnings (as in 0.2.x) when a
> source fails to return a result, or returns a result twice, or has a syntax
> error.

We are covered in the two last cases but I think we don't warn anymore if neither grl.callback() or some async function were called.

> 
> > PS: I guess we can squash all revert lua-source api changes?
> 
> Separately would be better, and as you've already tweaked them.

Okay!

Thanks for the review. I'll address this issues later today.
Comment 25 Victor Toso 2016-03-11 01:31:44 UTC
changes in v2
- grl_lua_library_pcall() is now a boolean which returns FALSE on error
- changed error_code when OperationSpec is NULL to G_IO_ERROR_CANCELLED
- enum2str array initialized with NUM_STATES value
- reused grl_lua_library_push_grl_callback to make lua-library recognize when when lua source does not call to grl.callback (or any async like grl.fetch)
- some fixes related to the rebase

wip (not attached)
- in order to have the warning when neither grl.callback or any async function like grl.fetch is called, we can push a userdata with __gc set that will check the state of source as soon as lua_gc is called
Comment 26 Victor Toso 2016-03-11 01:31:56 UTC
Created attachment 323669 [details] [review]
lua-factory: use wrapper for lua_pcall

Due improvements later in the patch series, it becames useful to have
such wrapper. We always call the lua_gc after lua_pcall as current logic
flow expects it.
Comment 27 Victor Toso 2016-03-11 01:32:06 UTC
Created attachment 323670 [details] [review]
lua-factory: Make grl and grl.lua read-only

By creating a proxy table with custom metatable in order to avoid
changes in grl and grl.lua by Lua sources.

The proxy redirects read access (__index metamethod) to the original
table but the write access (__newindex metamethod) triggers an error.

We still can do read-write but only internally; For this, we get a
reference to the original table using the __call metamethod. The handler
expects an userdata argument which makes nontrivial to retrieve it from
Lua sources.
Comment 28 Victor Toso 2016-03-11 01:32:16 UTC
Created attachment 323671 [details] [review]
lua-factory: introduce source state table

The major point is being able to track and retrieve ongoing Grilo
operations data under the same Lua Source.

Before d809be39ed2bbd4c410be we were using the global env in lua (_G) in
order to store the operation and retrieve it but the design of the code
was lacking improvements.
e.g. grl.fetch() and grl.unzip() were bounded to OperationSpec

After d809be39ed2bbd4c410be we removed the the OperationSpec opaque from
othe global context and utilities functions but the API changed for
that.

From now on, we will be able to move back to the former API by storing
again the operation details but without losing the benefits from
d809be39ed2bbd4c410be.

The specifics from each operation will now be stored into our
lua-library table: grl
* grl.__priv_state.current_operation hold the operation being executed;
* grl.__priv_state.operations hole a table of all ongoing operations;

The operation is defined by a state table which has three fields at the
moment:
* op_id: the unique operation id given by Grilo
* data: an userdata which points to our opaque (OperationSpec)
* state: holds a string related to the Operation state
  - running: The current ongoing operation
  - waiting: An async call is being performed
  - finalized: Callback was called and this will soon be removed by
    garbage collector
Comment 29 Victor Toso 2016-03-11 01:32:26 UTC
Created attachment 323672 [details] [review]
lua-factory: set state of all operations

This commit uses the functions introduced in previous commit in order to
track the state of each operation and save its state
Comment 30 Victor Toso 2016-03-11 01:32:36 UTC
Created attachment 323673 [details] [review]
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()"

This reverts commit d809be39ed2bbd4c410be7aa527b36902362511a.

This breaks the current plugins by changing the callback passed as
argument back to grl.callback()

This is not 100% revert. We are keeping the changes to grl.fetch and
grl.unzip.
Comment 31 Victor Toso 2016-03-11 01:32:46 UTC
Created attachment 323674 [details] [review]
Revert "lua-factory: change grl.get_media_keys() into the static table"

This reverts commit 3e409b7727f803e2be4427c7544c679373a7d926.

This breaks the current plugins by changing the static table passed as
argument back grl.get_media_keys()

This is not 100% revert. We are keeping some fixes.
Comment 32 Victor Toso 2016-03-11 01:32:55 UTC
Created attachment 323675 [details] [review]
Revert "lua-factory: change grl.get_options() into the static table"

This reverts commit 2bfcff90d589d4335105a6423616c7de61cf4c71.
Comment 33 Victor Toso 2016-03-11 13:01:32 UTC
Created attachment 323699 [details] [review]
Revert "lua-factory: change grl.get_options() into the static table"

This reverts commit 2bfcff90d589d4335105a6423616c7de61cf4c71.

-- changed in v3
* rebased version after pushing a few patches from Bug 732879
* grl.get_requested_keys() works as suggested by commit 72a4e9d19
Comment 34 Victor Toso 2016-03-13 23:01:23 UTC
--- changed in v4

> I'd just want to make sure that we still get warnings (as in 0.2.x) when a
> source fails to return a result, or returns a result twice, or has a syntax
> error.

* I've addressed this with the watchdog patch
* I've included unit tests about it as well

* A few other fixes as well while testing, removing a few asserts, improving a little bit the comments

besides make test, I tested a bit with grilo-test-ui-0.3

Let me know your feeling about this. Should we have more unit tests? Or some time trying to find issues with it?

PS: Attaching all the patches to not mess with the proper order of the series
Comment 35 Victor Toso 2016-03-13 23:02:08 UTC
Created attachment 323812 [details] [review]
lua-factory: use wrapper for lua_pcall

Due improvements later in the patch series, it becames useful to have
such wrapper. We always call the lua_gc after lua_pcall as current logic
flow expects it.
Comment 36 Victor Toso 2016-03-13 23:02:14 UTC
Created attachment 323813 [details] [review]
lua-factory: Make grl and grl.lua read-only

By creating a proxy table with custom metatable in order to avoid
changes in grl and grl.lua by Lua sources.

The proxy redirects read access (__index metamethod) to the original
table but the write access (__newindex metamethod) triggers an error.

We still can do read-write but only internally; For this, we get a
reference to the original table using the __call metamethod. The handler
expects an userdata argument which makes nontrivial to retrieve it from
Lua sources.
Comment 37 Victor Toso 2016-03-13 23:02:21 UTC
Created attachment 323814 [details] [review]
lua-factory: introduce source state table

The major point is being able to track and retrieve ongoing Grilo
operations data under the same Lua Source.

Before d809be39ed2bbd4c410be we were using the global env in lua (_G) in
order to store the operation and retrieve it but the design of the code
was lacking improvements.
e.g. grl.fetch() and grl.unzip() were bounded to OperationSpec

After d809be39ed2bbd4c410be we removed the the OperationSpec opaque from
othe global context and utilities functions but the API changed for
that.

From now on, we will be able to move back to the former API by storing
again the operation details but without losing the benefits from
d809be39ed2bbd4c410be.

The specifics from each operation will now be stored into our
lua-library table: grl
* grl.__priv_state.current_operation hold the operation being executed;
* grl.__priv_state.operations hole a table of all ongoing operations;

The operation is defined by a state table which has three fields at the
moment:
* op_id: the unique operation id given by Grilo
* data: an userdata which points to our opaque (OperationSpec)
* state: holds a string related to the Operation state
  - running: The current ongoing operation
  - waiting: An async call is being performed
  - finalized: Callback was called and this will soon be removed by
    garbage collector
Comment 38 Victor Toso 2016-03-13 23:02:27 UTC
Created attachment 323815 [details] [review]
lua-factory: set state of all operations

This commit uses the functions introduced in previous commit in order to
track the state of each operation and save its state
Comment 39 Victor Toso 2016-03-13 23:02:35 UTC
Created attachment 323816 [details] [review]
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()"

This reverts commit d809be39ed2bbd4c410be7aa527b36902362511a.

This breaks the current plugins by changing the callback passed as
argument back to grl.callback()

This is not 100% revert. We are keeping the changes to grl.fetch and
grl.unzip.
Comment 40 Victor Toso 2016-03-13 23:02:42 UTC
Created attachment 323817 [details] [review]
Revert "lua-factory: change grl.get_media_keys() into the static table"

This reverts commit 3e409b7727f803e2be4427c7544c679373a7d926.

This breaks the current plugins by changing the static table passed as
argument back grl.get_media_keys()

This is not 100% revert. We are keeping some fixes.
Comment 41 Victor Toso 2016-03-13 23:02:49 UTC
Created attachment 323818 [details] [review]
Revert "lua-factory: change grl.get_options() into the static table"

This reverts commit 2bfcff90d589d4335105a6423616c7de61cf4c71.
Comment 42 Victor Toso 2016-03-13 23:02:57 UTC
Created attachment 323819 [details] [review]
lua-factory: watchdog for lua-sources

This commit allow us to track broken sources such as:
* sources that never call for grl.callback()
* sources that might call grl.callback() after the operation is
  already finished

This is done by using a userdata in the top of the stack as a watchdog
for the current operation. We always push this userdata in
grl_lua_library_pcall function and it will be always freed by Lua's
garbage collection.

By attaching a finalizer function into this userdata, we can check at
the time that lua_gc is called if the state of Operation is correct.

This idea was introcued by Morse in d809be39ed2bb so I modify those
functions to work as the watchdog we need instead of grl_l_callback
closure.
Comment 43 Victor Toso 2016-03-13 23:03:05 UTC
Created attachment 323820 [details] [review]
tests: include tests for erros in lua sources

Three tests were introduced at this time:
* grl.callback is never called;
* grl.callback is called when operation is finished;
* grl.callback is not called after an async operation
Comment 44 Victor Toso 2016-03-13 23:03:13 UTC
Created attachment 323821 [details] [review]
Revert "tests: port lua-factory fake sources to new API"

This reverts commit d322e89e6e78ac7810b7eaf314421659b77d5ca7.

But keeps grl.fetch callback as function instead of string
Comment 45 Victor Toso 2016-03-13 23:03:20 UTC
Created attachment 323822 [details] [review]
Revert "lua-factory: port grl-guardianvideos.lua to the new lua system"

This reverts commit ccfa70cfe911129c8bdb936fda99dd11cc60bff4.

But keeps grl.fetch callback as function instead of string
Comment 46 Victor Toso 2016-03-13 23:03:27 UTC
Created attachment 323823 [details] [review]
Revert "lua-factory: port grl-euronews.lua to the new lua system"

This reverts commit 592bb1c7a5315e4f2582dad415e03e42f5a43cad.

But keeps grl.fetch callback as function instead of string
Comment 47 Victor Toso 2016-03-13 23:03:35 UTC
Created attachment 323824 [details] [review]
Revert "lua-factory: port grl-appletrailers.lua to the new lua system"

This reverts commit bea8e082da513d90660de84f9213a4fd9552d2eb.

But keeps grl.fetch callback as function instead of string
Comment 48 Victor Toso 2016-03-13 23:03:48 UTC
Created attachment 323825 [details] [review]
Revert "lua-factory: port grl-metrolyrics.lua to the new lua system"

This reverts commit 0e71278f1616a55e4e0a3b719abbe978a4ad71af.

But keeps grl.fetch callback as function instead of string
Comment 49 Victor Toso 2016-03-13 23:03:55 UTC
Created attachment 323826 [details] [review]
Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system"

This reverts commit 46b127a9ccee3a01f95bee47e81305238ab17f3a.
Comment 50 Victor Toso 2016-03-13 23:04:02 UTC
Created attachment 323827 [details] [review]
Revert "lua-factory: port grl-pocket.lua to the new lua system"

This reverts commit 368693b7a8599941d5bfe3b73f440e16ff115a24.

But keeps grl.fetch callback as function instead of string
Comment 51 Victor Toso 2016-03-13 23:04:10 UTC
Created attachment 323828 [details] [review]
Revert "lua-factory: port grl-spotify-cover.lua to the new lua system"

This reverts commit 9b329f3e5246477f039a1fb2b129706370237c89.

But keeps grl.fetch callback as function instead of string
Comment 52 Victor Toso 2016-03-13 23:04:26 UTC
Created attachment 323829 [details] [review]
Revert "lua-factory: port grl-radiofrance.lua to the new lua system"

This reverts commit 93547ac94797cdea6670b0d458e838bcdb578f77.

But keeps grl.fetch callback as function instead of string
Comment 53 Victor Toso 2016-03-13 23:04:34 UTC
Created attachment 323830 [details] [review]
Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system"

This reverts commit fbb244ee962ddcf483dc4c6adec30de6c2616436.

But keeps grl.fetch callback as function instead of string
Comment 54 Bastien Nocera 2016-03-17 15:02:55 UTC
Review of attachment 323812 [details] [review]:

Looks fine to me.
Comment 55 Bastien Nocera 2016-03-17 15:17:18 UTC
Review of attachment 323813 [details] [review]:

Looks fine to commit, but after the freeze.
Comment 56 Bastien Nocera 2016-03-17 15:21:25 UTC
Review of attachment 323814 [details] [review]:

Looks fine otherwise.

::: src/lua-factory/grl-lua-common.h
@@ +47,3 @@
 
+typedef enum {
+  LUA_SOURCE_RUNNING,

Make that read LUA_SOURCE_RUNNING = 0 here and...

::: src/lua-factory/grl-lua-library.c
@@ +64,3 @@
 } UnzipOperation;
 
+static const gchar *source_op_state_str[LUA_SOURCE_NUM_STATES] = {

const gchar const?
(the table is const, and so are the strings)

@@ +65,3 @@
 
+static const gchar *source_op_state_str[LUA_SOURCE_NUM_STATES] = {
+  [LUA_SOURCE_RUNNING] = "running",

you can remove the [] = stuff here.
Comment 57 Bastien Nocera 2016-03-17 15:25:05 UTC
Review of attachment 323815 [details] [review]:

I think that the states should be refcounted.

If I called grl.fetch() and grl.unzip(), or multiple grl.fetch in the same function, you'd get back to running when you get the first completion signal.
Comment 58 Bastien Nocera 2016-03-17 15:25:49 UTC
Review of attachment 323814 [details] [review]:

And as mentioned in the review of the next patch, the number of running calls needs to be refcounted.
Comment 59 Bastien Nocera 2016-03-17 15:27:06 UTC
Review of attachment 323816 [details] [review]:

> This is not 100% revert. We are keeping the changes to grl.fetch and grl.unzip.

What changes? The original commit's message was glib, and so is this one.

What are you reverting, and what are you keeping?
Comment 60 Bastien Nocera 2016-03-17 15:28:17 UTC
Review of attachment 323817 [details] [review]:

> This is not 100% revert. We are keeping some fixes.

> This breaks the current plugins by changing the static table passed as
> argument back grl.get_media_keys()

"current"? current means before or after the patch?
Comment 61 Bastien Nocera 2016-03-17 15:29:03 UTC
Review of attachment 323818 [details] [review]:

Please explain in the commit message why you're reverting it.
Comment 62 Bastien Nocera 2016-03-17 15:32:36 UTC
Review of attachment 323819 [details] [review]:

Looks fine otherwise.

::: src/lua-factory/grl-lua-library.c
@@ +2171,3 @@
+  lua_getfield (L, -1, SOURCE_OP_STATE);
+  str = lua_tostring (L, -1);
+  ret = (g_strcmp0 (str, source_op_state_str[state]) == 0);

You might want a function in the previous patch that introduces source states to get the string that corresponds to an actual LuaSourceState value, as a sanity check.
Comment 63 Bastien Nocera 2016-03-17 15:33:41 UTC
Review of attachment 323820 [details] [review]:

> tests: include tests for erros in lua sources

errors

Looks good otherwise.
Comment 64 Bastien Nocera 2016-03-17 15:34:57 UTC
And all the .lua ports look ok to commit, but please add some justification behind the reverts, and explain better what you kept.
Comment 65 Victor Toso 2016-03-21 15:52:48 UTC
Hey, sorry for taking some time. In order to have refcounted operations like, doing two grl.fetch or two grl.unzip in a row, it was necessary to improve the code a little.

As it was getting a big messy I've decided to create grl-lua-library-operations to address this work, starting from the wrapper of lua_pcall, the proxy table and all the handling of operations.

The logic is basically the same, what changed:

1-) Moved most of the code from last series to grl-lua-library-operations and better organized what should be exported to grl-lua-library.c and grl-lua-factory.c inside grl-lua-common.h

2-) In order to have the refcount (which is, indeed, a must) the watchdog becomes vital. The watchdog's finalize is the one that checks the source state and does the memory deallocation.

3-) I moved most of unit tests of errors to be in the resolve operation, which removed some code. The search operation is used for the refcount test.

4-) Regarding the read-only proxy table that should be commited after-freeze, there were some bits there necessary for the watchdog patch. What I did then, was keeping it read-write and only setting the read-only in the last patch (which could be commit-after-freeze if I'm right)

PS: Attaching all patches to make it easy to git-bz apply
Comment 66 Victor Toso 2016-03-21 15:53:49 UTC
Created attachment 324454 [details] [review]
lua-factory: use wrapper for lua_pcall

Due improvements later in the patch series, it becomes useful to have
such wrapper. We always call the lua_gc after lua_pcall as current logic
flow expects it.
Comment 67 Victor Toso 2016-03-21 15:54:12 UTC
Created attachment 324455 [details] [review]
lua-factory: Create a proxy for grl and grl.lua

By creating a proxy table with custom metatable in order to have more
control into changes make in grl and grl.lua by Lua sources.

At the moment, the proxy redirects read access (__index metamethod)
and write access (__newindex metamethod) to the original table but later
on we can remove write access from Lua sources to our library.

Internally we are should be using the __call metamethod in order to
retrieve the original table.
Comment 68 Victor Toso 2016-03-21 15:54:24 UTC
Created attachment 324456 [details] [review]
lua-factory: introduce source state table

The major point is being able to track and retrieve ongoing Grilo
operations data under the same Lua Source.

Before d809be39ed2bbd4c410be we were using the global env in lua (_G) in
order to store the operation and retrieve it but the design of the code
was lacking improvements.
e.g. grl.fetch() and grl.unzip() were bounded to OperationSpec

After d809be39ed2bbd4c410be we removed the the OperationSpec opaque from
othe global context and utilities functions but the API changed for
that.

From now on, we will be able to move back to the former API by storing
again the operation details but without losing the benefits from
d809be39ed2bbd4c410be.

The specifics from each operation will now be stored into our
lua-library table: grl
* grl.__priv_state.current_operation hold the operation being executed;
* grl.__priv_state.operations hole a table of all ongoing operations;

The operation is defined by a state table which has three fields at the
moment:
* op_id: the unique operation id given by Grilo
* data: an userdata which points to our opaque (OperationSpec)
* state: holds a string related to the Operation state
  - running: The current ongoing operation
  - waiting: An async call is being performed
  - finalized: Callback was called and this will soon be removed by
    garbage collector
Comment 69 Victor Toso 2016-03-21 15:54:35 UTC
Created attachment 324457 [details] [review]
lua-factory: set state of all operations

This commit uses the functions introduced in previous commit in order to
track the state of each operation and save its state
Comment 70 Victor Toso 2016-03-21 15:54:44 UTC
Created attachment 324458 [details] [review]
Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()"

In order to keep the previous API between Lua sources and Lua-Factory.

This reverts commit d809be39ed2bbd4c410be7aa527b36902362511a.

After applying this patch, it will break the lua sources due the API
change.  We are not passing callback as argument anymore. Lua sources
should use grl.callback().

This is not 100% revert as we are keeping a few changes to grl.fetch and
to grl.unzip:
* Both those functions are still using a lua function as callback which
  was a string before d809be39;
* Both this functions now can handle userdata as the last argument;
* For grl.fetch, the second argument is still an optional table for
  GrlNetWc;
Comment 71 Victor Toso 2016-03-21 15:54:55 UTC
Created attachment 324459 [details] [review]
Revert "lua-factory: change grl.get_media_keys() into the static table"

In order to keep the previous API between Lua sources and Lua-Factory.

This reverts commit 3e409b7727f803e2be4427c7544c679373a7d926.

This breaks the current plugins by changing the static table passed as
argument back grl.get_media_keys()

After applying this patch, it will break the lua sources due the API
change.  We are not passing an static table as GrlMedia anymore. Lua
sources should use grl.get_media_keys().

This is not 100% revert. We are keeping some fixes that was introduced
together with the api change for grilo-0.3 on grl.get_media_keys such as
using GrlMedia instead of specific types for audio, video, image and box
(which is now container)
Comment 72 Victor Toso 2016-03-21 15:55:05 UTC
Created attachment 324460 [details] [review]
Revert "lua-factory: change grl.get_options() into the static table"

In order to keep the previous API between Lua sources and Lua-Factory.

This reverts commit 2bfcff90d589d4335105a6423616c7de61cf4c71.

After applying this patch, it will break the lua sources due the API
change.  We are not passing an static table with all operation options
to the source anymore.  Lua sources should use grl.get_options() and
grl.get_requested_keys().

The main goal of reverted patch was to provide a table with all options
for the operation handler.
Comment 73 Victor Toso 2016-03-21 15:55:15 UTC
Created attachment 324461 [details] [review]
lua-factory: watchdog for lua-sources

This commit allow us to track broken sources such as:
* sources that never call for grl.callback()
* sources that might call grl.callback() after the operation is
  already finished

This is done by using a userdata in the top of the stack as a watchdog
for the current operation. We always push this userdata in
grl_lua_library_pcall function and it will be always freed by Lua's
garbage collection.

By attaching a finalize function into this userdata, we can check at
the time that lua_gc is called if the state of Operation is correct.

This idea was introduced by Morse in d809be39ed2bb so I modify those
functions to work as the watchdog we need instead of grl_l_callback
closure.
Comment 74 Victor Toso 2016-03-21 15:55:31 UTC
Created attachment 324462 [details] [review]
tests: include tests for errors in lua sources

Three tests were introduced at this time:
* grl.callback is never called;
* grl.callback is called when operation is finished;
* grl.callback is not called after an async operation
Comment 75 Victor Toso 2016-03-21 15:55:41 UTC
Created attachment 324463 [details] [review]
Revert "tests: port lua-factory fake sources to new API"

This reverts commit d322e89e6e78ac7810b7eaf314421659b77d5ca7.

But keeps grl.fetch callback as function instead of string
Comment 76 Victor Toso 2016-03-21 15:55:50 UTC
Created attachment 324464 [details] [review]
Revert "lua-factory: port grl-guardianvideos.lua to the new lua system"

This reverts commit ccfa70cfe911129c8bdb936fda99dd11cc60bff4.

But keeps grl.fetch callback as function instead of string
Comment 77 Victor Toso 2016-03-21 15:55:58 UTC
Created attachment 324465 [details] [review]
Revert "lua-factory: port grl-euronews.lua to the new lua system"

This reverts commit 592bb1c7a5315e4f2582dad415e03e42f5a43cad.

But keeps grl.fetch callback as function instead of string
Comment 78 Victor Toso 2016-03-21 15:56:07 UTC
Created attachment 324466 [details] [review]
Revert "lua-factory: port grl-appletrailers.lua to the new lua system"

This reverts commit bea8e082da513d90660de84f9213a4fd9552d2eb.

But keeps grl.fetch callback as function instead of string
Comment 79 Victor Toso 2016-03-21 15:56:17 UTC
Created attachment 324467 [details] [review]
Revert "lua-factory: port grl-metrolyrics.lua to the new lua system"

This reverts commit 0e71278f1616a55e4e0a3b719abbe978a4ad71af.

But keeps grl.fetch callback as function instead of string
Comment 80 Victor Toso 2016-03-21 15:56:26 UTC
Created attachment 324468 [details] [review]
Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system"

This reverts commit 46b127a9ccee3a01f95bee47e81305238ab17f3a.
Comment 81 Victor Toso 2016-03-21 15:56:34 UTC
Created attachment 324469 [details] [review]
Revert "lua-factory: port grl-pocket.lua to the new lua system"

This reverts commit 368693b7a8599941d5bfe3b73f440e16ff115a24.

But keeps grl.fetch callback as function instead of string
Comment 82 Victor Toso 2016-03-21 15:56:42 UTC
Created attachment 324470 [details] [review]
Revert "lua-factory: port grl-spotify-cover.lua to the new lua system"

This reverts commit 9b329f3e5246477f039a1fb2b129706370237c89.

But keeps grl.fetch callback as function instead of string
Comment 83 Victor Toso 2016-03-21 15:56:51 UTC
Created attachment 324471 [details] [review]
Revert "lua-factory: port grl-radiofrance.lua to the new lua system"

This reverts commit 93547ac94797cdea6670b0d458e838bcdb578f77.

But keeps grl.fetch callback as function instead of string
Comment 84 Victor Toso 2016-03-21 15:57:00 UTC
Created attachment 324472 [details] [review]
Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system"

This reverts commit fbb244ee962ddcf483dc4c6adec30de6c2616436.

But keeps grl.fetch callback as function instead of string
Comment 85 Victor Toso 2016-03-21 15:57:09 UTC
Created attachment 324473 [details] [review]
lua-factory: make grl and grl.lua read-only

By using the metamethod __new_index to trigger an error in case Lua
source try to use it.
Comment 86 Bastien Nocera 2016-03-21 22:35:33 UTC
Comment on attachment 324454 [details] [review]
lua-factory: use wrapper for lua_pcall

As per earlier review
Comment 87 Bastien Nocera 2016-03-21 22:36:55 UTC
Comment on attachment 324455 [details] [review]
lua-factory: Create a proxy for grl and grl.lua

To commit after the freeze, for 3.22.

It's not required for the rest of the series to work, is it?
Comment 88 Bastien Nocera 2016-03-21 22:41:58 UTC
Review of attachment 324456 [details] [review]:

We'll need a test case for that if there's not already one in the list. Please file a separate bug if necessary.

::: src/lua-factory/grl-lua-library-operations.c
@@ +561,3 @@
+
+    if (os->lua_source_waiting_ops > 0) {
+      os->lua_source_waiting_ops -= 1;

os->lua_source_waiting_ops--;

@@ +568,3 @@
+    priv_state_operations_update (L, os, state);
+
+    os->lua_source_waiting_ops += 1;

os->lua_source_waiting_ops++;
Comment 89 Bastien Nocera 2016-03-21 22:43:08 UTC
Review of attachment 324457 [details] [review]:

Looks good.
Comment 90 Bastien Nocera 2016-03-21 22:44:12 UTC
Review of attachment 324458 [details] [review]:

Great commit message! :)
Comment 91 Bastien Nocera 2016-03-21 22:45:47 UTC
Review of attachment 324459 [details] [review]:

Looks good.
Comment 92 Bastien Nocera 2016-03-21 22:47:09 UTC
Review of attachment 324460 [details] [review]:

Looks good.
Comment 93 Bastien Nocera 2016-03-21 22:49:15 UTC
Review of attachment 324461 [details] [review]:

Looks fine.
Comment 94 Bastien Nocera 2016-03-21 22:49:16 UTC
Review of attachment 324461 [details] [review]:

Looks fine.
Comment 95 Victor Toso 2016-03-21 22:49:51 UTC
(In reply to Bastien Nocera from comment #87)
> Comment on attachment 324455 [details] [review] [review]
> lua-factory: Create a proxy for grl and grl.lua
> 
> To commit after the freeze, for 3.22.


I changed the patch from last review. This introduces the proxy table but does not make it read-only so, it is the same as it was before.
 
> It's not required for the rest of the series to work, is it?

Part of the code of watchdog was relying on getting the 'original' table using the metamethod __call. I thought it wasn't the effor to change this bits as we could make the proxy read-only for 3.22 but still keep the proxy.

Does it make sense?
Comment 96 Bastien Nocera 2016-03-21 22:49:57 UTC
Review of attachment 324462 [details] [review]:

Yep.
Comment 97 Bastien Nocera 2016-03-21 22:59:05 UTC
Attachment 324454 [details] pushed as 311600c - lua-factory: use wrapper for lua_pcall
Attachment 324455 [details] pushed as 7c9315e - lua-factory: Create a proxy for grl and grl.lua
Attachment 324456 [details] pushed as 1074349 - lua-factory: introduce source state table
Attachment 324457 [details] pushed as 89add48 - lua-factory: set state of all operations
Attachment 324458 [details] pushed as fd58add - Revert "lua-factory: change grl.callback(), grl.fetch() and grl.unzip()"
Attachment 324459 [details] pushed as 500935d - Revert "lua-factory: change grl.get_media_keys() into the static table"
Attachment 324460 [details] pushed as a137919 - Revert "lua-factory: change grl.get_options() into the static table"
Attachment 324461 [details] pushed as f2860cd - lua-factory: watchdog for lua-sources
Attachment 324462 [details] pushed as c55a863 - tests: include tests for errors in lua sources
Attachment 324463 [details] pushed as 2fd5cee - Revert "tests: port lua-factory fake sources to new API"
Attachment 324464 [details] pushed as 1934fe4 - Revert "lua-factory: port grl-guardianvideos.lua to the new lua system"
Attachment 324465 [details] pushed as 6b7e154 - Revert "lua-factory: port grl-euronews.lua to the new lua system"
Attachment 324466 [details] pushed as a789a5b - Revert "lua-factory: port grl-appletrailers.lua to the new lua system"
Attachment 324467 [details] pushed as c3c5462 - Revert "lua-factory: port grl-metrolyrics.lua to the new lua system"
Attachment 324468 [details] pushed as 1310c86 - Revert "lua-factory: port grl-video-title-parsing.lua to the new lua system"
Attachment 324469 [details] pushed as ccc3b1b - Revert "lua-factory: port grl-pocket.lua to the new lua system"
Attachment 324470 [details] pushed as cee1083 - Revert "lua-factory: port grl-spotify-cover.lua to the new lua system"
Attachment 324471 [details] pushed as 2e0d1c8 - Revert "lua-factory: port grl-radiofrance.lua to the new lua system"
Attachment 324472 [details] pushed as e473ad9 - Revert "lua-factory: port grl-lastfm-cover.lua to the new lua system"
Attachment 324473 [details] pushed as 3b61064 - lua-factory: make grl and grl.lua read-only