Commit Graph

635 Commits

Author SHA1 Message Date
Matthias Clasen
66e91f55e8 Add a marker to rewritten desktop files
Add X-Flatpak=true to rewritten desktop files.
Desktop files have multiple consumers, and this
makes it easier for them to know what to do.
2017-05-10 11:54:19 +02:00
Alexander Larsson
7a4c82529e Support build-update-repo --redirect-url=
When clients install/update they will see this property in the
(signed) summary and update the url in the config, making this
essentially a permanent redirect.
2017-05-09 17:02:00 +02:00
Alexander Larsson
21778f1075 Add support for adding new gpg keys via signed summary 2017-05-09 16:43:20 +02:00
Alexander Larsson
0bf1b31256 update_remote_configuration_for_summary: Never use system-helper
The system-helper support now happens at the higher level
in update_remote_configuration, so there is no need for this.
2017-05-09 16:33:47 +02:00
Alexander Larsson
fe09ffaa03 Optimize flatpak_summary_match_subrefs
This is called a lot during update, so we rewrite it to
avoid splitting up each ref in the summary file.
2017-05-09 15:18:13 +02:00
Alexander Larsson
d3a7dce117 Use flatpak_variant_bsearch_str to lookup in summary cache
This is a lot faster than the linear probe of g_variant_lookup.
2017-05-09 15:17:07 +02:00
Alexander Larsson
a058c5cbf2 Optimize flatpak_variant_bsearch_str
Rather than parsing a get_child string we just access
the right child and type.
2017-05-09 15:15:54 +02:00
Alexander Larsson
44cf5076fa update: Split update into check_for_update and update
This way we can avoid printing "updating foo" for every
app even if there is no update.
2017-05-09 14:08:27 +02:00
Alexander Larsson
864f2def12 transaction: Always update metadata for remotes on update/install
All remotes involved in an update are updated before starting
transaction.
2017-05-09 13:25:21 +02:00
Alexander Larsson
9896005ad0 remote-modify: Implement --update-metadata as a system-helper method
We download the summary and send it to the system helper, it verifies
the checksum and applies the changes, with the same polkit permissions
required as for an app update (i.e. typically none).

This allows us to update metadata automatically, without permission
requests.
2017-05-09 13:25:21 +02:00
Alexander Larsson
f7c2fd0c30 common: Drop verbose log of using cached summary
This is just to common and is making -v useless
2017-05-09 13:25:21 +02:00
Alexander Larsson
b06e38073a common: Store the summary signature in the cache too
We will need this later
2017-05-09 13:25:21 +02:00
Alexander Larsson
e428ee47fc common: Add flatpak_dir_update_remote_configuration_for_summary 2017-05-09 13:25:21 +02:00
Alexander Larsson
b106fd9c67 remote-modify: Never update explicitly set values
Whenever you explicitly specify some value (e.g. for
title or default-branch) we set a $KEY-is-set option
to True, and if that is set we never automatically update it.
2017-05-09 13:25:21 +02:00
Alexander Larsson
62598840d1 common: Remove unused flatpak_dir_install_or_update 2017-05-09 13:25:21 +02:00
Alexander Larsson
6c1ebbcd1a install: Handle no-static-delta in --user installs too 2017-05-09 13:25:21 +02:00
Alexander Larsson
1a49029f9d Move caches to ~/.cache
The system-cache (summaries and temporary repos for downloads) are moved
from ~/.local/share/flatpak/system-cache to
~/.cache/flatpak/system-cache (or wherever XDG_CACHE_HOME is) because
this is the proper location for caches.

Fixes https://github.com/flatpak/flatpak/issues/767
2017-05-04 17:29:30 +02:00
Alexander Larsson
4d2d07d033 Expose host /etc/hosts and /etc/host.conf
These are local network configuration, very much similar to
resolv.conf, so should also be exposed.

Fixes https://github.com/alexlarsson/spotify-app/issues/42
2017-05-04 13:08:25 +02:00
Alexander Larsson
858a4b6044 build: Kill sandbox when flatpak build dies
This ensures that no processes from the build lives
past the return of the build itself, which might
accidentally happen.

We still allow apps to stay around after the regular
flatpak run command finished though, as this is sometimes
done on purpose.
2017-05-04 10:53:48 +02:00
Alexander Larsson
f28d318cc9 run: Handle the case where /tmp on the host is a symlink
If the app explicitly grants access to the host /tmp (for
instance telegram) then when this is being exposed as a symlink
in the sandbox we get an error because /tmp already exists
as a dir, which we create very early on.

It doesn't really make sense to keep /tmp as a symlink in
the sandbox anyway, so we just special case this and mount
the symlink target as /tmp.
2017-05-04 10:34:40 +02:00
Alexander Larsson
7f7387ce5e build: Fix fallout from the TMPDIR unset
We need to handle the NULL in the default_exports array
also when creating a minimal environment for the build.
Otherwise TMPDIR was set to (null).
2017-05-04 10:12:03 +02:00
Alexander Larsson
93e13a42ec run: Only forward as document if the target app can't see the file 2017-05-03 18:23:30 +02:00
Alexander Larsson
5a373a9cf9 run: Clean up the exports handling code
This doesn't really change anything but renames a few functions and
introduces a FlatpakExports struct that is uses instead of the caller
open-coding a hashtable
2017-05-03 15:48:39 +02:00
Alexander Larsson
1797611c90 run: Properly handle canonicalization in file exports
Always canonicalize filesystem arguments for exposing and
hiding and use the canonical form in all places.
2017-05-03 14:40:59 +02:00
Alexander Larsson
296b7774d3 run: Use flatpak_has_path_prefix instead of hand rolling
Instead of manually adding a slash at the end of the prefix
matches, use the proper helper
2017-05-03 14:39:12 +02:00
Alexander Larsson
f228577377 run: Handle forwarding uris better
We need to know if we're forwarding uris or files, because
if we're doing uris we need to pass on non-file uris as-is.
So, we enclose uris with "@@u @@" instead.

This also properly (un)escapes the file uris
2017-05-03 13:53:39 +02:00
Matthias Clasen
5013601c41 Don't get the doc mount path twice
We already call GetMountPoint in add_document_portal_args.
Lets keep the result around and reuse it in add_rest_args,
stead of calling it again.
2017-05-03 13:27:52 +02:00
Matthias Clasen
9e270af0e4 Handle document portal absence
If we can't get the document portal, emit a warning
and omit file forwarding in this case. We still skip
the @@ arguments in the commandline, but we pass the
files unmodified.

Also, only get the document portal proxy when we need
it.
2017-05-03 13:27:52 +02:00
Matthias Clasen
185de3462c Enable file forwarding for %u as well
Do the same Exec line mangling for file forwarding if
we encounter %u or %U. flatpak run is smart enough to
handle file: uris and ignore others.
2017-05-03 13:27:52 +02:00
Matthias Clasen
f3bb892868 Handle %u as well for file forwarding
We need to do the same thing for file: uris that
we do for paths.
2017-05-03 13:27:52 +02:00
Matthias Clasen
489386cc7b Handle %f when exporting desktop files
When we find %f in the Exec line, replace it with '@@ %f @@'
(same for %F), and add a --file-forwarding option to the run
command.
2017-05-03 13:27:52 +02:00
Matthias Clasen
153dd18a7d Implement file forwarding for flatpak_run_app
Add a flag that triggers extra processing of the 'rest'
commandline arguments, as follows: When we see arguments
that are enclosed in a pair of '@@' arguments, we interpret
them as file paths, export them in the document store, and
pass the resulting document path to the launched application.

Currently, the files are exported non-persistent (i.e. only
for the current session), and with read and write permissions
for the app.
2017-05-03 13:27:52 +02:00
Matthias Clasen
75b84b4bfe Include the generated document portal code in common
Move the sources from app/ to common/. We will use this
code from common/ in subsequent commits.
2017-05-03 13:27:52 +02:00
Alexander Larsson
6711b56794 Unset TMPDIR in the sandbox
Its quite possible that a custom TMPDIR is not mapped
in the sandbox, and /tmp is per-app anyway, so it doesn't
really make sense to use the custom one.

Fixes https://github.com/alexlarsson/spotify-app/issues/41
2017-05-03 13:25:35 +02:00
Matthias Clasen
e76761e827 Don't crash if there's more titles than columns
This was crashing when running flatpak list for
an empty installation.
2017-05-03 12:40:14 +02:00
Alexander Larsson
fb6695e9a4 Add macros for common ANSI tty escape codes 2017-05-03 11:17:41 +02:00
Matthias Clasen
ea93b3977d table printer: Use localeconv for decimal point
This gives us a chance of working correctly in exotic locales.
2017-05-03 11:06:43 +02:00
Matthias Clasen
5635adea29 Add table printer api for number columns
This is better than open-coding the decimal point
check in all the callers.
2017-05-03 11:06:43 +02:00
Matthias Clasen
b07240f525 Use the new output helper
Instead of open-coding isatty(), use flatpak_fancy_output().
2017-05-03 11:06:43 +02:00
Matthias Clasen
ecc90b95e7 Add a helper for formatted output
For now this just uses isatty(), but we might
allow overriding this with an environment variable
in the future.
2017-05-03 11:06:43 +02:00
Joaquim Rocha
de2c6cc85b Add the possibility of installing/updating without static deltas
Sometimes we need to pull a commit without using static deltas to e.g.
make sure that an app with a corrupted commit can still be updated by
pulling the new commit in full.

This option has been added to the FlatpakUpdateFlags,
FlatpakInstallFlags, as well as a parameter for the CLI.
2017-05-02 15:05:48 +02:00
Matthias Clasen
70a56f9d60 Add an API to get the summary of a remote
This will be used by flatpak remote-ls in subsequent commits.
2017-05-02 15:00:07 +02:00
Matthias Clasen
62b8ae2953 table printer: move to its own source files
This is a pretty standalone object, and it is nicer to
have it in its own files. All users have been updated
to include the new flatpak-table-printer.h header.
2017-05-02 14:56:04 +02:00
Matthias Clasen
1998acb18e table printer: Only show titles on ttys
Avoid showing column titles unless stdout is a tty.
2017-05-02 14:56:04 +02:00
Matthias Clasen
be92e4aa7e table printer: Support column titles
Add an api to set column titles, and format them in bold.
2017-05-02 14:56:04 +02:00
Matthias Clasen
2a5ce5a05e table printer: Support column alignment
Add support for aligning columns at a certain position.
This will be used to line up numbers at the decimal point,
in future commits.
2017-05-02 14:56:04 +02:00
Matthias Clasen
fbcaf05362 table printer: Introduce a cell struct
No functional change here, simply some data structure reorg,
so we can have more data for each cell in the future.
2017-05-02 14:56:04 +02:00
Colin Walters
c50648a594 libglnx: Bump to latest master, use new file copy API
The new `glnx_regfile_copy_bytes()` is better than the previous
`flatpak_copy_bytes()` in that it will use reflink/sendfile if available.

More information in 3a4d0f4684
2017-04-28 10:04:22 -04:00
Georges Basile Stavracas Neto
0007edb7bd Ensure commits are available when checking for extra-data
After the introduction of linear progress reports based on
heuristics, Flatpak still couldn't make precise reports for
the extra-data field is contained in the commits. When we
were setting extra-data up, Flatpak didn't have the commits,
so it always failed.

Fix that by downloading the commits first, and then setting
up the extra-data fields.

flatpak/flatpak#609
2017-04-27 17:21:29 +02:00
Rafael Fontenelle
09c070f667 flatpak-run.c: valid locations, not types
Some previous g_set_error messages were related to 'unknown type', but this one about 'unknown location'. So it would probably be best to suggest 'valid locations', instead of 'valid types'.
2017-04-27 17:20:40 +02:00