Commit Graph

2654 Commits

Author SHA1 Message Date
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
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
1577c1a08e repo: Set column titles
Set column titles when printing branch information using the
table printer.
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
ffef508830 repo: Improve formatting of size columns
Use the new aligned column support in the table printer.
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
Matthias Clasen
e958c15808 repo command: use FlatpakTablePrinter
This makes the output more similar to the other commands,
and will make us benefit from future improvements to the
table printer.
2017-05-02 14:56:04 +02:00
Matthias Clasen
17dd7b7861 Revise the flatpak repo command slightly
Make --info only print out general information, and add a new
option --branches which lists the per-branch information.
2017-05-02 14:56:04 +02:00