Commit Graph

1848 Commits

Author SHA1 Message Date
Alexander Larsson
1ee132e70e oci authenticator: Accept the right docker manifest when authenticating
Without this I got for the fedora registry:

```
getting token for https://registry.fedoraproject.org/v2/f32/flatpak-runtime/manifests/sha256:bd83b4f6974094848efac22b933419c1dbe11b553def148a82f821faf595de8a
F: Anonymous authentication failed: Unexpected response status 404 from repo
```
2020-05-04 16:32:22 +02:00
Alexander Larsson
fdfcae7a91 By default, always try to auth to OCI remotes
This makes for instance docker hub work.
2020-05-04 16:32:22 +02:00
Abderrahim Kitouni
d145723fe3 dir: set cache directory when creating child repos 2020-05-04 12:15:21 +02:00
David Edmundson
e481e3ea58 Rename registered cgroups to have app- prefix
The newly added https://systemd.io/DESKTOP_ENVIRONMENTS/ lists an XDG
defined specification for how cgroups for applications should be named.

This will allow flatpak's to correctly follow any drop-in's set for
applications on the system as well as help next-gen system monitor's
treat flatpaks as applications.

flatpak-session-helper.service is unaffected.
2020-05-04 12:07:24 +02:00
Philip Withnall
82d0a3f50a flatpak-transaction: Change related_to_op to related_to_ops
Since a single runtime (for example) can be related-to several apps,
that needs to be representable in the data format.

This is an API break, but only of API which has not been released yet.

See https://github.com/flatpak/flatpak/pull/3568#issuecomment-618251958

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-30 13:14:45 +01:00
Philip Withnall
1c2024dc8d flatpak-transaction: Clarify units in documentation
While it can be worked out from the context, it’s clearer to state the
units that download and installed sizes are calculated in explicitly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-23 10:13:19 +02:00
Philip Withnall
b743ca6478 flatpak-transaction: Clarify some documentation around skipped ops
Make it explicit that skipped ops are excluded when returning the ops in
a transaction, or when working out whether it’s empty.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-23 10:13:19 +02:00
Philip Withnall
5824668418 flatpak-transaction: Add flatpak_transaction_operation_get_is_skipped()
This exposes the `skip` member of `FlatpakTransactionOperation`, as it’s
needed for callers to usefully traverse the operation graph (which is
now accessible using
`flatpak_transaction_operation_get_related_to_op()`).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-23 10:13:19 +02:00
Philip Withnall
d51e7468e1 dir: Fix a typo in a flags enum name
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-04-23 09:56:35 +02:00
Matthew Leeds
129d72e667 transaction: Fix a typo in a comment 2020-04-16 09:22:11 +02:00
Matthew Leeds
e847bb31b6 installation: Re-implement list_installed_refs_for_update()
Re-implement flatpak_installation_list_installed_refs_for_update() using
a FlatpakTransaction, so we can guarantee it always gives the same set
of things to update as the update command. This API is used by GNOME
Software and many times in the past g-s has not shown the same list of
apps to be updated as the flatpak CLI. See:
- https://gitlab.gnome.org/GNOME/gnome-software/issues/539
- https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/430

This commit also expands the unit tests for this API, which were already
quite good. Now we test that missing subpaths of locale extensions show
up as updates, and updates that have been pulled but not deployed show
up as well. The latter is a break from how this function used to behave,
but it seems unlikely to break any application.
2020-04-16 09:22:11 +02:00
Matthew Leeds
f61f9d17da transaction: Use correct subpaths for locales
Currently, if you add an app update to a transaction and its locale
extension does not have subpaths installed for every configured
language, the locale will be updated accordingly. But if you add only
the locale extension to the transaction to be updated, the transaction
is a no-op because we treat subpaths == NULL to mean the currently
installed set of subpaths, and
flatpak_dir_needs_update_for_commit_and_subpaths() decides there's
nothing to do.

This doesn't seem like the right behavior, so update
flatpak_transaction_add_ref() so that we take the configured set of
locales into account as we do in add_related().

This will help the unit test in the following commit to pass.
2020-04-16 09:22:11 +02:00
Matthew Leeds
e6b906f842 transaction: Add transaction_operation_get_related_to_op()
This will be used in the following commit, so we can track what
installed thing needs an update when there's a transaction operation to
e.g. install its missing runtime or extension.
2020-04-16 09:22:11 +02:00
Matthew Leeds
56071df5fb installation: Replace some debug statements
These were committed recently by accident; use g_debug() instead.
2020-04-16 09:22:11 +02:00
Jan Grulich
f3c0d3e87f CUPS socket: do not print error when we found CUPS server 2020-04-16 08:54:44 +02:00
Alexander Larsson
b4b72b8de2 Use extra-data download size from summary if available
This avoids an extra download when new new extra-data information is
available in the summary.
2020-04-03 16:45:45 +02:00
Alexander Larsson
bf0bd3874b Add extra data download size to sparse cache in summary
This adds the nr of extra datas, as well as the total size in the sparse
cache for all refs that has them. This is what we need for in the download,
and having it in the summary means we don't have to separately download
the commit.

Additionally we add a cache version field to the summary so that we
can know if we can rely on the existance of the new data.
2020-04-03 16:27:33 +02:00
Alexander Larsson
3eaec588d7 Don't always create commitpartial files in child repos
We used to always create a commitpartial file in child repo, because
ostree doesn't follow parent repos when loading commitpartial state,
and when the commit was in the parent repo it would find the commit
but no commitpartial and assume the commit was complete and do nothing.

However, having a commitpartial file seems to break delta downloads in
ostree, as per: https://github.com/ostreedev/ostree/issues/2053
causing us to download too much data when using deltas.

So, we now only create a commitpartial if there is one in the parent
repo.  This still means we will get the ostree problems in case there
is one, but in the much more common case we avoid the issue.

In order to "fix" the uncommon case we also (separately) cap the
reported progress at 100%. (We should probably also fix the upstream
ostree issue too.)
2020-04-03 12:56:59 +02:00
Alexander Larsson
ee702c8a91 Remove outdated comments
We no longer create a transaction in flatpak_dir_setup_extra_data since
203a10ae25, so don't claim to.
2020-04-03 12:55:44 +02:00
Alexander Larsson
a154b7d28a Progress: Artificially limit progress to 100%
Due to bugs in ostree (see
e.g. https://github.com/flatpak/flatpak/pull/3524) it sometimes
happens that we download more data than we expect to. This isn't
great, but when it happens its better to limit the progress to 100%
anyway to avoid breaking apps (for example, the flatpak CLI doesn't
really handle this very well).
2020-04-03 12:53:16 +02:00
Alexander Larsson
203a10ae25 Revert "Revert "extra-data: Simplify extra-data progress setup""
This reverts commit 2120b99ac6.
2020-04-03 09:32:21 +02:00
Alexander Larsson
401cd4b2a5 Merge pull request #3523 from flatpak/fix-install-gpg-error
Fix "Can't pull from untrusted non-gpg verified remote" error
2020-04-01 15:56:34 +02:00
Matthew Leeds
2120b99ac6 Revert "extra-data: Simplify extra-data progress setup"
This reverts commit 6deb23a322.

This commit has two unintended side effects:
1. It breaks progress bars
(https://github.com/flatpak/flatpak/issues/3448)
2. It causes us not to use static deltas
2020-03-30 16:58:14 -07:00
Matthew Leeds
8571111e13 dir: Reload remote state after migrating config
Fixes https://github.com/flatpak/flatpak/issues/3496
2020-03-30 14:07:46 -07:00
Matthew Leeds
e7fd267ac7 common: Delete no longer relevant comment 2020-03-30 13:55:47 -07:00
Alexander Larsson
b28271bb5e Merge pull request #3498 from alexlarsson/use-symlinks-for-sideload-config
Use symlinks instead of xa.sideload-repos config option
2020-03-30 16:03:54 +02:00
Alexander Larsson
8cf75df52a dir: Rename variable to make things clearer 2020-03-30 15:37:26 +02:00
Alexander Larsson
c9878f040e dir: Add define for "sideload-repos" dir name 2020-03-30 15:36:54 +02:00
Alexander Larsson
527e6b247b Pass token to using flatpak_dir_fetch_remote_commit() when available 2020-03-30 15:03:55 +02:00
Alexander Larsson
0ef69c96db http-utils: Rename flatpak_load_http_uri to flatpak_load_uri and support file:
Various places (like the new load-commit-for-extra-data-setup) needs to
support file: uris, lets make it available generically.
2020-03-30 15:00:51 +02:00
Alexander Larsson
6deb23a322 extra-data: Simplify extra-data progress setup
We need to get the commit object to setup the extra-data progress information,
and this is currently done using a complex pull operation to a temporary
repo. According to https://github.com/flatpak/flatpak/issues/3515 it
even causes an unecessary download of the summary in some cases.

Now that we don't need to support p2p we can instead directly download
the commit object using a simple http operation (or from the sideload
repos), as we know the commit id at this point anyway.
2020-03-30 13:24:15 +02:00
Alexander Larsson
e2c8838cea Merge pull request #3482 from abderrahim/flatpak-progress
Add a FlatpakProgress object
2020-03-27 17:43:31 +01:00
Alexander Larsson
c222f03c10 FlatpakProgress: Clean up APIs for handling extra data
We don't need to keep recalculating the nr of extra_data items remaining.
We know the initial value and can just decrement it each time one
completes.
2020-03-27 17:23:13 +01:00
Alexander Larsson
ed3ba39a06 Fix calculation of extra-data total size
This is a bug introduced in b03916f5bd
where we check the extra_data refs against app/ or runtime/ prefix with
arguments in the wrong order.
2020-03-27 17:21:17 +01:00
Alexander Larsson
b7f0c17762 FlatpakProgress: Handle NULL in most methods
I noticed several places in flatpak-dir.c that didn't check for
NULL progress, so lets move the check inside the implementation so
we can ensure its always checked.
2020-03-27 16:04:36 +01:00
Alexander Larsson
52224b0463 FlatpakProgress: Move default value into FlatpakProgress 2020-03-27 16:04:36 +01:00
Alexander Larsson
b1b1a6e568 FlatpakProgress: Free the GMainContext 2020-03-27 14:45:57 +01:00
Alexander Larsson
4ef12c5bc9 FlatpakProgress: No need to allocate FlatpakMainContext
We store it on the stack instead and free with
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC.
2020-03-27 14:44:00 +01:00
Alexander Larsson
a529c149ca FlatpakProgress: Use uint for bitfields
gboolean is int which is signed, and that is not good for bitfields
2020-03-27 14:40:22 +01:00
Abderrahim Kitouni
192d31d315 Add a FlatpakProgress object
To avoid the complexities of passing (and chaining) OstreeAsyncProgress
objects around, we only create one just before calling to ostree.
The rest of flatpak only ever uses the new FlatpakProgress object.

Co-authored by: Philip Chimento <philip@endlessm.com>
2020-03-26 21:09:19 +01:00
Simon McVittie
1fd42ab660 common: Only run variant-schema-compiler once
A make rule like

    a b: x y
            command

does not mean "run command to generate a and b from x and y". Instead,
it means "run command to generate a from x and y", and, separately,
"run command to generate b from x and y". In a parallel build this
could mean that we try to run the variant-schema-compiler twice, in
parallel, with the output from each run overwriting the other.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-26 16:03:17 +01:00
Simon McVittie
7ad756c77b common: Add variant-schema-compiler output to nodist SOURCES
This means it doesn't go into dist tarballs, and we don't need to add
it to BUILT_SOURCES and CLEANFILES separately because it's already
there.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-26 16:03:17 +01:00
Simon McVittie
09f05a6f87 dir: Format 64-bit ints correctly
%ld is only 32 bits long on ILP32 (32-bit) platforms.

This partially addresses #3499.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-26 11:38:13 +00:00
Alexander Larsson
75f23be46e Merge pull request #3488 from smcv/really-deprecate
Really deprecate functions deprecated in 102c710b
2020-03-26 11:53:26 +01:00
Alexander Larsson
15c761d482 Use symlinks instead of xa.sideload-repos config option
Instead of having a global config option we scan a directory for
symlinks into the sideload repos. These come from
/var/lib/flatpak/sideload-repos and /run/flatpak/sideload-repos (for
default system installation).

This is much easier to update atomically, and the two different
options are useful for persistant (the first) or dynamic (the second)
usescase.

Fixes https://github.com/flatpak/flatpak/issues/3494
2020-03-26 11:50:54 +01:00
Simon McVittie
8d25ecf2e1 transaction: Remove a stray debugging message
I assume this isn't meant to be user-facing.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-25 20:04:20 +00:00
Simon McVittie
6ba07613b4 installation: Formally deprecate deprecated methods
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-25 12:56:56 +00:00
Simon McVittie
2d3642931d installation: Fix typos in deprecations
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-25 12:45:04 +00:00
Alexander Larsson
05eba2b32c Merge pull request #3474 from flatpak/wip/hadess/more-similar-appids
common: Allow version numbers in app-id for DConf migration
2020-03-25 09:57:43 +01:00
Alexander Larsson
aa6d9550c1 Merge pull request #3476 from alexlarsson/drop-p2p
Drop support p2p in favour of simpler side-loading scheme
2020-03-25 09:54:41 +01:00