create-usb: Detect the case of partial deploys and warn/fail

We don't want to make a usb repo with e.g. just one translation.
This commit is contained in:
Alexander Larsson
2020-03-19 12:38:24 +01:00
parent 83ef801537
commit 32194f2d29

View File

@@ -120,6 +120,9 @@ add_related (GHashTable *all_refs,
if (deploy_data == NULL)
return FALSE;
if (flatpak_deploy_data_has_subpaths (deploy_data))
return flatpak_fail (error, _("Related ref '%s' is only partially installed"), ref);
commit = flatpak_deploy_data_get_commit (deploy_data);
deploy = flatpak_dir_load_deployed (dir, ref, commit, cancellable, error);
@@ -154,6 +157,13 @@ add_related (GHashTable *all_refs,
continue;
}
if (flatpak_deploy_data_has_subpaths (ext_deploy_data))
{
g_printerr (_("Warning: Omitting related ref %s because it is partially installed.\n"),
ext->ref);
continue;
}
ext_remote = flatpak_deploy_data_get_origin (ext_deploy_data);
if (ext_remote == NULL)
return FALSE;
@@ -628,6 +638,11 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE
deploy_data = flatpak_dir_get_deploy_data (dir, installed_ref, FLATPAK_DEPLOY_VERSION_ANY, cancellable, error);
if (deploy_data == NULL)
return FALSE;
if (flatpak_deploy_data_has_subpaths (deploy_data))
return flatpak_fail (error,
_("Ref '%s' is only partially installed"), installed_ref);
commit = flatpak_deploy_data_get_commit (deploy_data);
c_s = commit_and_subpaths_new (commit, NULL);