Flatpak.Transaction¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
The installation instance |
||
r/w/en |
The installation instance |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Flatpak.Transaction(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new_for_installation(installation, cancellable)¶
- Parameters:
installation (
Flatpak.Installation
) – aFlatpak.Installation
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
a
Flatpak.Transaction
, orNone
on failure.- Return type:
Creates a new
Flatpak.Transaction
object that can be used to do installation and updates of multiple refs, as well as their dependencies, in a single operation. Set the options you want on the transaction and add the refs you want to install/update, then start the transaction withFlatpak.Transaction.run
().
- abort_webflow(id)¶
- Parameters:
id (
int
) – The webflow id, as passed into the webflow-start signal
Cancel an ongoing webflow authentication request. This can be call in the time between
Flatpak.Transaction
::webflow-start
returnedTrue
, andFlatpak.Transaction
::webflow-done
is emitted. It will cancel the ongoing authentication operation.This is useful for example if you’re showing an authenticaion window with a browser, but the user closed it before it was finished.
New in version 1.5.1.
- add_default_dependency_sources()¶
Similar to
Flatpak.Transaction.add_dependency_source
(), but adds all the default installations, which means all the defined system-wide (but not per-user) installations.
- add_dependency_source(installation)¶
- Parameters:
installation (
Flatpak.Installation
) – aFlatpak.Installation
Adds an extra installation as a source for application dependencies. This means that applications can be installed in this transaction relying on runtimes from this additional installation (whereas it would normally install required runtimes that are not installed in the installation the transaction works on).
Also see
Flatpak.Transaction.add_default_dependency_sources
().
- add_install(remote, ref, subpaths)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Adds installing the given ref to this transaction.
The remote can either be a configured remote of the installation, or a file:// uri pointing at a local repository to install from, in which case an origin remote is created.
- add_install_bundle(file, gpg_data)¶
- Parameters:
gpg_data (
GLib.Bytes
orNone
) – GPG key with which to check bundle signatures, orNone
to use the key embedded in the bundle (if any)
- Raises:
- Returns:
- Return type:
Adds installing the given bundle to this transaction.
- add_install_flatpakref(flatpakref_data)¶
- Parameters:
flatpakref_data (
GLib.Bytes
) – data from a flatpakref file- Raises:
- Returns:
- Return type:
Adds installing the given flatpakref to this transaction.
- add_rebase(remote, ref, subpaths, previous_ids)¶
- Parameters:
remote (
str
) – the name of the remoteref (
str
) – the refsubpaths (
str
orNone
) – the subpaths to include, orNone
to install the complete refprevious_ids ([
str
] orNone
) – Previous ids to add to the given ref. These should simply be the ids, not the full ref names (e.g. org.foo.Bar, not org.foo.Bar/x86_64/master).
- Raises:
- Returns:
- Return type:
Adds updating the previous_ids of the given ref to this transaction, via either installing the ref if it was not already present or updating it. This will treat ref as the result of following an eol-rebase, and data migration from the refs in previous_ids will be set up.
See
Flatpak.Transaction.add_install
() for a description of remote.New in version 1.3.3..
- add_sideload_repo(path)¶
- Parameters:
path (
str
) – a path to a local flatpak repository
Adds an extra local ostree repo as source for installation. This is equivalent to using the sideload-repos directories (see flatpak(1)), but can be done dynamically. Any path added here is used in addition to ones in those directories.
New in version 1.7.1.
- add_uninstall(ref)¶
- Parameters:
ref (
str
) – the ref- Raises:
- Returns:
- Return type:
Adds uninstalling the given ref to this transaction. If the transaction is set to not deploy updates, the request is ignored.
- add_update(ref, subpaths, commit)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Adds updating the given ref to this transaction.
- complete_basic_auth(id, user, password, options)¶
- Parameters:
Finishes (or aborts) an ongoing basic auth request.
New in version 1.5.2.
- get_auto_install_debug()¶
-
Gets the value set by
Flatpak.Transaction.set_auto_install_debug
().New in version 1.13.3.
- get_auto_install_sdk()¶
-
Gets the value set by
Flatpak.Transaction.set_auto_install_sdk
().New in version 1.13.3.
- get_current_operation()¶
- Returns:
the current
Flatpak.TransactionOperation
- Return type:
Gets the current operation.
- get_include_unused_uninstall_ops()¶
-
Gets the value set by
Flatpak.Transaction.set_include_unused_uninstall_ops
().New in version 1.9.1.
- get_installation()¶
- Returns:
- Return type:
Gets the installation this transaction was created for.
- get_no_deploy()¶
-
Gets whether the transaction is only downloading updates, and not deploying them.
New in version 1.5.1.
- get_no_interaction()¶
-
Gets whether the transaction is interactive. See
Flatpak.Transaction.set_no_interaction
().New in version 1.13.0.
- get_no_pull()¶
-
Gets whether the transaction should operate only on locally available data.
New in version 1.5.1.
- get_operation_for_ref(remote, ref)¶
- Parameters:
- Raises:
- Returns:
the
Flatpak.TransactionOperation
for ref, orNone
with error set- Return type:
Gets the operation for ref, if any match. If remote is non-
None
, only an operation for that remote will be returned. If remote isNone
and the transaction has more than one operation for ref from different remotes, an error will be returned.New in version 1.13.3.
- get_operations()¶
- Returns:
a
GLib.List
of operations- Return type:
Gets the list of operations. Skipped operations are not included. The order of the list is the order in which the operations are executed.
- get_parent_window()¶
-
Gets the parent window set for this transaction, or
None
if unset. SeeFlatpak.Transaction.get_parent_window
().New in version 1.5.1.
- is_empty()¶
-
Returns whether the transaction contains any non-skipped operations.
- run(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
- Return type:
Executes the transaction.
During the course of the execution, various signals will get emitted. The
Flatpak.Transaction
::choose-remote-for-ref
andFlatpak.Transaction
::add-new-remote
signals may get emitted while resolving operations.Flatpak.Transaction
::ready
is emitted when the transaction has been fully resolved, andFlatpak.Transaction
::new-operation
andFlatpak.Transaction
::operation-done
are emitted while the operations are carried out. If an error occurs at any point during the execution,Flatpak.Transaction
::operation-error
is emitted.Note that this call blocks until the transaction is done.
- set_auto_install_debug(auto_install_debug)¶
- Parameters:
auto_install_debug (
bool
) – whether to auto install debug info for apps
When this is set to
True
, Flatpak will automatically install the debug info for each app currently being installed or updated, as well as its dependencies. Does nothing if an uninstall is taking place.New in version 1.13.3.
- set_auto_install_sdk(auto_install_sdk)¶
- Parameters:
auto_install_sdk (
bool
) – whether to auto install SDKs for apps
When this is set to
True
, Flatpak will automatically install the SDK for each app currently being installed or updated. Does nothing if an uninstall is taking place.New in version 1.13.3.
- set_default_arch(arch)¶
- Parameters:
arch (
str
) – the arch to make default
Sets the architecture to default to where it is unspecified.
- set_disable_auto_pin(disable_pin)¶
- Parameters:
disable_pin (
bool
) – whether to disable auto-pinning
Normally the transaction pins any explicit installations so they will not be automatically removed. But this can be disabled if you don’t want this behaviour.
New in version 1.9.1.
- set_disable_dependencies(disable_dependencies)¶
- Parameters:
disable_dependencies (
bool
) – whether to disable runtime dependencies
Sets whether the transaction should ignore runtime dependencies when resolving operations for applications.
- set_disable_prune(disable_prune)¶
- Parameters:
disable_prune (
bool
) – whether to avoid pruning
Sets whether the transaction should avoid pruning the local OSTree repository after updating.
- Parameters:
disable_related (
bool
) – whether to avoid adding related refs
Sets whether the transaction should avoid adding related refs when resolving operations. Related refs are extensions that are suggested by apps, such as locales.
- set_disable_static_deltas(disable_static_deltas)¶
- Parameters:
disable_static_deltas (
bool
) – whether to avoid static deltas
Sets whether the transaction should avoid using static deltas when pulling.
- set_force_uninstall(force_uninstall)¶
- Parameters:
force_uninstall (
bool
) – whether to force-uninstall refs
Sets whether the transaction should uninstall files even if they’re used by a running application.
- set_include_unused_uninstall_ops(include_unused_uninstall_ops)¶
- Parameters:
include_unused_uninstall_ops (
bool
) – whether to include unused uninstall ops
When this is set to
True
, Flatpak will add uninstall operations to the transaction for each runtime it considers unused. This is used by the “update” CLI command to garbage collect runtimes and free disk space.No guarantees are made about the exact hueristic used; e.g. only end-of-life unused runtimes may be uninstalled with this set. To see the full list of unused runtimes in an installation, use
Flatpak.Installation.list_unused_refs
().New in version 1.9.1.
- set_no_deploy(no_deploy)¶
- Parameters:
no_deploy (
bool
) – whether to avoid deploying
Sets whether the transaction should download updates, but not deploy them.
- set_no_interaction(no_interaction)¶
- Parameters:
no_interaction (
bool
) – Whether to disallow interactive authorization for operations
This method can be used to prevent interactive authorization dialogs to appear for operations on self. This is useful for background operations that are not directly triggered by a user action.
By default, the setting from the parent
Flatpak.Installation
is used.New in version 1.7.3.
- set_no_pull(no_pull)¶
- Parameters:
no_pull (
bool
) – whether to avoid pulls
Sets whether the transaction should operate only on locally available data.
- set_parent_window(parent_window)¶
- Parameters:
parent_window (
str
) – whether to avoid pulls
Sets the parent window (if any) to use for any UI show by this transaction. This is used by authenticators if they need to interact with the user during authentication.
The format of this string depends on the display system in use, and is the same as used by xdg-desktop-portal.
On X11 it should be of the form x11:$xid where $xid is the hex version of the xwindows id.
On wayland is should be wayland:$handle where handle is gotten by using the export call of the xdg-foreign-unstable wayland extension.
New in version 1.5.1.
- set_reinstall(reinstall)¶
- Parameters:
reinstall (
bool
) – whether to reinstall refs
Sets whether the transaction should uninstall first if a ref is already installed.
- do_add_new_remote(reason, from_id, remote_name, url) virtual¶
- Parameters:
reason (
Flatpak.TransactionRemoteReason
) –from_id (
str
) –remote_name (
str
) –url (
str
) –
- Return type:
- do_basic_auth_start(remote, realm, options, id) virtual¶
- Parameters:
remote (
str
) –realm (
str
) –options (
GLib.Variant
) –id (
int
) –
- Return type:
- do_choose_remote_for_ref(for_ref, runtime_ref, remotes) virtual¶
- do_end_of_lifed_with_rebase(remote, ref, reason, rebased_to_ref, previous_ids) virtual¶
- do_install_authenticator(remote, authenticator_ref) virtual¶
- do_new_operation(operation, progress) virtual¶
- Parameters:
operation (
Flatpak.TransactionOperation
) –progress (
Flatpak.TransactionProgress
) –
- do_operation_done(operation, commit, details) virtual¶
- Parameters:
operation (
Flatpak.TransactionOperation
) –commit (
str
) –details (
Flatpak.TransactionResult
) –
- do_operation_error(operation, error, detail) virtual¶
- Parameters:
operation (
Flatpak.TransactionOperation
) –error (
GLib.Error
) –detail (
Flatpak.TransactionErrorDetails
) –
- Return type:
- do_run(cancellable) virtual¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Returns:
- Return type:
Executes the transaction.
During the course of the execution, various signals will get emitted. The
Flatpak.Transaction
::choose-remote-for-ref
andFlatpak.Transaction
::add-new-remote
signals may get emitted while resolving operations.Flatpak.Transaction
::ready
is emitted when the transaction has been fully resolved, andFlatpak.Transaction
::new-operation
andFlatpak.Transaction
::operation-done
are emitted while the operations are carried out. If an error occurs at any point during the execution,Flatpak.Transaction
::operation-error
is emitted.Note that this call blocks until the transaction is done.
- do_webflow_done(options, id) virtual¶
- Parameters:
options (
GLib.Variant
) –id (
int
) –
Signal Details¶
- Flatpak.Transaction.signals.add_new_remote(transaction, reason, from_id, suggested_remote_name, url)¶
- Signal Name:
add-new-remote
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signalreason (
Flatpak.TransactionRemoteReason
) – AFlatpak.TransactionRemoteReason
for this suggestionfrom_id (
str
) – The id of the app/runtimesuggested_remote_name (
str
) – The suggested remote nameurl (
str
) – The repo url
- Returns:
True
to add the remote- Return type:
The
::add-new-remote
signal gets emitted if, as part of the transaction, it is required or recommended that a new remote is added, for the reason described in reason.
- Flatpak.Transaction.signals.basic_auth_start(transaction, remote, realm, options, id)¶
- Signal Name:
basic-auth-start
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signalremote (
str
) – The remote we’re authenticating withrealm (
str
) – The url to showoptions (
GLib.Variant
) – Extra options, currently unusedid (
int
) – The id of the operation, can be used to finish it
- Return type:
The
::basic-auth-start
signal gets emitted when a basic user/password authentication is needed during the operation. If the caller handles this it should ask the user for the user and password and returnTrue
. Once the information is gathered callFlatpak.Transaction.complete_basic_auth
() with it.If the client does not support basic auth then return
False
from this signal (or don’t implement it). This will abort the authentication and likely result in the transaction failing (unless the authentication was somehow optional).New in version 1.5.2.
- Flatpak.Transaction.signals.choose_remote_for_ref(transaction, for_ref, runtime_ref, remotes)¶
- Signal Name:
choose-remote-for-ref
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signalfor_ref (
str
) – The ref we are installingruntime_ref (
str
) – The ref we are looking forremotes ([
str
]) – the remotes that has the ref, sorted in prio order
- Returns:
the index of the remote to use, or -1 to not pick one (and fail)
- Return type:
The
::choose-remote-for-ref
signal gets emitted when a remote needs to be selected during the execution of the transaction.
- Flatpak.Transaction.signals.end_of_lifed(transaction, ref, reason, rebase)¶
- Signal Name:
end-of-lifed
- Flags:
- Parameters:
The
::end-of-lifed
signal gets emitted when a ref is found to be marked as end-of-life during the execution of the transaction.
- Flatpak.Transaction.signals.end_of_lifed_with_rebase(transaction, remote, ref, reason, rebased_to_ref, previous_ids)¶
- Signal Name:
end-of-lifed-with-rebase
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signalremote (
str
) – The remote for the ref we are processingref (
str
) – The ref we are processingprevious_ids ([
str
]) – The previous names for the rebased ref (if any), including the one from ref
- Returns:
True
if the operation on this end-of-lifed ref should be skipped (e.g. because the rebased ref has been added to the transaction),False
if it should remain.- Return type:
The
::end-of-lifed-with-rebase
signal gets emitted when a ref is found to be marked as end-of-life before the transaction begins. UnlikeFlatpak.Transaction
::end-of-lifed
, this signal allows for the transaction to be modified in order to e.g. install the rebased ref.If the caller wants to install the rebased ref, they should call
Flatpak.Transaction.add_uninstall
() on ref,Flatpak.Transaction.add_rebase
() on rebased_to_ref, and returnTrue
. OtherwiseFalse
may be returned.New in version 1.3.2.
- Flatpak.Transaction.signals.install_authenticator(transaction, remote, authenticator_ref)¶
- Signal Name:
install-authenticator
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signalremote (
str
) – The remote nameauthenticator_ref (
str
) – The ref for the authenticator
The
::install-authenticator
signal gets emitted if, as part of resolving the transaction, we need to use an authenticator, but the authentication is not installed, but is available to be installed from the ref.The application can handle this signal, and if so create another transaction to install the authenticator.
The default handler does nothing, and if the authenticator is not installed when the signal handler fails the transaction will error out.
New in version 1.8.0.
- Flatpak.Transaction.signals.new_operation(transaction, operation, progress)¶
- Signal Name:
new-operation
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signaloperation (
Flatpak.TransactionOperation
) – The newFlatpak.TransactionOperation
progress (
Flatpak.TransactionProgress
) – AFlatpak.TransactionProgress
for operation
The
::new-operation
signal gets emitted during the execution of the transaction when a new operation is beginning.
- Flatpak.Transaction.signals.operation_done(transaction, operation, commit, result)¶
- Signal Name:
operation-done
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signaloperation (
Flatpak.TransactionOperation
) – TheFlatpak.TransactionOperation
which finishedresult (
Flatpak.TransactionResult
) – AFlatpak.TransactionResult
giving details about the result
The
::operation-done
signal gets emitted during the execution of the transaction when an operation is finished.
- Flatpak.Transaction.signals.operation_error(transaction, operation, error, details)¶
- Signal Name:
operation-error
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signaloperation (
Flatpak.TransactionOperation
) – TheFlatpak.TransactionOperation
which failederror (
GLib.Error
) – AGLib.Error
details (
Flatpak.TransactionErrorDetails
) – AFlatpak.TransactionErrorDetails
with details about the error
- Returns:
- Return type:
The
::operation-error
signal gets emitted when an error occurs during the execution of the transaction.
- Flatpak.Transaction.signals.ready(transaction)¶
- Signal Name:
ready
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signal- Returns:
- Return type:
The
::ready
signal is emitted when all the refs involved in the operation have been resolved to commits, and the required authentication for all ops is gotten. At this pointFlatpak.Transaction.get_operations
() will return all the operations that will be executed as part of the transaction.
- Flatpak.Transaction.signals.ready_pre_auth(transaction)¶
- Signal Name:
ready-pre-auth
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signal- Returns:
- Return type:
The
::ready-pre-auth
signal is emitted when all the refs involved in the transaction have been resolved to commits, but we might not necessarily have asked for authentication for all their required operations. This is very similar to the::ready
signal, and you can choose which one (or both) to use depending on how you want to handle authentication in your user interface.At this point
Flatpak.Transaction.get_operations
() will return all the operations that will be executed as part of the transaction. You can callFlatpak.TransactionOperation.get_requires_authentication
() to see which will require authentication.New in version 1.9.1.
- Flatpak.Transaction.signals.webflow_done(transaction, options, id)¶
- Signal Name:
webflow-done
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signaloptions (
GLib.Variant
) – Extra options, currently unusedid (
int
) – The id of the operation
The
::webflow-done
signal gets emitted when the authentication finished the webflow, independent of the reason and results. If you for were showing a web-browser window it can now be closed.New in version 1.5.1.
- Flatpak.Transaction.signals.webflow_start(transaction, remote, url, options, id)¶
- Signal Name:
webflow-start
- Flags:
- Parameters:
transaction (
Flatpak.Transaction
) – The object which received the signalremote (
str
) – The remote we’re authenticating withurl (
str
) – The url to showoptions (
GLib.Variant
) – Extra options, currently unusedid (
int
) – The id of the operation, can be used to cancel it
- Return type:
The
::webflow-start
signal gets emitted when some kind of user authentication is needed during the operation. If the caller handles this it should show the url in a webbrowser and returnTrue
. This will eventually cause the webbrowser to finish the authentication operation and operation will continue, as signaled by the webflow-done being emitted.If the client does not support webflow then return
False
from this signal (or don’t implement it). This will abort the authentication and likely result in the transaction failing (unless the authentication was somehow optional).During the time between webflow-start and webflow-done the client can call
Flatpak.Transaction.abort_webflow
() to manually abort the authentication. This is useful if the user aborted the authentication operation some way, like e.g. closing the browser window.New in version 1.5.1.
Property Details¶
- Flatpak.Transaction.props.installation¶
- Name:
installation
- Type:
- Default Value:
- Flags:
The installation that the transaction operates on.
- Flatpak.Transaction.props.no_interaction¶
- Name:
no-interaction
- Type:
- Default Value:
- Flags:
True
if the transaction is not interactive,False
otherwise.See
Flatpak.Transaction.set_no_interaction
().New in version 1.13.0.