forked from Mirrors/flatpak-builder
builder: Pass down global cleanups via BuildContext
parent
5896b5ae08
commit
1b2ed4fe09
|
@ -44,6 +44,7 @@ struct BuilderContext {
|
|||
|
||||
BuilderOptions *options;
|
||||
gboolean keep_build_dirs;
|
||||
char **cleanup;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -70,6 +71,7 @@ builder_context_finalize (GObject *object)
|
|||
g_clear_object (&self->soup_session);
|
||||
g_clear_object (&self->options);
|
||||
g_free (self->arch);
|
||||
g_strfreev (self->cleanup);
|
||||
|
||||
G_OBJECT_CLASS (builder_context_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -261,6 +263,20 @@ builder_context_set_keep_build_dirs (BuilderContext *self,
|
|||
self->keep_build_dirs = keep_build_dirs;
|
||||
}
|
||||
|
||||
void
|
||||
builder_context_set_global_cleanup (BuilderContext *self,
|
||||
const char **cleanup)
|
||||
{
|
||||
g_strfreev (self->cleanup);
|
||||
self->cleanup = g_strdupv ((char **)cleanup);
|
||||
}
|
||||
|
||||
const char **
|
||||
builder_context_get_global_cleanup (BuilderContext *self)
|
||||
{
|
||||
return (const char **)self->cleanup;
|
||||
}
|
||||
|
||||
gboolean
|
||||
builder_context_get_keep_build_dirs (BuilderContext *self)
|
||||
{
|
||||
|
|
|
@ -48,10 +48,14 @@ int builder_context_get_n_cpu (BuilderContext *self);
|
|||
void builder_context_set_keep_build_dirs (BuilderContext *self,
|
||||
gboolean keep_build_dirs);
|
||||
gboolean builder_context_get_keep_build_dirs (BuilderContext *self);
|
||||
void builder_context_set_global_cleanup (BuilderContext *self,
|
||||
const char **cleanup);
|
||||
const char ** builder_context_get_global_cleanup (BuilderContext *self);
|
||||
BuilderOptions *builder_context_get_options (BuilderContext *self);
|
||||
void builder_context_set_options (BuilderContext *self,
|
||||
BuilderOptions *option);
|
||||
|
||||
|
||||
BuilderContext *builder_context_new (GFile *base_dir,
|
||||
GFile *app_dir);
|
||||
|
||||
|
|
|
@ -682,6 +682,7 @@ builder_manifest_build (BuilderManifest *self,
|
|||
GList *l;
|
||||
|
||||
builder_context_set_options (context, self->build_options);
|
||||
builder_context_set_global_cleanup (context, (const char **)self->cleanup);
|
||||
|
||||
g_print ("Starting build of %s\n", self->app_id ? self->app_id : "app");
|
||||
for (l = self->modules; l != NULL; l = l->next)
|
||||
|
@ -926,7 +927,7 @@ builder_manifest_cleanup (BuilderManifest *self,
|
|||
{
|
||||
BuilderModule *m = l->data;
|
||||
|
||||
builder_module_cleanup_collect (m, self->cleanup, to_remove_ht);
|
||||
builder_module_cleanup_collect (m, context, to_remove_ht);
|
||||
}
|
||||
|
||||
keys = (char **)g_hash_table_get_keys_as_array (to_remove_ht, &n_keys);
|
||||
|
|
|
@ -1034,11 +1034,12 @@ builder_module_set_changes (BuilderModule *self,
|
|||
|
||||
void
|
||||
builder_module_cleanup_collect (BuilderModule *self,
|
||||
char **global_patterns,
|
||||
BuilderContext *context,
|
||||
GHashTable *to_remove_ht)
|
||||
{
|
||||
GPtrArray *changed_files;
|
||||
int i, j;
|
||||
const char **global_patterns = builder_context_get_global_cleanup (context);
|
||||
|
||||
changed_files = self->changes;
|
||||
for (i = 0; i < changed_files->len; i++)
|
||||
|
|
|
@ -60,7 +60,6 @@ gboolean builder_module_build (BuilderModule *self,
|
|||
gboolean builder_module_update (BuilderModule *self,
|
||||
BuilderContext *context,
|
||||
GError **error);
|
||||
|
||||
void builder_module_checksum (BuilderModule *self,
|
||||
BuilderCache *cache,
|
||||
BuilderContext *context);
|
||||
|
@ -68,10 +67,9 @@ void builder_module_checksum_for_cleanup (BuilderModule *self,
|
|||
BuilderCache *cache,
|
||||
BuilderContext *context);
|
||||
void builder_module_cleanup_collect (BuilderModule *self,
|
||||
char **global_patterns,
|
||||
BuilderContext *context,
|
||||
GHashTable *to_remove_ht);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderModule, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in New Issue