Commit Graph

1310 Commits

Author SHA1 Message Date
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
Alexander Larsson
474b0573e3 authentication: Remove accidental leftover debug spew 2019-12-12 14:27:59 +01:00
Alexander Larsson
38c86bdf0f Authenticator: Add extra a{sv} args for future use
These are not used atm, but make the APIs future proof.
2019-12-12 14:27:59 +01:00
Alexander Larsson
1ec4232fd5 CLI: Handle basic auth in transactions 2019-12-12 12:16:53 +01:00
Alexander Larsson
976c88cf56 oci: Pass down token into OCI http operations
This is needed for pull operations to actually use the token if one
is given by an authenticator.
2019-12-12 12:16:53 +01:00
Matthias Clasen
54b5e39a96 permission-set: Auto-apply wrapping for data
It is confusing if we explicitly have to specify
the <> GVariant wrapping with --data, but
flatpak permissions strips it when displaying the
result.

Make it transparent by auto-applying the wrapping,
so what you need to pass to --data is the same
as what flatpak permissions shows you.
2019-12-12 09:08:07 +01:00
Matthias Clasen
6f8dc02bca permissions: Don't skip 'empty' rows
Don't skip entries that have no permissions.

I was wasting some time to track down why my
permission-set --data command wasn't working,
when in reality, the permissions command was
just not listing the entries I was adding :(
2019-12-11 17:21:36 +01:00
Matthias Clasen
cdf3c33293 permission-set: Add an option to set data
This is useful for debugging permission store functionality
and will be more so when the openuri portal starts using
per-entry data.
2019-12-11 17:21:36 +01:00
Matthew Leeds
0ab953a2f9 enter: Fix invalid arg error message
I think this was mistakenly changed in commit 4718bcccf.
2019-12-10 14:36:58 +01:00
Philip Chimento
923beec024 Change "update-frequency" to "update-interval"
An event happens more often as its frequency gets higher, so these
values were confusing me.

Rename the constants to include their unit (ms) as well, to avoid
confusion.

Anything that affects public API (such as
flatpak_transaction_progress_set_update_frequency()) or libostree's
options passed to ostree_repo_pull_with_options(), is left as is.
2019-12-06 13:26:49 -08:00
Matthias Clasen
5ec73b9a9a ps: Allow showing compositor info
Show active and background state, based on information obtained
from the background portal backend about which apps have (active) windows.

This currently tries all known portal backends in turn. It might
be nicer to have a portal frontend api to query this, or to find
out which backend to talk to.
2019-12-04 13:33:52 +01:00
Matthias Clasen
653fce251f cli: Don't use \r in plain output
These show up as ^M in test logs, and that is irritating.
Just use \n when producing plain output.

Closes: https://github.com/flatpak/flatpak/issues/3226
2019-12-04 13:30:13 +01:00
Matthias Clasen
4765a78a87 Merge pull request #3270 from matthiasclasen/parent-pid-docs
run: Improve help output for --parent-pid
2019-12-02 07:28:28 -05:00
Matthias Clasen
b76a1bd0df Merge pull request #3265 from matthiasclasen/ps-instance
ps: Don't hardcode instance column
2019-12-02 07:27:23 -05:00
Matthias Clasen
4201a35081 Merge pull request #3266 from matthiasclasen/fail-message-period
Error message cosmetics
2019-12-02 07:26:41 -05:00
Matthias Clasen
76d23cca15 enter: Correct the help output
The COMMAND is not optional, so don't put it in brackets.

Closes: https://github.com/flatpak/flatpak/issues/2881
2019-12-01 23:14:27 -05:00
Matthias Clasen
cb2cadb3ad run: Improve help output for --parent-pid
Show a placeholder to indicate that this option
takes an argument. Update docs to match.
2019-12-01 16:12:36 -05:00
Matthias Clasen
35f023e2d0 build-commit-from: No period for error messages
We don't use periods at the end of error messages
elsewhere, and it looks wrong.
2019-12-01 09:47:53 -05:00
Matthias Clasen
0460d486a9 kill: No period for error messages
We don't use periods at the end of error messages
elsewhere, and it looks wrong.
2019-12-01 09:46:34 -05:00
Matthias Clasen
90c2d24127 ps: Don't hardcode instance column
We were unconditionally adding the instance column,
which causes table headers to be off-by-one when
instance is not among the requested columns.

Change things to only add the instance column
when requested.
2019-12-01 09:39:46 -05:00
Alexander Larsson
ae50843851 portal: Add EXPOSE_PIDS flag
This uses the new bwrap feature via flatpak run --parent-expose-pids to
make new new sandbox pid namespace be a child of the callers sandbox.

Pretty obvious, the only weird thing is that we can't get the peer pid
directly from the caller (as it goes via the dbus proxy) so we have
to look that up from the instance data.
2019-11-27 14:21:25 +01:00
Alexander Larsson
62797b4be9 flatpak run: Add --parent-pid=$pid --parent-expose-pids
Given the pid of an existing flatpak process, if --parent-expose-pids is
specified, the new sandbox is run such that its processes are visible in
the specified sandbox.

In all other senses the two are disjoint though. The new sandbox is
still isolated from the host and the existing sandbox.
2019-11-27 14:21:25 +01:00
Alexander Larsson
f420fad6a9 cli transaction: Handle webflow signals
This shows the url in the default browser. Currenly it just looks
at $BROWSER and falls back to xdg-open.
2019-11-26 16:37:01 +01:00