Commit Graph

5887 Commits

Author SHA1 Message Date
Matthew Leeds
4117fe0955 Merge pull request #3616 from refi64/remote-add-seg
remote-add: Don't make the repo existence optional
2020-06-05 13:25:10 -07:00
Léo Stefanesco
66dfb63075 Fix segfault when reporting error during install
flatpak_dir_install was returning FALSE but leaving error to NULL, which
would crash when printing the error.

Fixes #3646
2020-06-05 17:02:45 +02:00
Ryan Gonzalez
1735d88f01 Clean up duplicated instance collection code
It was completely identical in flatpak-run.c and flatpak-instance.c.
2020-06-05 16:36:13 +02:00
alaviss
ea1830e108 common/flatpak-run: respect user's XDG base directories (#3626)
This makes flatpak respects XDG_DATA_HOME and XDG_CACHE_HOME for binding
user's fonts and icons into the sandbox.
2020-06-05 16:31:39 +02:00
Nikola Knazekova
669a5bf671 Add unconfined_domain(flatpak_helper_t) to optional_policy block
Fixed bug where disabling unconfined module fails because macro unconfined_domain(flatpak_helper_t) wasn't in optional_policy block
2020-06-05 16:27:39 +02:00
Alexander Larsson
b042abc71c oci: Handle io.github.containers.DeltaUrl in index
If the magical io.github.containers.DeltaUrl label is set in the
index, then try to download this to use as the delta manifest for the
image. This allows servers to store deltas outside the registry
itself. The label is propagated to the xa.delta-url metadata in the
generated "fake summary" for the remote, and read back on pull.

Note that the delta manifest layers descriptor will need to have a
"urls" key where it references the blobs if the blobs are also not
stored on the registry.

If the specified manifest doesn't exist or doesn't apply to the target
image we fall back to resolving via the _deltaindex tag.
2020-06-05 09:35:30 +02:00
Alexander Larsson
fd197300b9 oci: Fix potential crash
Call flatpak_remote_state_ensure_summary() before dereferencing
RemoteState->summary to return an error instead of crashing if
downloading the summary failed.
2020-06-05 09:35:30 +02:00
Alexander Larsson
47daa077c2 OCI: Support (and use) alternative urls specified in OCI descriptors 2020-06-05 09:35:30 +02:00
Alexander Larsson
aaa36bab45 oci: Support deltas when using system-helper
When mirroring to a local OCI dir we apply deltas and generate
uncompressed layer blobs instead of regular blobs. Then we pick this
up on the system-helper side.
2020-06-05 09:35:30 +02:00
Alexander Larsson
f2cb157294 oci: Use the correct progress layer size when using deltas 2020-06-05 09:35:30 +02:00
Alexander Larsson
37dcccea61 oci: Add flatpak_oci_registry_apply_delta_to_blob()
This is a version of flatpak_oci_registry_apply_delta() that generates
a new blob in a local repo, rather than a temporary file. This is used
when mirroring using a delta into a child oci registry for system-helper
use.
2020-06-05 09:35:30 +02:00
Alexander Larsson
5d8fd2d1be oci: Set token on child oci registry and pass to system-helper
When we create a system child registry we also set the current token on
it. This is not used directly in the client, however its saved in a
file called .token and re-read in the system-helper, allowing it to
also do the remote registry operations it needs to verify the child
registry.
2020-06-05 09:35:30 +02:00
Alexander Larsson
d4962628aa oci: Add flatpak_oci_registry_is_local() 2020-06-05 09:35:30 +02:00
Alexander Larsson
8c454f99f2 oci: Add debug spew when using deltas 2020-06-05 09:35:30 +02:00
Alexander Larsson
4539d186a5 oci: Make libzstd optional (and disable OCI deltas if not there) 2020-06-05 09:35:30 +02:00
Alexander Larsson
31612d7568 CI: Add libzstd-dev dependency 2020-06-05 09:35:30 +02:00
Alexander Larsson
7be653a14d oci: Find and apply available deltas when pulling 2020-06-05 09:35:30 +02:00
Alexander Larsson
0fce4c6d7f oci: Pass FlatpakPullFlags to pull_from_oci()
We want to handle FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS
2020-06-05 09:35:30 +02:00
Alexander Larsson
abf5b2db44 oci: Add basic functions to find and apply OCI deltas
This is based on the OCI delta work at:
  https://github.com/containers/image/pull/902
2020-06-05 09:35:30 +02:00
Alexander Larsson
3d8ca04565 oci: Add helpers to parse OCI delta index and manifest 2020-06-05 09:35:30 +02:00
Alexander Larsson
eaeb52b6a3 flatpak_oci_registry_load_blob: Allow tags (and digests) arg
We typically only load by digest id, resolving tags in other ways.
However, we need to load the _deltaindex tag by tagname, so support
this when possible.
2020-06-05 09:35:30 +02:00
Alexander Larsson
29da4ca430 oci: Store the last layer diff-id in the commit metadata (xa.diff-id)
We an use the commit content as original data for deltas going from
this diff-id, so this will be useful later.
2020-06-05 09:35:30 +02:00
Alexander Larsson
90f5fdb44d oci: Add flatpak_oci_image_get_n_layers() helper 2020-06-05 09:35:30 +02:00
Alexander Larsson
e0a25e7650 http: Also accept image indexes when FLATPAK_HTTP_FLAGS_ACCEPT_OCI 2020-06-05 09:35:30 +02:00
Alexander Larsson
01919d251e oci: Use content type from server if not in contents 2020-06-05 09:35:30 +02:00
Alexander Larsson
7820057336 Add content_type output to flatpak_load_uri()
We want this to get the oci mimetypes
2020-06-05 09:35:30 +02:00
Alexander Larsson
bfa71e208a Add FlatpakZstdDecompressor converter (and libzstd dep)
We will need this to decompress oci deltas.
2020-06-05 09:35:30 +02:00
Alexander Larsson
8e0e5a5749 oci: Always checksum entire layer when pulling
It turns out that libarchive doesn't always read the entire file until
the end if it can figure out that the tarfile ended. Normally this is
not hit, because the decompressor reads all the input, but for
uncompressed tarfiles (like those from applied deltas) this is
important.
2020-06-05 09:35:30 +02:00
Alexander Larsson
c2529d0bf8 oci: Use /var/tmp for tmpdir instead of /tmp
The files we're creating could potentially be large, so lets
not overflow ram if /tmp is a tmpfs.
2020-06-05 09:35:30 +02:00
Matthew Leeds
f44afe9d60 Merge pull request #3629 from cho2/l10n
Update Indonesian translation
2020-05-31 09:53:10 -07:00
Kukuh Syafaat
fea5074840 Update Indonesian translation 2020-05-30 22:26:47 +07:00
Matthew Leeds
ff677cfdbc Merge pull request #3623 from tw-translation/trans-200517
i18n: zh_TW: update translation
2020-05-29 17:41:04 -07:00
Matthew Leeds
7575388a02 Merge pull request #3631 from flatpak/build-update-repo-typo
doc: Fix typo in build-update-repo page
2020-05-26 08:19:31 -07:00
Matthew Leeds
0ed5477a22 doc: Fix typo in build-update-repo page 2020-05-22 11:12:55 -07:00
Kukuh Syafaat
289a3baa05 Update Indonesian translation 2020-05-21 16:31:59 +07:00
Yi-Jyun Pan
92386e2e81 i18n: zh_TW: fix issues mentioned by @zerng07 2020-05-18 01:59:37 +08:00
Yi-Jyun Pan
c5d5ebc03b i18n: zh_TW: update translation 2020-05-17 17:45:56 +08:00
Ryan Gonzalez
381f751f0a remote-add: Don't make the repo existence optional
A repository needs to exist for a remote to be written inside,
otherwise the OstreeRepo instance will be NULL and a crash will
occur once the instance is accessed.

Fixes #3612.
2020-05-13 12:24:11 -05:00
Henri Chain
0c291cf1c9 run: Change systemd unit name
As per https://github.com/systemd/systemd/pull/15647 replace "apps-" with "app-" in the scope name. Also escape app id to avoid using the special char `.`.
2020-05-13 09:57:53 +02:00
Matthew Leeds
f8dff22f19 README: Link to Flathub discourse
We don't have a separate discourse for Flatpak; it seems fine to link to
the Flathub one.

Fixes https://github.com/flatpak/flatpak/issues/3602
2020-05-12 09:26:36 +02:00
Matthew Leeds
125492bf7a app: Make upgrade an alias for update
Fixes https://github.com/flatpak/flatpak/issues/3607
2020-05-12 09:25:49 +02:00
Alexander Larsson
171218969b tokens: Request tokens during resolve if we get 401 status
If downloading a specific commit (or oci manifest) we may get a 401 back.
If so, request a token and try again. In this case we don't yet know the
token type, so pass MAXINT32 for "don't know".
2020-05-05 13:08:57 +02:00
Alexander Larsson
f6a0fa41a1 Add FLATPAK_HTTP_ERROR_UNAUTHORIZED (i.e. http status 401) 2020-05-05 13:08:57 +02:00
Alexander Larsson
e3c31309a4 Rename internal error FLATPAK_OCI_ERROR to FLATPAK_HTTP_ERROR
This is what it is really, and I want to extend it with more http errors
that are not necessarily oci related.
2020-05-05 13:08:57 +02:00
Alexander Larsson
6c3f150a05 oci: Don't crash when loading manifest by digest with no ref label 2020-05-05 11:26:20 +02:00
Alexander Larsson
a94e36d002 oci: Actually respect the commit argument when pulling
We now allow this to be set with update --commit=123abc in the oci case
too.
2020-05-05 09:33:09 +02:00
Alexander Larsson
cf49bd4ac8 oci: Support reconstructure individual commit objects (sorta)
This downloads a manifest by digest and reconstructs the commit except
for the tree/metadata reference. This allows things like flatpak remote-info
and flatpak update --commit=xxx to work.
2020-05-05 09:33:09 +02:00
Alexander Larsson
56f530ca1f dir: Add flatpak_remote_state_new_oci_registry helper
This is duplicated in a few places
2020-05-05 09:33:09 +02:00
Alexander Larsson
2028a5323f dir: Share some code that downloads commit objects
Only have the single function flatpak_remote_state_load_ref_commit()
that loads the commit objects (and don't support loading other types
of objects as that is not used).

This is a minor cleanup, but it also will be useful later when
we want to be able to "load" commits from OCI repositories.
2020-05-05 09:33:09 +02:00
Alexander Larsson
530475b9ab Tests: Support HEAD requests in oci-registry-server
This just does a GET, which is not quite right, but will work.
This is needed for the authenticator.
2020-05-04 16:32:22 +02:00