Commit Graph

2663 Commits

Author SHA1 Message Date
Matthias Clasen
b04529dfd0 info: Print some more information
Make sure that info prints at least the same amount of
information as list -d.
2017-05-08 11:29:22 +02:00
Matthias Clasen
172d7ad9db Use clearer terminology in docs about extensions
Differentiate between the 'extension point' (definition of
a place where extensions can be mounted) and the 'extension'
(a runtime matching an extension point).
2017-05-08 11:28:55 +02:00
Colin Walters
48b5dd5e7b tests: Fix race condition in tmp webserver
I was seeing this when trying to run flatpak's tests in ostree's CI:
https://github.com/ostreedev/ostree/pull/824

The race here is that the python process can still be writing to the output
while sed is reading it, and hence we'll find a difference on the next line.
Fix this by making a tmp copy of the file, which then both sed and cmp will
read consistently.

I'm not *entirely* sure this will fix the problem as I couldn't easily reproduce
the race locally, but I believe it at least fixes *a* race.
2017-05-08 11:27:09 +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
2b5af6a036 install: Make already-installed a warning, not an error
This seems to match what dnf and apt does, and it makes it
easier to ensure a set of apps are installed.
2017-05-04 13:48:27 +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
24cdbf51b9 Update to bubblewrap 0.1.8 for die-with-parent
This requires 0.1.8 if you use the system build and
updates the submodule to 0.1.8.
2017-05-04 10:40:29 +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
08397923bf remote-ls: Fix up the column titles
The index for these were wrong.
2017-05-04 10:16:21 +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
5cd90e416f builder: Fix ldflags support
Due to a cut-and-paste error we set it to cxxflags, not ldflags.
2017-05-04 09:42:52 +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
00e166250f Document the --file-forwarding option
This commit also documents the handling of rest arguments.
Previously, there was no information about what happens to ARG...
2017-05-03 13:27:52 +02:00
Matthias Clasen
20c40149af Enable file forwarding in flatpak run
Add a --file-forwarding option for the run command, which triggers
the rest argument processing that was implemented in the previous
commit.

This is how it is used:

flatpak run --file-forwarding --command=cat \
        org.gnome.Recipes @@ $HOME/todo @@

Note that the @@ are passed as separate arguments.
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
Matthias Clasen
1742881509 Generate fd-passing arguments for document portal
Add an annotation that lets us pass an fd-list to
the generated wrapper around Add(). This is more
convenient than calling the method manually.

Currently, we have no callers for the wrapper, so
this does not affect any other code.
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
AsciiWolf
5e854403f6 Fix man page typo 2017-05-03 12:39:52 +02:00
Alexander Larsson
a4b16255d5 info/list: Move subpath list to info
We just show "partial" on the list and then
the details are in flatpak info.
2017-05-03 11:28:07 +02:00
Alexander Larsson
fb6695e9a4 Add macros for common ANSI tty escape codes 2017-05-03 11:17:41 +02:00
Alexander Larsson
52be2e86c6 info: Use flatpak_fancy_output 2017-05-03 11:08:54 +02:00
Matthias Clasen
52f7d1b0f5 Update the man page a bit 2017-05-03 11:07:52 +02:00
Matthias Clasen
ae93d66d39 info: Preserve the previous output format
At least, to the extent that it is needed for tests to pass.
If any of --show-ref, --show-commit, --show-origin or --show-size
are given, emit the previous one-line format. Otherwise, use the
new, friendly multi-line format.
2017-05-03 11:07:52 +02:00
Matthias Clasen
91f48f51ae Don't use escape sequences unless on a tty 2017-05-03 11:07:52 +02:00
Matthias Clasen
35ca4534b3 Fix compiler warnings
Some unused variables.
2017-05-03 11:07:52 +02:00
Matthias Clasen
fb06477ff5 Improve info output
Emit more information, and format it in a better way.
2017-05-03 11:07:52 +02:00
Matthias Clasen
b176edcf07 remotes: Improve output formatting
Set column titles.
2017-05-03 11:06:43 +02:00
Matthias Clasen
4af266660c list: Improve output formatting
Set column titles, and align the size column.
2017-05-03 11:06:43 +02:00
Matthias Clasen
6d8e83f375 remote-ls: Improve the output
Add column titles, and align the size columns at the decimal point.
2017-05-03 11:06:43 +02:00
Matthias Clasen
c3e017d9de repo: Use the new number column support
This code was moved to the table printer itself.
2017-05-03 11:06:43 +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
Alexandru Băluț
ad4aada754 scripts: Fix flatpak-bisect log
The script was using stdout=subprocess.STDOUT but the Popen
documentation does not mention this as a valid value.

An exception was being thrown when running flatpak-bisect <name> log:
OSError: [Errno 9] Bad file descriptor
2017-05-02 15:01:19 +02:00
Matthias Clasen
363e03cb26 Make flatpak remote-ls show more details
Show the installed and download size for each ref,
when --show-details is given. The tabular display
could be improved by making FlatpakTablePrinter support
alignment at the decimal point.
2017-05-02 15:00:07 +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