Commit Graph

1341 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
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
47daa077c2 OCI: Support (and use) alternative urls specified in OCI descriptors 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
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
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
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
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
Matthew Leeds
e27ec1f3bc app: Add translators comments about sideloading
Fixes https://github.com/flatpak/flatpak/issues/3546
2020-05-04 12:10:49 +02:00
Matthew Leeds
fe650801c4 remote-info: Move newline
Logically, the SDK should be listed with the app info right after the
runtime, not in the commit section.
2020-05-04 12:10:19 +02:00
Matthew Leeds
311b94ed28 update: Restrict --commit to one app/runtime
Currently if you run "flatpak update --commit=XYZ", we try to use that
commit for every installed thing, which doesn't make much sense. Make it
an error not to specify a ref with --commit.
2020-05-04 12:07:50 +02:00
Matthew Leeds
808fac7e80 list: Fix a tiny whitespace error 2020-04-27 17:54:44 -07:00
German Perconti
814c771bdc Don't error out in uninstall when one ref is not installed 2020-04-23 10:59:27 +02:00
Matthew Leeds
112614d289 quiet-transaction: Remove side-effect on no-interaction
Currently when you create a FlatpakQuietTransaction object using a
FlatpakDir, the dir will have no_interaction set to TRUE even after the
transaction runs. I don't think it makes sense to have a side effect
like that, and it causes the remote-delete command to fail in the case
where it has to uninstall things. So, restore the old no_interaction
value during destruction of the FlatpakQuietTransaction.

Fixes https://github.com/flatpak/flatpak/issues/3140
2020-04-16 08:56:39 +02: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
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
e2c8838cea Merge pull request #3482 from abderrahim/flatpak-progress
Add a FlatpakProgress object
2020-03-27 17:43:31 +01:00
Abderrahim Kitouni
a18db1d646 cli-transaction: properly format '1.0 kB'
it's irritating to have it this way when everything else uses a comma as
a decimal separator

use the same trick for the total too
2020-03-26 21:24:47 +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
Alexander Larsson
76be5db46d Revert "config: Support setting sideload-repos option"
This reverts commit 1d1819840e.
2020-03-26 10:10:45 +01:00
Alexander Larsson
e5e498c34f remote-ls/info: Add --sideloaded option
This means we load the info from sideloaded repos only
2020-03-24 16:17:06 +01:00
Alexander Larsson
a843d2d594 sideload: Add api and CLI support to specify sideload repos dynamically 2020-03-24 14:01:20 +01:00
Alexander Larsson
b8d2196c2e create-usb: Add --allow-partial option
If you really want to export partial refs you can use this switch.
2020-03-24 12:51:12 +01:00
Alexander Larsson
d30e902d9f Add build-update-repo --deploy-sideload-collection-id option
This is a new version of --deploy-collection-id that only applies
the collection id update for new (1.7.x+) version of flatpak clients.
This allows you to enable collection ids for sideload use but not
affect older clients where the p2p codepaths are not as tested.
2020-03-23 17:58:04 +01:00
Alexander Larsson
9abbb00b33 Drop xa.sideload-collection remote option in favour of regular collection-id
Nothing fundamentally happens differently in ostree if the collection-id
is set, as long as we don't call the p2p specific apis. So, lets keep
using it instead of adding our own special magic.
2020-03-23 17:58:04 +01:00
Alexander Larsson
1d1819840e config: Support setting sideload-repos option 2020-03-23 17:58:04 +01:00
Alexander Larsson
124b0be92e Drop more collection_id use
Most code that looks for a regular collection id set on the remote is
removed, as these should never happen in flatpak repo setups now.

Some is replaces with looking at xa.sideload-collection-id:
 * The libflatpak FlatpakRef::collection-id property now comes comes from the sideload id
 * Various CLI commands showing or changing the collection-id for a remote now uses the sideload id
 * Collection id deploy in update now sets the sideload-collection-id instead
 * Setting the collection id for a remote in libflatpak now sets the sideload id

Additionally we now delete the code that allows unsigned summaries
when there is a collection id (because there is none).

create-usb now uses the sideload id as as collection id source when exporting.

The direct repo operations (export, bundle, commit-from) still support
collection ids, because on the server we do want to set it so that we
can sideload.
2020-03-23 17:58:04 +01:00
Alexander Larsson
336a127f55 Support sideloaded repos
This adds a xa.sideload-collection-id option to the remote
configuration and a global xa.sideload-repos option (which is a list
of paths to local repos).

When resolving or listing refs, if we fail to download the real remote
summary (i.e. we're offline) then we instead look into the configured
sideloaded repos for refs that match ref and the sideloaded collection
id for the remote.

For the transaction to resolve the ref we need more metadata. In the
regular summary case we use the metadata from the summary, but that
is not available in the (partial) summary in the sideload repo, so
there we load the actual commit object and use the data from there.
(The ostree-metadata branch is not used/needed.)

This actually also fixes a longstanding issue when you "flatpak update
--checksum=XYZ" because we now handle this correctly by downloading
the commit object from the remote. Before we used the metadata in the
summary which is not right for non-HEAD commits.

To handle the sideloading we record the path to the sideload repo
when sideloading and pass the url to the repo as the remote name
when pulling, which will do a direct local pull.

We avoid using sideloaded refs when offline if the timestamp in the
commits is older than what is already installed locally.
2020-03-23 17:58:04 +01:00
Alexander Larsson
32194f2d29 create-usb: Detect the case of partial deploys and warn/fail
We don't want to make a usb repo with e.g. just one translation.
2020-03-23 17:58:04 +01:00
Alexander Larsson
ff317fd4fb Enforce little endian for token-type
When storing the token-type in the commit and the summary cache we
hardcode it to little-endian.

In theory this breaks the "ABI", but in practice this change is a
no-op on little-endian systems which is what most are. Additionally as most
servers are little-endian this also fixes using big-endian clients with
such servers.

This fixes:
https://github.com/flatpak/flatpak/issues/3434
2020-03-16 11:26:10 +01:00
Alexander Larsson
b79e878a75 document-export: Support exporting directories
This adds support for exporting a directory as a document, as
supported by version 4 of the portal:

  https://github.com/flatpak/xdg-desktop-portal/pull/447
2020-03-16 09:29:55 +01:00
Matthew Leeds
24a99b354c repair: Don't shadow checksum parameter 2020-03-16 09:29:31 +01:00
Matthew Leeds
2005a52498 app/parse-datetime.h: Add #pragma once 2020-03-16 09:29:31 +01:00
Matthew Leeds
4e7cee1b98 app: Don't shadow global variables
These were pointed out by lgtm.com
2020-03-16 09:29:31 +01:00
Alexander Larsson
567bddf25c Use generated variant accessors for commit objects 2020-02-17 16:10:50 +01:00
Alexander Larsson
f29830b4a4 Convert sparse cache API to generated variant APIs 2020-02-17 16:10:50 +01:00
Alexander Larsson
61da44a5e3 Convert flatpak_summary_lookup_ref from GVariants
Now it returns a VarRefInfoRef instead of a GVariant
2020-02-17 16:10:50 +01:00
Alexander Larsson
7c4fd8891e Convert deploy data to use variant schemas 2020-02-17 16:10:50 +01:00
Alexander Larsson
2481207a6f run: Fix uninitialized use warning
This isn't actually used ununitialized, but gcc can't figure that out.
2020-02-13 14:47:00 +01:00
Matthew Leeds
bbd4ee68b4 app: Don't print "< 0 bytes"
Don't imply a download or install uses a negative number of bytes.
2020-02-12 16:45:41 +01:00
Damian Wrobel
e801959e58 Fix out-of-tree build error
Fixes the missing 'app' directory:

Traceback (most recent call last):
  File "/data/dwrobel1/rdkv/rpi-flutter-3/build-raspberrypirdkhybrefapp/tmp/sysroots/x86_64-linux/usr/bin/gdbus-codegen", line 39, in <module>
      sys.exit(codegen_main.codegen_main())
        File "/data/dwrobel1/rdkv/rpi-flutter-3/build-raspberrypirdkhybrefapp/tmp/sysroots/x86_64-linux/usr/share/glib-2.0/codegen/codegen_main.py", line 186, in codegen_main
            h = open(c_code + '.h', 'w')
            FileNotFoundError: [Errno 2] No such file or directory: './app/flatpak-permission-dbus-generated.h'
            make: *** [app/flatpak-permission-dbus-generated.c] Error 1
            make: *** Waiting for unfinished jobs....
2020-01-31 10:01:11 +01:00
Alexander Larsson
1c737df031 completion: Fix some leaks 2019-12-19 17:09:47 +01:00
Alexander Larsson
815502b97f remote-add: Fix leak 2019-12-19 16:57:47 +01:00
Alexander Larsson
7480bd8f07 Show authenticator info in flatpak repo output 2019-12-19 10:33:21 +01:00
Alexander Larsson
04162f3286 repo support for setting authenticator options
flatpak build-update-repo now lets you modify the
autenticator-name/install/options keys, and these are migrated to
the summary/metadata during update.
2019-12-19 10:33:21 +01:00
Alexander Larsson
8e4b0d156d remote add/modify: Add --[no-]authenticator-install options
This enables or disables auto-installation of autenticators for a remote.
If it is unset it defaults to whatever the remote wants.
2019-12-19 10:33:21 +01:00
Alexander Larsson
af2ecb7335 transaction: Make metadata updates more efficient
When we call flatpak_dir_update_remote_configuration we pass it
the pre-existing FlatpakRemoteState (if known) and also take into
account if it actually changed anything before blowing away the
cached remote state.

We also ensure we have metadata in
flatpak_dir_update_remote_configuration_for_state to ensure the passed
in optional state has metadata in it.
2019-12-19 10:33:21 +01:00
Alexander Larsson
d28189889b Minor tweaks to authenticator options commandline handling
Make checks the same and fix whitespace.
2019-12-19 10:33:21 +01:00