flatpak-builtins-repair.c (flatpak-1.15.1.tar.xz) | : | flatpak-builtins-repair.c (flatpak-1.15.2.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 358 | skipping to change at line 358 | |||
/* | /* | |||
* Try to repair a flatpak directory: | * Try to repair a flatpak directory: | |||
* + Delete any mirror refs which may be leaking disk space | * + Delete any mirror refs which may be leaking disk space | |||
* (https://github.com/flatpak/flatpak/issues/3222) | * (https://github.com/flatpak/flatpak/issues/3222) | |||
* + Scan all locally available refs | * + Scan all locally available refs | |||
* + remove ref that don't correspond to a deployed ref | * + remove ref that don't correspond to a deployed ref | |||
* + Verify the commits they point to and all object they reference: | * + Verify the commits they point to and all object they reference: | |||
* + Remove any invalid objects | * + Remove any invalid objects | |||
* + Note any missing objects | * + Note any missing objects | |||
* + Any refs that had invalid object, or non-partial refs that had missing o | * + Any refs that had invalid object, or non-partial refs that had missing | |||
bjects are removed | * objects are removed | |||
* + prune (depth=0) all object not references by a ref, which gets rid of an | * + Prune (depth=0) all object not references by a ref, which gets rid of | |||
y possibly invalid non-scanned objects | * any possibly invalid non-scanned objects | |||
* * Remove leftover .removed contents | * * Remove leftover .removed contents | |||
* + Enumerate all deployed refs: | * + Enumerate all deployed refs: | |||
* + if they are not in the repo (or is partial for a non-subdir deploy), r | * If they are not in the repo (or is partial for a non-subdir deploy), | |||
e-install them (pull + deploy) | * re-install them (pull + deploy) | |||
*/ | */ | |||
if (!flatpak_dir_delete_mirror_refs (dir, opt_dry_run, cancellable, error)) | if (!flatpak_dir_delete_mirror_refs (dir, opt_dry_run, cancellable, error)) | |||
return FALSE; | return FALSE; | |||
object_status_cache = g_hash_table_new_full (ostree_hash_object_name, g_varian t_equal, | object_status_cache = g_hash_table_new_full (ostree_hash_object_name, g_varian t_equal, | |||
(GDestroyNotify) g_variant_unref, NULL); | (GDestroyNotify) g_variant_unref, NULL); | |||
/* Validate that the commit for each ref is available */ | /* Validate that the commit for each ref is available */ | |||
if (!ostree_repo_list_refs (repo, NULL, &all_refs, cancellable, error)) | if (!ostree_repo_list_refs (repo, NULL, &all_refs, cancellable, error)) | |||
skipping to change at line 402 | skipping to change at line 405 | |||
continue; | continue; | |||
origin = flatpak_dir_get_origin (dir, ref, cancellable, NULL); | origin = flatpak_dir_get_origin (dir, ref, cancellable, NULL); | |||
/* If so, is it deployed, and from this remote? */ | /* If so, is it deployed, and from this remote? */ | |||
if (remote == NULL || g_strcmp0 (origin, remote) != 0) | if (remote == NULL || g_strcmp0 (origin, remote) != 0) | |||
{ | { | |||
if (!opt_dry_run) | if (!opt_dry_run) | |||
{ | { | |||
g_print (_("Removing non-deployed ref %s…\n"), refspec); | g_print (_("Removing non-deployed ref %s…\n"), refspec); | |||
(void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL, | (void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL, | |||
cancellable, NULL); | cancellable, NULL); | |||
} | } | |||
else | else | |||
g_print (_("Skipping non-deployed ref %s…\n"), refspec); | g_print (_("Skipping non-deployed ref %s…\n"), refspec); | |||
continue; | continue; | |||
} | } | |||
/* When printing progress, we have to print a newline character at the end, | /* When printing progress, we have to print a newline character at the end, | |||
otherwise errors printing in | * otherwise errors printing in sections of the code that we don't control | |||
sections of the code that we don't control won't have a leading newline. | * won't have a leading newline. Therefore, the status line will always | |||
Therefore, the status line will | * print a trailing newline, and here we just go up a line back onto the | |||
always print a trailing newline, and here we just go up a line back onto | * previous progress line. | |||
the previous progress line. | ||||
* This does also mean that other areas of this code section that print | ||||
This does also mean that other areas of this code section that print erro | * errors will need to print a trailing newline as well, otherwise the | |||
rs will need to print a trailing | * output will overwrite any errors. | |||
newline as well, otherwise the output will overwrite any errors. */ | */ | |||
if (flatpak_fancy_output ()) | if (flatpak_fancy_output () && i != 1) | |||
g_print ("\033[A\r\033[K"); | g_print ("\033[A\r\033[K"); | |||
g_print (_("[%d/%d] Verifying %s…\n"), i, g_hash_table_size (all_refs), refs pec); | g_print (_("[%d/%d] Verifying %s…\n"), i, g_hash_table_size (all_refs), refs pec); | |||
status = fsck_commit (repo, checksum, object_status_cache); | status = fsck_commit (repo, checksum, object_status_cache); | |||
if (status != FSCK_STATUS_OK) | if (status != FSCK_STATUS_OK) | |||
{ | { | |||
if (opt_dry_run) | if (opt_dry_run) | |||
g_printerr (_("Dry run: ")); | g_printerr (_("Dry run: ")); | |||
skipping to change at line 443 | skipping to change at line 451 | |||
case FSCK_STATUS_HAS_INVALID_OBJECTS: | case FSCK_STATUS_HAS_INVALID_OBJECTS: | |||
g_printerr (_("Deleting ref %s due to invalid objects\n"), refspec); | g_printerr (_("Deleting ref %s due to invalid objects\n"), refspec); | |||
break; | break; | |||
default: | default: | |||
g_printerr (_("Deleting ref %s due to %d\n"), refspec, status); | g_printerr (_("Deleting ref %s due to %d\n"), refspec, status); | |||
break; | break; | |||
} | } | |||
if (!opt_dry_run) | if (!opt_dry_run) | |||
(void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL, ca | (void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL, | |||
ncellable, NULL); | cancellable, NULL); | |||
/* If using fancy output, print another trailing newline, so the next pr | /* If using fancy output, print another trailing newline, so the next | |||
ogress line won't overwrite | * progress line won't overwrite these errors. | |||
these errors. */ | */ | |||
if (flatpak_fancy_output () && i < g_hash_table_size (all_refs)) | if (flatpak_fancy_output () && i < g_hash_table_size (all_refs)) | |||
g_print ("\n"); | g_print ("\n"); | |||
} | } | |||
} | } | |||
g_print (_("Checking remotes...\n")); | g_print (_("Checking remotes...\n")); | |||
GLNX_HASH_TABLE_FOREACH_KV (all_refs, const char *, refspec, const char *, che cksum) | GLNX_HASH_TABLE_FOREACH_KV (all_refs, const char *, refspec, const char *, che cksum) | |||
{ | { | |||
g_autofree char *remote = NULL; | g_autofree char *remote = NULL; | |||
End of changes. 6 change blocks. | ||||
24 lines changed or deleted | 24 lines changed or added |