bin/delta-compilation: Add a "progress bar" for bsdiff generation
It's the slowest part, let's show admins something. This "update every 10%" code was copied from the fsck command; obviously a better approach would be "progress every N seconds" but doing that somewhat accurately requires making things async; not worth it here yet. Closes: #1314 Approved by: jlebon
This commit is contained in:
parent
62445166fc
commit
e885d029aa
|
|
@ -1145,12 +1145,20 @@ generate_delta_lowlatency (OstreeRepo *repo,
|
||||||
|
|
||||||
/* Now do bsdiff'ed objects */
|
/* Now do bsdiff'ed objects */
|
||||||
|
|
||||||
|
const guint n_bsdiff = g_hash_table_size (bsdiff_optimized_content_objects);
|
||||||
|
if (n_bsdiff > 0)
|
||||||
|
{
|
||||||
|
const guint mod = n_bsdiff / 10;
|
||||||
g_hash_table_iter_init (&hashiter, bsdiff_optimized_content_objects);
|
g_hash_table_iter_init (&hashiter, bsdiff_optimized_content_objects);
|
||||||
while (g_hash_table_iter_next (&hashiter, &key, &value))
|
while (g_hash_table_iter_next (&hashiter, &key, &value))
|
||||||
{
|
{
|
||||||
const char *checksum = key;
|
const char *checksum = key;
|
||||||
ContentBsdiff *bsdiff = value;
|
ContentBsdiff *bsdiff = value;
|
||||||
|
|
||||||
|
if (opts & DELTAOPT_FLAG_VERBOSE &&
|
||||||
|
(mod == 0 || builder->n_bsdiff % mod == 0))
|
||||||
|
g_printerr ("processing bsdiff: [%u/%u]\n", builder->n_bsdiff, n_bsdiff);
|
||||||
|
|
||||||
if (!process_one_bsdiff (repo, builder, ¤t_part,
|
if (!process_one_bsdiff (repo, builder, ¤t_part,
|
||||||
checksum, bsdiff,
|
checksum, bsdiff,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
|
|
@ -1158,6 +1166,7 @@ generate_delta_lowlatency (OstreeRepo *repo,
|
||||||
|
|
||||||
builder->n_bsdiff++;
|
builder->n_bsdiff++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Scan for large objects, so we can fall back to plain HTTP-based
|
/* Scan for large objects, so we can fall back to plain HTTP-based
|
||||||
* fetch.
|
* fetch.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue