mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-03 23:04:49 -04:00
Transaction: Ensure we download the subsummary for the arch of added refs
By default we only download the main arch subsummary, so if you added a ref for some other arch it failed to find the ref. This works with the CLI, because it explicilty loads the subsummary when its trying to expand the parial ref to the full ref. However apps using libflatpak don't do that so they failed.
This commit is contained in:
@@ -513,14 +513,10 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
|
||||
g_autoptr(FlatpakRemoteState) state = NULL;
|
||||
|
||||
state = flatpak_transaction_ensure_remote_state (transaction, FLATPAK_TRANSACTION_OPERATION_INSTALL,
|
||||
remote, error);
|
||||
remote, arch, error);
|
||||
if (state == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (arch != NULL &&
|
||||
!flatpak_remote_state_ensure_subsummary (state, dir, arch, FALSE, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
refs = flatpak_dir_find_remote_refs (dir, state, id, branch, default_branch, arch,
|
||||
flatpak_get_default_arch (),
|
||||
matched_kinds, FIND_MATCHING_REFS_FLAGS_FUZZY,
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
FlatpakRemoteState *flatpak_transaction_ensure_remote_state (FlatpakTransaction *self,
|
||||
FlatpakTransactionOperationType kind,
|
||||
const char *remote,
|
||||
const char *opt_arch,
|
||||
GError **error);
|
||||
|
||||
FlatpakDecomposed * flatpak_transaction_operation_get_decomposed (FlatpakTransactionOperation *self);
|
||||
|
||||
@@ -1904,23 +1904,26 @@ FlatpakRemoteState *
|
||||
flatpak_transaction_ensure_remote_state (FlatpakTransaction *self,
|
||||
FlatpakTransactionOperationType kind,
|
||||
const char *remote,
|
||||
const char *opt_arch,
|
||||
GError **error)
|
||||
{
|
||||
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self);
|
||||
FlatpakRemoteState *state;
|
||||
g_autoptr(FlatpakRemoteState) state = NULL;
|
||||
FlatpakRemoteState *cached_state;
|
||||
|
||||
/* We don't cache local-only states, as we might later need the same state with non-local state */
|
||||
if (transaction_is_local_only (self, kind))
|
||||
return flatpak_dir_get_remote_state_local_only (priv->dir, remote, NULL, error);
|
||||
|
||||
state = g_hash_table_lookup (priv->remote_states, remote);
|
||||
if (state)
|
||||
return flatpak_remote_state_ref (state);
|
||||
|
||||
state = flatpak_dir_get_remote_state_optional (priv->dir, remote, FALSE, NULL, error);
|
||||
|
||||
if (state)
|
||||
cached_state = g_hash_table_lookup (priv->remote_states, remote);
|
||||
if (cached_state)
|
||||
state = flatpak_remote_state_ref (cached_state);
|
||||
else
|
||||
{
|
||||
state = flatpak_dir_get_remote_state_optional (priv->dir, remote, FALSE, NULL, error);
|
||||
if (state == NULL)
|
||||
return NULL;
|
||||
|
||||
g_hash_table_insert (priv->remote_states, state->remote_name, flatpak_remote_state_ref (state));
|
||||
|
||||
for (int i = 0; i < priv->extra_sideload_repos->len; i++)
|
||||
@@ -1931,7 +1934,11 @@ flatpak_transaction_ensure_remote_state (FlatpakTransaction *self,
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
if (opt_arch != NULL &&
|
||||
!flatpak_remote_state_ensure_subsummary (state, priv->dir, opt_arch, FALSE, NULL, error))
|
||||
return FALSE;
|
||||
|
||||
return g_steal_pointer (&state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2042,7 +2049,7 @@ op_get_related (FlatpakTransaction *self,
|
||||
|
||||
if (op->kind != FLATPAK_TRANSACTION_OPERATION_UNINSTALL)
|
||||
{
|
||||
state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, error);
|
||||
state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, NULL, error);
|
||||
if (state == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2189,7 +2196,7 @@ search_for_dependency (FlatpakTransaction *self,
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
g_autoptr(FlatpakRemoteState) state = NULL;
|
||||
|
||||
state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION_OPERATION_INSTALL, remote, &local_error);
|
||||
state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION_OPERATION_INSTALL, remote, NULL, &local_error);
|
||||
if (state == NULL)
|
||||
{
|
||||
g_debug ("Can't get state for remote %s: %s", remote, local_error->message);
|
||||
@@ -2510,7 +2517,9 @@ flatpak_transaction_add_ref (FlatpakTransaction *self,
|
||||
* remote to be fatal */
|
||||
if (kind != FLATPAK_TRANSACTION_OPERATION_UNINSTALL)
|
||||
{
|
||||
state = flatpak_transaction_ensure_remote_state (self, kind, remote, error);
|
||||
g_autofree char *arch = flatpak_decomposed_dup_arch (ref);
|
||||
|
||||
state = flatpak_transaction_ensure_remote_state (self, kind, remote, arch, error);
|
||||
if (state == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2793,7 +2802,7 @@ flatpak_transaction_update_metadata (FlatpakTransaction *self,
|
||||
char *remote = remotes[i];
|
||||
gboolean updated = FALSE;
|
||||
g_autoptr(GError) my_error = NULL;
|
||||
g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL);
|
||||
g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL, NULL);
|
||||
|
||||
g_debug ("Looking for remote metadata updates for %s", remote);
|
||||
if (!flatpak_dir_update_remote_configuration (priv->dir, remote, state, &updated, cancellable, &my_error))
|
||||
@@ -2854,7 +2863,7 @@ flatpak_transaction_add_auto_install (FlatpakTransaction *self,
|
||||
deploy = flatpak_dir_get_if_deployed (priv->dir, auto_install_ref, NULL, cancellable);
|
||||
if (deploy == NULL)
|
||||
{
|
||||
g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL);
|
||||
g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL, NULL);
|
||||
|
||||
if (state != NULL &&
|
||||
flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (auto_install_ref), NULL, NULL, NULL, NULL, NULL))
|
||||
@@ -3175,7 +3184,7 @@ resolve_ops (FlatpakTransaction *self,
|
||||
priv->max_op = MAX (priv->max_op, RUNTIME_INSTALL);
|
||||
}
|
||||
|
||||
state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, error);
|
||||
state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, NULL, error);
|
||||
if (state == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -4749,7 +4758,7 @@ flatpak_transaction_real_run (FlatpakTransaction *self,
|
||||
res = FALSE;
|
||||
}
|
||||
else if (op->kind != FLATPAK_TRANSACTION_OPERATION_UNINSTALL &&
|
||||
(state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, &local_error)) == NULL)
|
||||
(state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, NULL, &local_error)) == NULL)
|
||||
{
|
||||
res = FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user