"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "common/flatpak-transaction.c" between
flatpak-1.15.1.tar.xz and flatpak-1.15.2.tar.xz

About: Flatpak is a Linux application sandboxing and distribution framework. Pre-release.

flatpak-transaction.c  (flatpak-1.15.1.tar.xz):flatpak-transaction.c  (flatpak-1.15.2.tar.xz)
skipping to change at line 2121 skipping to change at line 2121
GFile *bundle, GFile *bundle,
FlatpakTransactionOperationType kind, FlatpakTransactionOperationType kind,
gboolean pin_on_deploy, gboolean pin_on_deploy,
GError **error) GError **error)
{ {
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (se lf); FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (se lf);
FlatpakTransactionOperation *op; FlatpakTransactionOperation *op;
g_autofree char *subpaths_str = NULL; g_autofree char *subpaths_str = NULL;
subpaths_str = subpaths_to_string (subpaths); subpaths_str = subpaths_to_string (subpaths);
g_debug ("Transaction: %s %s:%s%s%s%s", g_info ("Transaction: %s %s:%s%s%s%s",
kind_to_str (kind), remote, flatpak_decomposed_get_ref (ref), kind_to_str (kind), remote, flatpak_decomposed_get_ref (ref),
commit != NULL ? "@" : "", commit != NULL ? "@" : "",
commit != NULL ? commit : "", commit != NULL ? commit : "",
subpaths_str); subpaths_str);
op = flatpak_transaction_get_last_op_for_ref (self, ref); op = flatpak_transaction_get_last_op_for_ref (self, ref);
/* If previous_ids is given, then this is a rebase operation. */ /* If previous_ids is given, then this is a rebase operation. */
if (op != NULL && kind_compatible (kind, op->kind, previous_ids != NULL)) if (op != NULL && kind_compatible (kind, op->kind, previous_ids != NULL))
{ {
g_auto(GStrv) old_subpaths = NULL; g_auto(GStrv) old_subpaths = NULL;
g_auto(GStrv) old_previous_ids = NULL; g_auto(GStrv) old_previous_ids = NULL;
old_subpaths = op->subpaths; old_subpaths = op->subpaths;
op->subpaths = flatpak_subpaths_merge (old_subpaths, (char **) subpaths); op->subpaths = flatpak_subpaths_merge (old_subpaths, (char **) subpaths);
skipping to change at line 2192 skipping to change at line 2192
if (op->kind != FLATPAK_TRANSACTION_OPERATION_UNINSTALL) if (op->kind != FLATPAK_TRANSACTION_OPERATION_UNINSTALL)
{ {
state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remot e, NULL, error); state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remot e, NULL, error);
if (state == NULL) if (state == NULL)
return FALSE; return FALSE;
} }
if (op->resolved_metakey == NULL) if (op->resolved_metakey == NULL)
{ {
g_debug ("no resolved metadata for related to %s", flatpak_decomposed_get_ ref (op->ref)); g_info ("no resolved metadata for related to %s", flatpak_decomposed_get_r ef (op->ref));
return TRUE; return TRUE;
} }
if (transaction_is_local_only (self, op->kind)) if (transaction_is_local_only (self, op->kind))
related = flatpak_dir_find_local_related_for_metadata (priv->dir, op->ref, related = flatpak_dir_find_local_related_for_metadata (priv->dir, op->ref,
NULL, /* remote could differ from op->remote */ NULL, /* remote could differ from op->remote */
op->resolved_metakey, op->resolved_metakey,
NULL, &related_error) ; NULL, &related_error) ;
else else
related = flatpak_dir_find_remote_related_for_metadata (priv->dir, state, op ->ref, related = flatpak_dir_find_remote_related_for_metadata (priv->dir, state, op ->ref,
skipping to change at line 2345 skipping to change at line 2345
for (i = 0; remotes != NULL && remotes[i] != NULL; i++) for (i = 0; remotes != NULL && remotes[i] != NULL; i++)
{ {
const char *remote = remotes[i]; const char *remote = remotes[i];
g_autoptr(GError) local_error = NULL; g_autoptr(GError) local_error = NULL;
g_autoptr(FlatpakRemoteState) state = NULL; g_autoptr(FlatpakRemoteState) state = NULL;
state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION _OPERATION_INSTALL, remote, arch, &local_error); state = flatpak_transaction_ensure_remote_state (self, FLATPAK_TRANSACTION _OPERATION_INSTALL, remote, arch, &local_error);
if (state == NULL) if (state == NULL)
{ {
g_debug ("Can't get state for remote %s, ignoring: %s", remote, local_ error->message); g_info ("Can't get state for remote %s, ignoring: %s", remote, local_e rror->message);
continue; continue;
} }
if (flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (ru ntime_ref), NULL, NULL, NULL, NULL, NULL)) if (flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (ru ntime_ref), NULL, NULL, NULL, NULL, NULL))
g_ptr_array_add (found, g_strdup (remote)); g_ptr_array_add (found, g_strdup (remote));
} }
g_ptr_array_add (found, NULL); g_ptr_array_add (found, NULL);
return (char **) g_ptr_array_free (g_steal_pointer (&found), FALSE); return (char **) g_ptr_array_free (g_steal_pointer (&found), FALSE);
skipping to change at line 2467 skipping to change at line 2467
runtime_pref = g_key_file_get_string (op->resolved_metakey, "Application", " runtime", NULL); runtime_pref = g_key_file_get_string (op->resolved_metakey, "Application", " runtime", NULL);
else if (g_key_file_has_group (op->resolved_metakey, "Extra Data") && else if (g_key_file_has_group (op->resolved_metakey, "Extra Data") &&
!g_key_file_get_boolean (op->resolved_metakey, "Extra Data", "NoRunti me", NULL)) !g_key_file_get_boolean (op->resolved_metakey, "Extra Data", "NoRunti me", NULL))
runtime_pref = g_key_file_get_string (op->resolved_metakey, "ExtensionOf", " runtime", NULL); runtime_pref = g_key_file_get_string (op->resolved_metakey, "ExtensionOf", " runtime", NULL);
if (runtime_pref == NULL) if (runtime_pref == NULL)
return NULL; return NULL;
decomposed = flatpak_decomposed_new_from_pref (FLATPAK_KINDS_RUNTIME, runtime_ pref, NULL); decomposed = flatpak_decomposed_new_from_pref (FLATPAK_KINDS_RUNTIME, runtime_ pref, NULL);
if (decomposed == NULL) if (decomposed == NULL)
g_debug ("Invalid runtime ref %s in metadata", runtime_pref); g_info ("Invalid runtime ref %s in metadata", runtime_pref);
return decomposed; return decomposed;
} }
static FlatpakDecomposed * static FlatpakDecomposed *
op_get_sdk_ref (FlatpakTransactionOperation *op) op_get_sdk_ref (FlatpakTransactionOperation *op)
{ {
g_autofree char *sdk_pref = NULL; g_autofree char *sdk_pref = NULL;
FlatpakDecomposed *decomposed; FlatpakDecomposed *decomposed;
if (!op->resolved_metakey || !flatpak_decomposed_is_app (op->ref)) if (!op->resolved_metakey || !flatpak_decomposed_is_app (op->ref))
return NULL; return NULL;
sdk_pref = g_key_file_get_string (op->resolved_metakey, "Application", "sdk", NULL); sdk_pref = g_key_file_get_string (op->resolved_metakey, "Application", "sdk", NULL);
if (sdk_pref == NULL) if (sdk_pref == NULL)
return NULL; return NULL;
decomposed = flatpak_decomposed_new_from_pref (FLATPAK_KINDS_RUNTIME, sdk_pref , NULL); decomposed = flatpak_decomposed_new_from_pref (FLATPAK_KINDS_RUNTIME, sdk_pref , NULL);
if (decomposed == NULL) if (decomposed == NULL)
g_debug ("Invalid runtime ref %s in metadata", sdk_pref); g_info ("Invalid runtime ref %s in metadata", sdk_pref);
return decomposed; return decomposed;
} }
static gboolean static gboolean
add_new_dep_op (FlatpakTransaction *self, add_new_dep_op (FlatpakTransaction *self,
FlatpakTransactionOperation *op, FlatpakTransactionOperation *op,
FlatpakDecomposed *dep_ref, FlatpakDecomposed *dep_ref,
FlatpakTransactionOperation **dep_op, FlatpakTransactionOperation **dep_op,
GError **error) GError **error)
{ {
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (se lf); FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (se lf);
g_autofree char *dep_remote = NULL; g_autofree char *dep_remote = NULL;
if (!ref_is_installed (self, dep_ref)) if (!ref_is_installed (self, dep_ref))
{ {
g_debug ("Installing dependency %s of %s", flatpak_decomposed_get_pref (de g_info ("Installing dependency %s of %s", flatpak_decomposed_get_pref (dep
p_ref), _ref),
flatpak_decomposed_get_pref (op->ref)); flatpak_decomposed_get_pref (op->ref));
dep_remote = find_runtime_remote (self, op->ref, op->remote, dep_ref, op-> kind, NULL, error); dep_remote = find_runtime_remote (self, op->ref, op->remote, dep_ref, op-> kind, NULL, error);
if (dep_remote == NULL) if (dep_remote == NULL)
return FALSE; return FALSE;
*dep_op = flatpak_transaction_add_op (self, dep_remote, dep_ref, NULL, NUL L, NULL, NULL, *dep_op = flatpak_transaction_add_op (self, dep_remote, dep_ref, NULL, NUL L, NULL, NULL,
FLATPAK_TRANSACTION_OPERATION_INSTAL L_OR_UPDATE, FALSE, error); FLATPAK_TRANSACTION_OPERATION_INSTAL L_OR_UPDATE, FALSE, error);
if (*dep_op == NULL) if (*dep_op == NULL)
return FALSE; return FALSE;
} }
else else
{ {
/* Update if in same dir */ /* Update if in same dir */
if (dir_ref_is_installed (priv->dir, dep_ref, &dep_remote, NULL)) if (dir_ref_is_installed (priv->dir, dep_ref, &dep_remote, NULL))
{ {
g_debug ("Updating dependency %s of %s", flatpak_decomposed_get_pref ( g_info ("Updating dependency %s of %s", flatpak_decomposed_get_pref (d
dep_ref), ep_ref),
flatpak_decomposed_get_pref (op->ref)); flatpak_decomposed_get_pref (op->ref));
*dep_op = flatpak_transaction_add_op (self, dep_remote, dep_ref, NULL, NULL, NULL, NULL, *dep_op = flatpak_transaction_add_op (self, dep_remote, dep_ref, NULL, NULL, NULL, NULL,
FLATPAK_TRANSACTION_OPERATION_UP DATE, FALSE, error); FLATPAK_TRANSACTION_OPERATION_UP DATE, FALSE, error);
if (*dep_op == NULL) if (*dep_op == NULL)
return FALSE; return FALSE;
(*dep_op)->non_fatal = TRUE; (*dep_op)->non_fatal = TRUE;
} }
} }
return TRUE; return TRUE;
} }
skipping to change at line 2667 skipping to change at line 2667
if (kind == FLATPAK_TRANSACTION_OPERATION_UPDATE) if (kind == FLATPAK_TRANSACTION_OPERATION_UPDATE)
{ {
g_autoptr(GBytes) deploy_data = NULL; g_autoptr(GBytes) deploy_data = NULL;
if (!dir_ref_is_installed (priv->dir, ref, &origin, &deploy_data)) if (!dir_ref_is_installed (priv->dir, ref, &origin, &deploy_data))
return flatpak_fail_error (error, FLATPAK_ERROR_NOT_INSTALLED, return flatpak_fail_error (error, FLATPAK_ERROR_NOT_INSTALLED,
_("%s not installed"), pref); _("%s not installed"), pref);
if (flatpak_dir_get_remote_disabled (priv->dir, origin)) if (flatpak_dir_get_remote_disabled (priv->dir, origin))
{ {
g_debug (_("Remote %s disabled, ignoring %s update"), origin, pref); g_info (_("Remote %s disabled, ignoring %s update"), origin, pref);
return TRUE; return TRUE;
} }
remote = origin; remote = origin;
if (subpaths == NULL) if (subpaths == NULL)
{ {
g_autofree const char **old_subpaths = flatpak_deploy_data_get_subpath s (deploy_data); g_autofree const char **old_subpaths = flatpak_deploy_data_get_subpath s (deploy_data);
/* As stated in the documentation for flatpak_transaction_add_update() , /* As stated in the documentation for flatpak_transaction_add_update() ,
* for locale extensions we merge existing subpaths with the set of * for locale extensions we merge existing subpaths with the set of
skipping to change at line 3005 skipping to change at line 3005
return TRUE; return TRUE;
/* Update metadata for said remotes */ /* Update metadata for said remotes */
for (i = 0; remotes[i] != NULL; i++) for (i = 0; remotes[i] != NULL; i++)
{ {
char *remote = remotes[i]; char *remote = remotes[i];
gboolean updated = FALSE; gboolean updated = FALSE;
g_autoptr(GError) my_error = NULL; g_autoptr(GError) my_error = NULL;
g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_remote_st ate (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL, NULL); g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_remote_st ate (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL, NULL);
g_debug ("Looking for remote metadata updates for %s", remote); g_info ("Looking for remote metadata updates for %s", remote);
if (!flatpak_dir_update_remote_configuration (priv->dir, remote, state, &u pdated, cancellable, &my_error)) if (!flatpak_dir_update_remote_configuration (priv->dir, remote, state, &u pdated, cancellable, &my_error))
g_debug (_("Error updating remote metadata for '%s': %s"), remote, my_er ror->message); g_info (_("Error updating remote metadata for '%s': %s"), remote, my_err or->message);
if (updated) if (updated)
{ {
g_debug ("Got updated metadata for %s", remote); g_info ("Got updated metadata for %s", remote);
some_updated = TRUE; some_updated = TRUE;
} }
} }
if (some_updated) if (some_updated)
{ {
/* Reload changed configuration */ /* Reload changed configuration */
if (!flatpak_dir_recreate_repo (priv->dir, cancellable, error)) if (!flatpak_dir_recreate_repo (priv->dir, cancellable, error))
return FALSE; return FALSE;
skipping to change at line 3069 skipping to change at line 3069
g_autoptr(GFile) deploy = NULL; g_autoptr(GFile) deploy = NULL;
deploy = flatpak_dir_get_if_deployed (priv->dir, auto_install_ref, NUL L, cancellable); deploy = flatpak_dir_get_if_deployed (priv->dir, auto_install_ref, NUL L, cancellable);
if (deploy == NULL) if (deploy == NULL)
{ {
g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_r emote_state (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL, NULL); g_autoptr(FlatpakRemoteState) state = flatpak_transaction_ensure_r emote_state (self, FLATPAK_TRANSACTION_OPERATION_UPDATE, remote, NULL, NULL);
if (state != NULL && if (state != NULL &&
flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get _ref (auto_install_ref), NULL, NULL, NULL, NULL, NULL)) flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get _ref (auto_install_ref), NULL, NULL, NULL, NULL, NULL))
{ {
g_debug ("Auto adding install of %s from remote %s", flatpak_d ecomposed_get_ref (auto_install_ref), remote); g_info ("Auto adding install of %s from remote %s", flatpak_de composed_get_ref (auto_install_ref), remote);
if (!flatpak_transaction_add_ref (self, remote, auto_install_r ef, NULL, NULL, NULL, if (!flatpak_transaction_add_ref (self, remote, auto_install_r ef, NULL, NULL, NULL,
FLATPAK_TRANSACTION_OPERATIO N_INSTALL_OR_UPDATE, FLATPAK_TRANSACTION_OPERATIO N_INSTALL_OR_UPDATE,
NULL, NULL, FALSE, NULL, NULL, FALSE,
&local_error)) &local_error))
g_debug ("Failed to add auto-install ref %s: %s", flatpak_de composed_get_ref (auto_install_ref), g_info ("Failed to add auto-install ref %s: %s", flatpak_dec omposed_get_ref (auto_install_ref),
local_error->message); local_error->message);
} }
} }
} }
} }
return TRUE; return TRUE;
} }
static void static void
skipping to change at line 3143 skipping to change at line 3143
if (out_commit) if (out_commit)
*out_commit = g_strdup (flatpak_deploy_data_get_commit (deploy_data)); *out_commit = g_strdup (flatpak_deploy_data_get_commit (deploy_data));
if (out_remote) if (out_remote)
*out_remote = g_strdup (flatpak_deploy_data_get_origin (deploy_data)); *out_remote = g_strdup (flatpak_deploy_data_get_origin (deploy_data));
} }
metadata_file = g_file_get_child (deploy_dir, "metadata"); metadata_file = g_file_get_child (deploy_dir, "metadata");
if (!g_file_load_contents (metadata_file, NULL, &metadata_contents, &metadata_ contents_length, NULL, NULL)) if (!g_file_load_contents (metadata_file, NULL, &metadata_contents, &metadata_ contents_length, NULL, NULL))
{ {
g_debug ("No metadata in local deploy of %s", flatpak_decomposed_get_ref ( ref)); g_info ("No metadata in local deploy of %s", flatpak_decomposed_get_ref (r ef));
return NULL; return NULL;
} }
return g_bytes_new_take (g_steal_pointer (&metadata_contents), metadata_conten ts_length); return g_bytes_new_take (g_steal_pointer (&metadata_contents), metadata_conten ts_length);
} }
static void static void
emit_eol_and_maybe_skip (FlatpakTransaction *self, emit_eol_and_maybe_skip (FlatpakTransaction *self,
FlatpakTransactionOperation *op) FlatpakTransactionOperation *op)
{ {
skipping to change at line 3175 skipping to change at line 3175
} }
static gboolean static gboolean
mark_op_resolved (FlatpakTransactionOperation *op, mark_op_resolved (FlatpakTransactionOperation *op,
const char *commit, const char *commit,
GFile *sideload_path, GFile *sideload_path,
GBytes *metadata, GBytes *metadata,
GBytes *old_metadata, GBytes *old_metadata,
GError **error) GError **error)
{ {
g_debug ("marking op %s:%s resolved to %s", kind_to_str (op->kind), flatpak_de composed_get_ref (op->ref), commit ? commit : "-"); g_info ("marking op %s:%s resolved to %s", kind_to_str (op->kind), flatpak_dec omposed_get_ref (op->ref), commit ? commit : "-");
g_assert (op != NULL); g_assert (op != NULL);
g_assert (commit != NULL); g_assert (commit != NULL);
op->resolved = TRUE; op->resolved = TRUE;
if (op->resolved_commit != commit) if (op->resolved_commit != commit)
{ {
g_free (op->resolved_commit); /* This is already set if we retry resolving to get a token, so free first */ g_free (op->resolved_commit); /* This is already set if we retry resolving to get a token, so free first */
skipping to change at line 3476 skipping to change at line 3476
if (flatpak_dir_find_latest_rev (priv->dir, state, flatpak_decompo sed_get_ref (op->ref), op->commit, if (flatpak_dir_find_latest_rev (priv->dir, state, flatpak_decompo sed_get_ref (op->ref), op->commit,
&latest_checksum, &latest_timesta mp, &latest_sideload_path, &latest_checksum, &latest_timesta mp, &latest_sideload_path,
cancellable, &local_error)) cancellable, &local_error))
{ {
/* If we found the latest in a sideload repo, it may be older that what is locally available, check timestamps. /* If we found the latest in a sideload repo, it may be older that what is locally available, check timestamps.
* Note: If the timestamps are equal (timestamp granularity is sue), assume we want to update */ * Note: If the timestamps are equal (timestamp granularity is sue), assume we want to update */
if (latest_sideload_path != NULL && local_commit_data && lates t_timestamp != 0 && if (latest_sideload_path != NULL && local_commit_data && lates t_timestamp != 0 &&
ostree_commit_get_timestamp (local_commit_data) > latest_t imestamp) ostree_commit_get_timestamp (local_commit_data) > latest_t imestamp)
{ {
g_debug ("Installed commit %s newer than sideloaded %s, ig noring", local_checksum, latest_checksum); g_info ("Installed commit %s newer than sideloaded %s, ign oring", local_checksum, latest_checksum);
checksum = g_steal_pointer (&local_checksum); checksum = g_steal_pointer (&local_checksum);
} }
else else
{ {
/* Otherwise, use whatever we found */ /* Otherwise, use whatever we found */
checksum = g_steal_pointer (&latest_checksum); checksum = g_steal_pointer (&latest_checksum);
sideload_path = g_steal_pointer (&latest_sideload_path); sideload_path = g_steal_pointer (&latest_sideload_path);
} }
} }
else else
skipping to change at line 3534 skipping to change at line 3534
commit_data = flatpak_remote_state_load_ref_commit (state, priv->d ir, commit_data = flatpak_remote_state_load_ref_commit (state, priv->d ir,
flatpak_decomp osed_get_ref (op->ref), flatpak_decomp osed_get_ref (op->ref),
checksum, /* i nitially NULL */ op->resolved_token, checksum, /* i nitially NULL */ op->resolved_token,
NULL, NULL, &l ocal_error); NULL, NULL, &l ocal_error);
if (commit_data == NULL) if (commit_data == NULL)
{ {
if (g_error_matches (local_error, FLATPAK_HTTP_ERROR, FLATPAK_ HTTP_ERROR_UNAUTHORIZED) && !op->requested_token) if (g_error_matches (local_error, FLATPAK_HTTP_ERROR, FLATPAK_ HTTP_ERROR_UNAUTHORIZED) && !op->requested_token)
{ {
g_debug ("Unauthorized access during resolve by commit of %s, retrying with token", flatpak_decomposed_get_ref (op->ref)); g_info ("Unauthorized access during resolve by commit of % s, retrying with token", flatpak_decomposed_get_ref (op->ref));
priv->needs_resolve = TRUE; priv->needs_resolve = TRUE;
priv->needs_tokens = TRUE; priv->needs_tokens = TRUE;
/* Token type maxint32 means we don't know the type */ /* Token type maxint32 means we don't know the type */
op->token_type = G_MAXINT32; op->token_type = G_MAXINT32;
op->resolved_commit = g_strdup (checksum); op->resolved_commit = g_strdup (checksum);
g_clear_error (&local_error); g_clear_error (&local_error);
continue; continue;
} }
skipping to change at line 3620 skipping to change at line 3620
g_autoptr(FlatpakTransaction) transaction = g_object_ref (data->transaction); g_autoptr(FlatpakTransaction) transaction = g_object_ref (data->transaction);
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (tr ansaction); FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (tr ansaction);
gboolean retval = FALSE; gboolean retval = FALSE;
if (data->done) if (data->done)
return; /* Don't respond twice */ return; /* Don't respond twice */
g_assert (priv->active_request_id == 0); g_assert (priv->active_request_id == 0);
priv->active_request_id = ++priv->next_request_id; priv->active_request_id = ++priv->next_request_id;
g_debug ("Webflow start %s", arg_uri); g_info ("Webflow start %s", arg_uri);
g_signal_emit (transaction, signals[WEBFLOW_START], 0, data->remote, arg_uri, options, priv->active_request_id, &retval); g_signal_emit (transaction, signals[WEBFLOW_START], 0, data->remote, arg_uri, options, priv->active_request_id, &retval);
if (!retval) if (!retval)
{ {
g_autoptr(GError) local_error = NULL; g_autoptr(GError) local_error = NULL;
priv->active_request_id = 0; priv->active_request_id = 0;
/* We didn't handle the uri, cancel the auth op. */ /* We didn't handle the uri, cancel the auth op. */
if (!flatpak_authenticator_request_call_close_sync (data->request, NULL, & local_error)) if (!flatpak_authenticator_request_call_close_sync (data->request, NULL, & local_error))
g_debug ("Failed to close auth request: %s", local_error->message); g_info ("Failed to close auth request: %s", local_error->message);
} }
} }
static void static void
request_tokens_webflow_done (FlatpakAuthenticatorRequest *object, request_tokens_webflow_done (FlatpakAuthenticatorRequest *object,
GVariant *options, GVariant *options,
RequestData *data) RequestData *data)
{ {
g_autoptr(FlatpakTransaction) transaction = g_object_ref (data->transaction); g_autoptr(FlatpakTransaction) transaction = g_object_ref (data->transaction);
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (tr ansaction); FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (tr ansaction);
guint id; guint id;
if (data->done) if (data->done)
return; /* Don't respond twice */ return; /* Don't respond twice */
g_assert (priv->active_request_id != 0); g_assert (priv->active_request_id != 0);
id = priv->active_request_id; id = priv->active_request_id;
priv->active_request_id = 0; priv->active_request_id = 0;
g_debug ("Webflow done"); g_info ("Webflow done");
g_signal_emit (transaction, signals[WEBFLOW_DONE], 0, options, id); g_signal_emit (transaction, signals[WEBFLOW_DONE], 0, options, id);
} }
static void static void
request_tokens_basic_auth (FlatpakAuthenticatorRequest *object, request_tokens_basic_auth (FlatpakAuthenticatorRequest *object,
const gchar *arg_realm, const gchar *arg_realm,
GVariant *options, GVariant *options,
RequestData *data) RequestData *data)
{ {
g_autoptr(FlatpakTransaction) transaction = g_object_ref (data->transaction); g_autoptr(FlatpakTransaction) transaction = g_object_ref (data->transaction);
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (tr ansaction); FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (tr ansaction);
gboolean retval = FALSE; gboolean retval = FALSE;
if (data->done) if (data->done)
return; /* Don't respond twice */ return; /* Don't respond twice */
g_assert (priv->active_request_id == 0); g_assert (priv->active_request_id == 0);
priv->active_request_id = ++priv->next_request_id; priv->active_request_id = ++priv->next_request_id;
g_debug ("BasicAuth start %s", arg_realm); g_info ("BasicAuth start %s", arg_realm);
g_signal_emit (transaction, signals[BASIC_AUTH_START], 0, data->remote, arg_re alm, options, priv->active_request_id, &retval); g_signal_emit (transaction, signals[BASIC_AUTH_START], 0, data->remote, arg_re alm, options, priv->active_request_id, &retval);
if (!retval) if (!retval)
{ {
g_autoptr(GError) local_error = NULL; g_autoptr(GError) local_error = NULL;
priv->active_request_id = 0; priv->active_request_id = 0;
/* We didn't handle the request, cancel the auth op. */ /* We didn't handle the request, cancel the auth op. */
if (!flatpak_authenticator_request_call_close_sync (data->request, NULL, & local_error)) if (!flatpak_authenticator_request_call_close_sync (data->request, NULL, & local_error))
g_debug ("Failed to close auth request: %s", local_error->message); g_info ("Failed to close auth request: %s", local_error->message);
} }
} }
/** /**
* flatpak_transaction_abort_webflow: * flatpak_transaction_abort_webflow:
* @self: a #FlatpakTransaction * @self: a #FlatpakTransaction
* @id: The webflow id, as passed into the webflow-start signal * @id: The webflow id, as passed into the webflow-start signal
* *
* Cancel an ongoing webflow authentication request. This can be call * Cancel an ongoing webflow authentication request. This can be call
skipping to change at line 3717 skipping to change at line 3717
if (priv->active_request_id == id) if (priv->active_request_id == id)
{ {
RequestData *data = priv->active_request; RequestData *data = priv->active_request;
g_assert (data != NULL); g_assert (data != NULL);
priv->active_request_id = 0; priv->active_request_id = 0;
if (!data->done) if (!data->done)
{ {
if (!flatpak_authenticator_request_call_close_sync (data->request, NUL L, &local_error)) if (!flatpak_authenticator_request_call_close_sync (data->request, NUL L, &local_error))
g_debug ("Failed to close auth request: %s", local_error->message); g_info ("Failed to close auth request: %s", local_error->message);
} }
} }
} }
/** /**
* flatpak_transaction_complete_basic_auth: * flatpak_transaction_complete_basic_auth:
* @self: a #FlatpakTransaction * @self: a #FlatpakTransaction
* @id: The webflow id, as passed into the webflow-start signal * @id: The webflow id, as passed into the webflow-start signal
* @user: The user name, or %NULL if aborting request * @user: The user name, or %NULL if aborting request
* @password: The password * @password: The password
skipping to change at line 3761 skipping to change at line 3761
if (priv->active_request_id == id) if (priv->active_request_id == id)
{ {
RequestData *data = priv->active_request; RequestData *data = priv->active_request;
g_assert (data != NULL); g_assert (data != NULL);
priv->active_request_id = 0; priv->active_request_id = 0;
if (user == NULL) if (user == NULL)
{ {
if (!flatpak_authenticator_request_call_close_sync (data->request, NUL L, &local_error)) if (!flatpak_authenticator_request_call_close_sync (data->request, NUL L, &local_error))
g_debug ("Failed to abort basic auth request: %s", local_error->mess age); g_info ("Failed to abort basic auth request: %s", local_error->messa ge);
} }
else else
{ {
if (!flatpak_authenticator_request_call_basic_auth_reply_sync (data->r equest, if (!flatpak_authenticator_request_call_basic_auth_reply_sync (data->r equest,
user, p assword, user, p assword,
options , options ,
NULL, & local_error)) NULL, & local_error))
g_debug ("Failed to reply to basic auth request: %s", local_error->m essage); g_info ("Failed to reply to basic auth request: %s", local_error->me ssage);
} }
} }
} }
static void static void
copy_summary_data (GVariantBuilder *builder, GVariant *summary, const char *key) copy_summary_data (GVariantBuilder *builder, GVariant *summary, const char *key)
{ {
g_autoptr(GVariant) extensions = g_variant_get_child_value (summary, 1); g_autoptr(GVariant) extensions = g_variant_get_child_value (summary, 1);
g_autoptr(GVariant) value = NULL; g_autoptr(GVariant) value = NULL;
skipping to change at line 3855 skipping to change at line 3855
} }
g_variant_builder_add (&refs_builder, "(ssi@a{sv})", flatpak_decomposed_ge t_ref (op->ref), g_variant_builder_add (&refs_builder, "(ssi@a{sv})", flatpak_decomposed_ge t_ref (op->ref),
op->resolved_commit ? op->resolved_commit : "", (gi nt32)op->token_type, g_variant_builder_end (metadata_builder)); op->resolved_commit ? op->resolved_commit : "", (gi nt32)op->token_type, g_variant_builder_end (metadata_builder));
g_string_append_printf (refs_as_str, "(%s, %s %d)", flatpak_decomposed_get _ref (op->ref), g_string_append_printf (refs_as_str, "(%s, %s %d)", flatpak_decomposed_get _ref (op->ref),
op->resolved_commit ? op->resolved_commit : "", op ->token_type); op->resolved_commit ? op->resolved_commit : "", op ->token_type);
if (l->next != NULL) if (l->next != NULL)
g_string_append (refs_as_str, ", "); g_string_append (refs_as_str, ", ");
} }
g_debug ("Requesting tokens for remote %s: %s", remote, refs_as_str->str); g_info ("Requesting tokens for remote %s: %s", remote, refs_as_str->str);
refs = g_variant_ref_sink (g_variant_builder_end (&refs_builder)); refs = g_variant_ref_sink (g_variant_builder_end (&refs_builder));
extra_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}")); extra_builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
state = g_hash_table_lookup (priv->remote_states, remote); state = g_hash_table_lookup (priv->remote_states, remote);
if (state && state->summary) if (state && state->summary)
{ {
copy_summary_data (extra_builder, state->summary, "xa.oci-registry-uri"); copy_summary_data (extra_builder, state->summary, "xa.oci-registry-uri");
} }
skipping to change at line 3901 skipping to change at line 3901
while (!data.done) while (!data.done)
g_main_context_iteration (context, TRUE); g_main_context_iteration (context, TRUE);
g_assert (priv->active_request_id == 0); /* No outstanding requests */ g_assert (priv->active_request_id == 0); /* No outstanding requests */
priv->active_request = NULL; priv->active_request = NULL;
results = data.results; /* Make sure its freed as needed */ results = data.results; /* Make sure its freed as needed */
{ {
g_autofree char *results_str = results != NULL ? g_variant_print (results, F ALSE) : g_strdup ("NULL"); g_autofree char *results_str = results != NULL ? g_variant_print (results, F ALSE) : g_strdup ("NULL");
g_debug ("Response from request_tokens: %d - %s\n", data.response, results_s tr); g_info ("Response from request_tokens: %d - %s\n", data.response, results_st r);
} }
if (data.response == FLATPAK_AUTH_RESPONSE_CANCELLED) if (data.response == FLATPAK_AUTH_RESPONSE_CANCELLED)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED,
"User cancelled authentication request"); "User cancelled authentication request");
return FALSE; return FALSE;
} }
if (data.response != FLATPAK_AUTH_RESPONSE_OK) if (data.response != FLATPAK_AUTH_RESPONSE_OK)
skipping to change at line 4752 skipping to change at line 4752
emit_op_done (self, op, result_details); emit_op_done (self, op, result_details);
if (!priv->no_pull) if (!priv->no_pull)
*out_needs_prune = TRUE; *out_needs_prune = TRUE;
if (flatpak_decomposed_is_app (op->ref)) if (flatpak_decomposed_is_app (op->ref))
*out_needs_triggers = TRUE; *out_needs_triggers = TRUE;
} }
} }
else else
g_debug ("%s need no update", flatpak_decomposed_get_ref (op->ref)); g_info ("%s need no update", flatpak_decomposed_get_ref (op->ref));
} }
else if (op->kind == FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE) else if (op->kind == FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE)
{ {
g_autoptr(FlatpakTransactionProgress) progress = flatpak_transaction_progr ess_new (); g_autoptr(FlatpakTransactionProgress) progress = flatpak_transaction_progr ess_new ();
emit_new_op (self, op, progress); emit_new_op (self, op, progress);
if (op->resolved_metakey && !flatpak_check_required_version (flatpak_decom posed_get_ref (op->ref), if (op->resolved_metakey && !flatpak_check_required_version (flatpak_decom posed_get_ref (op->ref),
op->resolved_ metakey, error)) op->resolved_ metakey, error))
res = FALSE; res = FALSE;
else else
res = flatpak_dir_install_bundle (priv->dir, op->bundle, res = flatpak_dir_install_bundle (priv->dir, op->bundle,
 End of changes. 28 change blocks. 
36 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)