Commit 49732fd0 authored by Christian Hergert's avatar Christian Hergert
Browse files

flatpak: reap old builds from flatpak-builder/builds

We want to free up disk space from old builds that aren't doing us any
favors by lingering around. So we can reap these at startup for anything
older than 3 days.

Sometimes it's helpful to dive into the directory to see why a build fails,
but beyond a few days, I can't justify a reason to keep them around.
parent f6de4a66
......@@ -410,6 +410,8 @@ gbp_flatpak_application_addin_load (IdeApplicationAddin *addin,
IdeApplication *application)
{
GbpFlatpakApplicationAddin *self = (GbpFlatpakApplicationAddin *)addin;
g_autoptr(DzlDirectoryReaper) reaper = NULL;
g_autoptr(GFile) builds_dir = NULL;
IDE_ENTRY;
......@@ -421,6 +423,19 @@ gbp_flatpak_application_addin_load (IdeApplicationAddin *addin,
gbp_flatpak_application_addin_remove_old_repo (self, NULL, NULL);
gbp_flatpak_application_addin_reload (self);
/*
* Cleanup old build data to avoid an ever-growing cache directory.
* Any build data older than 3 days can be wiped.
*/
reaper = dzl_directory_reaper_new ();
builds_dir = g_file_new_build_filename (g_get_user_cache_dir (),
ide_get_program_name (),
"flatpak-builder",
"build",
NULL);
dzl_directory_reaper_add_directory (reaper, builds_dir, G_TIME_SPAN_DAY * 3);
dzl_directory_reaper_execute_async (reaper, NULL, NULL, NULL);
IDE_EXIT;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment