[gnome-builder] flatpak: Don't run flatpak-build-init unnecessarily
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: Don't run flatpak-build-init unnecessarily
- Date: Thu, 17 Nov 2016 04:38:55 +0000 (UTC)
commit ea68a09fd79c43671dad7ea5f8bb6bbf9eb5670c
Author: Matthew Leeds <mleeds redhat com>
Date: Wed Nov 16 22:34:14 2016 -0600
flatpak: Don't run flatpak-build-init unnecessarily
This commit prevents us from running flatpak-build-init on a build
directory that's already been initialized (which is an error). It also
means we don't run flatpak-builder in that case. An unresolved question
is how to detect if the dependencies have changed (which would mean
the build dir should be deleted and flatpak-builder should be re-run).
plugins/flatpak/gbp-flatpak-runtime.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runtime.c b/plugins/flatpak/gbp-flatpak-runtime.c
index f085f54..656f0f3 100644
--- a/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/plugins/flatpak/gbp-flatpak-runtime.c
@@ -110,6 +110,7 @@ gbp_flatpak_runtime_prebuild_worker (GTask *task,
g_autofree gchar *flatpak_repo_path = NULL;
g_autoptr(GFile) build_dir = NULL;
g_autoptr(GFile) flatpak_repo_dir = NULL;
+ g_autoptr(GFile) metadata_file = NULL;
g_autoptr(IdeSubprocessLauncher) launcher = NULL;
g_autoptr(IdeSubprocessLauncher) launcher2 = NULL;
g_autoptr(IdeSubprocess) process = NULL;
@@ -185,6 +186,16 @@ gbp_flatpak_runtime_prebuild_worker (GTask *task,
ide_configuration_set_internal_object (configuration, "flatpak-repo-dir", flatpak_repo_dir);
+ /* Check if flatpak build-init has been run by checking for the metadata file */
+ metadata_file = g_file_new_for_path (g_build_filename (build_path, "metadata", NULL));
+ g_assert (metadata_file != NULL);
+ if (g_file_query_exists (metadata_file, cancellable))
+ {
+ g_task_return_boolean (task, TRUE);
+ return;
+ }
+
+ /* Now run either flatpak-builder or flatpak build-init */
if (self->manifest != NULL)
{
gchar *manifest_path;
@@ -280,8 +291,11 @@ gbp_flatpak_runtime_prebuild_worker (GTask *task,
return;
}
ide_build_result_log_subprocess (build_result, process2);
- /* If the directory is already initialized, don't fail */
- ide_subprocess_wait (process2, cancellable, NULL);
+ if (!ide_subprocess_wait_check (process2, cancellable, &error))
+ {
+ g_task_return_error (task, g_steal_pointer (&error));
+ return;
+ }
g_task_return_boolean (task, TRUE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]