[gnome-builder] flatpak: reap staging directory when rebuilding



commit 93054b3b883ee0cd479176722fba4227b2bf10ed
Author: Christian Hergert <chergert redhat com>
Date:   Sun Mar 11 18:54:33 2018 -0700

    flatpak: reap staging directory when rebuilding
    
    We don't want to leave any lingering files around here, so reap the entire
    staging directory so we recreate it when rebuilding.

 src/plugins/flatpak/gbp-flatpak-pipeline-addin.c | 26 ++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c 
b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index 67640539d..c5c843fc3 100644
--- a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -236,6 +236,21 @@ check_for_build_init_files (IdeBuildStage    *stage,
     }
 }
 
+static void
+reap_staging_dir (IdeBuildStage      *stage,
+                  DzlDirectoryReaper *reaper,
+                  const gchar        *staging_dir)
+{
+  g_autoptr(GFile) dir = NULL;
+
+  g_assert (IDE_IS_BUILD_STAGE (stage));
+  g_assert (DZL_IS_DIRECTORY_REAPER (reaper));
+  g_assert (staging_dir != NULL);
+
+  dir = g_file_new_for_path (staging_dir);
+  dzl_directory_reaper_add_directory (reaper, dir, 0);
+}
+
 static gboolean
 register_build_init_stage (GbpFlatpakPipelineAddin  *self,
                            IdeBuildPipeline         *pipeline,
@@ -328,6 +343,17 @@ register_build_init_stage (GbpFlatpakPipelineAddin  *self,
                          (GClosureNotify)g_free,
                          0);
 
+  /*
+   * When reaping the build, during a rebuild, make sure we wipe
+   * out the stagint directory too.
+   */
+  g_signal_connect_data (stage,
+                         "reap",
+                         G_CALLBACK (reap_staging_dir),
+                         g_strdup (staging_dir),
+                         (GClosureNotify)g_free,
+                         0);
+
   stage_id = ide_build_pipeline_connect (pipeline,
                                          IDE_BUILD_PHASE_PREPARE,
                                          PREPARE_BUILD_INIT,


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