Commit Graph

1332 Commits

Author SHA1 Message Date
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
Alexander Larsson
1648bf34b1 remote options: Fix authenticator-name--is-set handling
This accidentally was a string instead of a boolean
2019-12-19 10:33:21 +01:00
Alexander Larsson
a5b73716d1 CLI: Limit where we warn about unset XDG_DATA_DIRS
This warning is meant for interactive use, and as per #3316 it often
breaks non-interactive stuff like scripts. So, we only warn on ttys,
and only on normally interactive operations like run, install and update
to avoid warnings in cases like building (where XDG_DATA_DIRS is not
needed) or information gathering things like e.g. flatpak info.
2019-12-19 10:29:56 +01:00
Matthew Leeds
dd5a82727c app: Improve "remote not found" error message
It often happens that people use --user or --system or --installation
and get a "Remote not found" error message, because they don't
understand that remotes have to be defined separately in each
installation. Make the error message more helpful by pointing out when
one of those options was used.

Fixes https://github.com/flatpak/flatpak/issues/3296
2019-12-19 09:53:22 +01:00
Alexander Larsson
ca343957fc Update CLI to new authenticator options format
We're using a per-key format now, so switch from
  --authenticator-options=blob
to
  --authenticator-option=key=value

In both remote-modify and remote-add
2019-12-17 15:25:42 +01:00
Alexander Larsson
ecf4c3630a authenticator: Set the xa.authenticator-name-is-set key
This is set when the option is explicitly set and should not be
auto-overridden.
2019-12-17 15:25:42 +01:00
Alexander Larsson
e645424e69 Cli-transaction: Fix leak
We didn't free the table printer used.
2019-12-17 14:55:13 +01:00
Alexander Larsson
c322cbdbb6 Add and use OstreeAsyncProgressFinish helper
This is a g_autoptr version of OstreeAsyncProgress that also
calls ostree_async_progress_finish() before being freed.

This should be used in all "leaf" functions that creates an asyncprogress
to avoid leaking any idle change idle sources. Using a auto* means
some code can be cleaned up to avoid goto out style handling for this.

Also, this adds a missing finish() in
_flatpak_dir_fetch_remote_state_metadata_branch().
2019-12-17 14:55:13 +01:00
Alexander Larsson
7fedf3578f OCI: Only use labels, never annotations
This is a slightly incompatible change, as we now only support
oci images generated with (what was before) build-export --oci-use-labels.
However, there are not a lot of OCI implementations in the wild, and
we can modify the ones in use to ensure there are labels (and
annotations if needed for older flatpak clients).

This also removes the --oci-use-label option from build-bundle --oci as
this is now the default.
2019-12-16 09:23:49 +01:00
Alexander Larsson
e08cee0e82 authenticator: Use g_app_info_launch_default_for_uri() to launch browser
This way we get the system default. We still respect BROWSER if set
which is useful for e.g. the tests or scripts.
2019-12-12 14:27:59 +01:00