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 772898 - runtime: Add a postinstall_async vfunc and call it from the build system
runtime: Add a postinstall_async vfunc and call it from the build system
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-13 22:27 UTC by Matthew Leeds
Modified: 2016-10-14 00:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
runtime: Add a postinstall_async vfunc to IdeRuntime (5.92 KB, patch)
2016-10-13 22:27 UTC, Matthew Leeds
accepted-commit_now Details | Review
autotools: Call the runtime's postinstall hook when necessary (6.16 KB, patch)
2016-10-13 22:27 UTC, Matthew Leeds
reviewed Details | Review

Description Matthew Leeds 2016-10-13 22:27:20 UTC
This function will be useful when certain tasks only need to happen for
installs and not builds.
Comment 1 Matthew Leeds 2016-10-13 22:27:24 UTC
Created attachment 337672 [details] [review]
runtime: Add a postinstall_async vfunc to IdeRuntime

Runtimes may need to do something when an install finishes (for example
the flatpak runtime will run "flatpak install..."), so this
commit adds a virtual function for that.
Comment 2 Matthew Leeds 2016-10-13 22:27:28 UTC
Created attachment 337673 [details] [review]
autotools: Call the runtime's postinstall hook when necessary

1. Add an install property to IdeAutotoolsBuildTask.
2. Properly initialize that property in IdeAutotoolsBuilder.
3. Call either ide_runtime_postbuild_async or
  ide_runtime_postinstall_async from the build task depending on the situation.
Comment 3 Christian Hergert 2016-10-13 23:12:42 UTC
Review of attachment 337673 [details] [review]:

Just a quick thing, then go ahead and push.

::: plugins/autotools/ide-autotools-build-task.c
@@ +158,3 @@
+static void
+ide_autotools_build_task_set_install (IdeAutotoolsBuildTask *self,
+                                                gboolean               install)

fix whitespace

@@ -744,2 +781,4 @@
 
-  if (!ide_runtime_postbuild_finish (runtime, result, &error))
+  self = g_task_get_source_object (task);
+  g_assert (IDE_IS_AUTOTOOLS_BUILD_TASK (self));
+

I think this can be simplified a bit like:

 gboolean ret;

 if (self->install)
   ret = ide_runtime_postintsall_finish (...)
 else
   ret = ide_runtime_postbuild_finish (...);

if (!ret)
  g_task_return_error (task, g_steal_pointer (&error));
else
  g_task_return_boolean (task, TRUE);
Comment 4 Matthew Leeds 2016-10-14 00:05:21 UTC
Pushed as 703f8ff89135c91952947d652a46340469cd5f67 and 60fa28d9c2d74e41c9c67b4f21fc9f6b72fa2914