build-update-repo: Add --static-delta-jobs option

We ran into some issues on flathub where a build with very large
files caused the parallel delta generation to use a lot of paging,
essentially blocking progress. This option can at least allow you
to make progress in that case, although we should ideally have
a better solution.

Closes: #2416
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2018-12-11 12:28:26 +01:00
committed by Atomic Bot
parent 4111dbadaf
commit 90dad12697
2 changed files with 14 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ static char **opt_gpg_key_ids;
static gboolean opt_prune;
static gboolean opt_generate_deltas;
static gint opt_prune_depth = -1;
static gint opt_static_delta_jobs;
static GOptionEntry options[] = {
{ "redirect-url", 0, 0, G_OPTION_ARG_STRING, &opt_redirect_url, N_("Redirect this repo to a new URL"), N_("URL") },
@@ -58,6 +59,7 @@ static GOptionEntry options[] = {
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the summary with"), N_("KEY-ID") },
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
{ "generate-static-deltas", 0, 0, G_OPTION_ARG_NONE, &opt_generate_deltas, N_("Generate delta files"), NULL },
{ "static-delta-jobs", 0, 0, G_OPTION_ARG_INT, &opt_static_delta_jobs, N_("Max parallel jobs when creating deltas (default: NUMCPUs)"), N_("NUM-JOBS") },
{ "prune", 0, 0, G_OPTION_ARG_NONE, &opt_prune, N_("Prune unused objects"), NULL },
{ "prune-depth", 0, 0, G_OPTION_ARG_INT, &opt_prune_depth, N_("Only traverse DEPTH parents for each commit (default: -1=infinite)"), N_("DEPTH") },
{ "generate-static-delta-from", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_generate_delta_from, NULL, NULL },
@@ -260,7 +262,7 @@ spawn_delete_generation (GMainContext *context,
g_assert (i <= G_N_ELEMENTS (argv));
while (*n_spawned_delta_generate > g_get_num_processors ())
while (*n_spawned_delta_generate >= opt_static_delta_jobs)
g_main_context_iteration (context, TRUE);
subprocess = g_subprocess_launcher_spawnv (launcher, argv, error);
@@ -421,6 +423,9 @@ flatpak_builtin_build_update_repo (int argc, char **argv,
if (argc < 2)
return usage_error (context, _("LOCATION must be specified"), error);
if (opt_static_delta_jobs <= 0)
opt_static_delta_jobs = g_get_num_processors ();
location = argv[1];
repofile = g_file_new_for_commandline_arg (location);

View File

@@ -154,6 +154,14 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--static-delta-jobs=NUM-JOBS</option></term>
<listitem><para>
Limit the number of parallel jobs creating static deltas. The default is the number of cpus.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--prune</option></term>