Commit Graph

15 Commits

Author SHA1 Message Date
Alexander Larsson
6088c7d0a1 dir: Add support for getting remote state using only caches
If only_cached is TRUE we never do any network i/o, instead
returning ERROR_NOT_CACHED if this is necessary.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Matthew Leeds
2274242301 transaction: Refuse to let root modify a user repo
If the user (erroneously) runs as root while modifying their user
installation, e.g. with "sudo flatpak --user install ...", this can
cause "permission denied" errors later on when they try to operate on
the installation as their own user. So refuse to execute a transaction
on a user-owned installation as root. Root can still operate on their
own per-user installation.

This approach does have a weakness: if flatpak is running as root when the user
installation is first created, it will be owned by root and therefore
avoid this check. I'm not sure what could be done about that.

Fixes https://github.com/flatpak/flatpak/issues/2565

Closes: #2575
Approved by: alexlarsson
2019-01-17 07:40:29 +00:00
Matthias Clasen
92b0ad5f7e Handle out-of-space errors nicer
Ostree just gives us a generic G_IO_ERROR_FAILED (boo!),
so we need to scrape the message to infer that this was
out-of-space. Translate this to an explicit error code
that we handle in the UI.

Closes: #2477
Approved by: alexlarsson
2019-01-11 13:46:31 +00:00
Matthias Clasen
56d975f8c4 Add a few more error codes
Add FLATPAK_ERROR_INVALID_DATA and use if for cases where
the incoming data for an update or install is faulty, and
add FLATPAK_ERROR_UNTRUSTED, FLATPAK_ERROR_SETUP_FAILED and
FLATPAK_ERROR_EXPORT_FAILED to cover more error conditions.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
38eebef90c Avoid flatpak_fail in ref parsing
Add an error code for invalid refs, and use it when
composing or decomposing refs.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
c284777d61 Add more api docs for libflatpak
Bring the library docs much closer to completion.

Closes: #2053
Approved by: alexlarsson
2018-09-03 10:31:51 +00:00
Matthew Leeds
fb989a62a1 common: Add and use FLATPAK_ERROR_DOWNGRADE
This will be useful in distinguishing downgrade errors from other
errors, which I'll need in the next commit.

Closes: #1965
Approved by: alexlarsson
2018-08-20 06:58:01 +00:00
Matthew Leeds
1ff0cf8c16 common: Register all FlatpakError codes as D-Bus errors
This will allow us to return anything in the FlatpakError domain using
g_dbus_method_invocation_return_gerror().

Closes: #1965
Approved by: alexlarsson
2018-08-20 06:58:01 +00:00
Alexander Larsson
50fd8aee24 Add FLATPAK_ERROR_RUNTIME_NOT_FOUND error 2018-07-10 19:26:16 +02:00
Alexander Larsson
0ac154e913 lib: Add FLATPAK_ERROR_REMOTE_NOT_FOUND error
And return it where we look up remotes.

Partial fix of #1855
2018-07-10 19:26:16 +02:00
Alexander Larsson
df3a0c444b deploy: Do required-version check on deploy too
We only checked this in transaction. This is now the recommended way to installation
via libflatpak too, but if you use the old API this check also ensures that
installation fails if the required version is too old.

Also, we add a specific error code for this so callers can check for it.

Fixes https://github.com/flatpak/flatpak/issues/881

Closes: #1755
Approved by: alexlarsson
2018-06-04 13:30:00 +00:00
Alexander Larsson
2642b55e91 libflatpak: Guard public headers for individual includes 2018-05-29 16:37:21 +02:00
Alexander Larsson
9b8024326b transaction: Move operation errors, aborting and skipping to CLI
We add an error signal to Transaction that the calle (cli) handles. It
decides what to do with the error and whether to continue or abort.

A new error ABORTED is returned from flatpak_run() to indicate
that it errored out because you chose to abort. We also add a new
error SKIPPED that we use to report that some operation is skipped
(due to earlier errors).

This also means we remote the stop_on_first_error argument
from flatpak_transaction_run() as this is now controlled by
the caller.
2018-05-29 16:37:21 +02:00
Alexander Larsson
fd846875a2 transaction: Move already-installed skip:ing to from FlatpakTransaction to CLI 2018-05-29 16:37:21 +02:00
Alexander Larsson
efb92704fe Merge lib/* into common
This moves all the files from lib into common, and it also adds all the libflatpak
sources into libflatpak-common, making libflatpak just a wrapper around the common
helper library.

This move allows the CLI to use all the code from libflatpak. We were already doing
this with a few things like flatpak-error*.[ch], and we want to do it even more
when sharing FlatpakTransaction. This also allows use to slowly move
the CLI to using the libflatpak apis for some things.

Closes: #1706
Approved by: alexlarsson
2018-05-24 11:59:52 +00:00