[gnome-builder] flatpak: Detect when the flatpak-builder step fails in a build



commit 5e4b1ca31594a8d91cac59c5453cdf00edba2957
Author: Matthew Leeds <mleeds redhat com>
Date:   Thu Dec 15 15:56:27 2016 -0600

    flatpak: Detect when the flatpak-builder step fails in a build
    
    Currently, the flatpak plugin assumes that if flatpak-build-init has
    been run we can move on past the prebuild step. But if flatpak-builder
    runs build-init successfully but then fails when building one of the
    modules, we need to be sure to try running it again for the next build.
    This commit detects whether flatpak-builder completed succesfully by
    creating a file in the build directory; hopefully we can figure out a
    more robust solution at some point.

 plugins/flatpak/gbp-flatpak-runtime.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runtime.c b/plugins/flatpak/gbp-flatpak-runtime.c
index 8edb205..82c885a 100644
--- a/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/plugins/flatpak/gbp-flatpak-runtime.c
@@ -389,11 +389,21 @@ gbp_flatpak_runtime_prebuild_worker (GTask        *task,
         }
 
       /* No need to run flatpak-builder if there are no dependencies */
-      if (!already_ran_build_init && has_multiple_modules)
+      if (has_multiple_modules)
         {
           g_autoptr(IdeSubprocessLauncher) launcher5 = NULL;
           g_autoptr(IdeSubprocess) process5 = NULL;
+          g_autoptr(GFile) success_file = NULL;
           g_autofree gchar *stop_at_option = NULL;
+          g_autofree gchar *success_filename = NULL;
+
+          success_filename = g_build_filename (build_path, "flatpak-builder-success", NULL);
+          success_file = g_file_new_for_path (success_filename);
+          if (g_file_query_exists (success_file, cancellable))
+            {
+              g_task_return_boolean (task, TRUE);
+              return;
+            }
 
           /* Run flatpak-builder to build just the dependencies */
           launcher5 = IDE_RUNTIME_CLASS (gbp_flatpak_runtime_parent_class)->create_launcher (IDE_RUNTIME 
(self), &error);
@@ -423,6 +433,12 @@ gbp_flatpak_runtime_prebuild_worker (GTask        *task,
               return;
             }
 
+          /*
+           * Make a file indicating that flatpak-builder finished successfully,
+           * so we know whether to run it for the next build.
+           */
+          g_object_unref (g_file_create (success_file, 0, cancellable, NULL));
+
           g_task_return_boolean (task, TRUE);
           return;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]