This seems nicer. We say we're looking for updates,
so we should give an update on what we found before
we return.
Closes: #2371
Approved by: alexlarsson
It turns out a transaction can contain operations, and still
nothing happened after it ran - when all operations are skipped.
We only know this when the transaction is fully resolved, but
we may call is_empty from the ready signal or after run returns,
and it seems nice to tell the truth then.
Closes: #2371
Approved by: alexlarsson
Revamp the FlatpakCliTransaction output to be closer to this:
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design
We only do this style of formatting when fancy output is possible.
For plain output, we don't redraw the table and only use '\r'
to rewrite the progress line in-place.
Closes: #2371
Approved by: alexlarsson
When we are given a with that is larger than the content we have,
expand the space between columns, within reason. We only make the
table at most 1.5 times as wide as it would be unexpanded.
Add a new API for setting individual columns to expand (or not).
For an expanding column, we'll grow the space between it and its
preceding column. The expand flag of the first column is ignored.
By default, columns do not expand.
Make flatpak_table_printer_print_full return not just the table
height, but also the width.
Update all callers.
Closes: #2371
Approved by: alexlarsson
Add a function to FlatpakTransactionProgress to get the
number of transferred bytes. This is useful information
to show during a long-running download.
Closes: #2371
Approved by: alexlarsson
This prints the common pattern of
Choices:
1) bla
2) bla
with consistent formatting, so we don't have
to worry about matching newlines and spaces
all over the codebase.
Closes: #2371
Approved by: alexlarsson
The spew of verbose messages makes a mess of any
attempt at formatted output, so lets not try.
Just disable fancy output when --verbose or
--ostree-verbose is used.
Closes: #2371
Approved by: alexlarsson
Add api to get the download and installed size
of resolved operations. This is useful information
to present to the user before running the transaction.
Closes: #2371
Approved by: alexlarsson
Make flatpak_dir_resolve_p2p_refs return the
download and installed sizes as well. This is
useful information to present to the user before
doing an install or update.
Closes: #2371
Approved by: alexlarsson
Add a way to change individual cells and a getter for the
current row. Also add a variation of the print() method that
returns the number of terminal rows that was generated
when formatting to given width, while skipping a number
of rows at the beginning. This method will be used in the
following commit to print a part of the table into a terminal
window of a given size.
Closes: #2371
Approved by: alexlarsson
Add a function to query the window size and cursor position,
and definitions for some more ANSI escape sequences that we
will use in the following commits.
Closes: #2371
Approved by: alexlarsson
Add a flatpak-spawn(1) man page. While it is not ideal
to have the docs live separately from the code, having
it here ensures that it will be available everywhere
all the other flatpak documentation is.
Closes: #2437
Approved by: alexlarsson
I could not work out at all how exposing files works,
until I looked at the code. Put enough details in the
docs to spare the next person this fate.
Closes: #2437
Approved by: alexlarsson
Portals need to validate all their arguments.
We were not validating flags at all, and were not
very careful with some of the other arguments
either.
Closes: #2439
Approved by: alexlarsson
There are some use cases where apps might legitimately need
to know the host values of xdg variables. Since we use them
for our own purposes, we can't just propagate them as-is.
Instead, set HOST_XDG_{DATA,CONFIG,CACHE}_HOME if the corresponding
xdg variables are set on the host.
Closes: #2424Closes: #2440
Approved by: alexlarsson
It happens sometimes that the first processed total is 1, when this gets
downloaded we have 100% already and then the total changes making this
percentage faulty.
This makes the progress regress sometimes, but I'd say it's better than
a permanent, ficticious number.
Fixes#2428
When we're prompting the user to choose between a list of items but
there's only one item, use a yes/no prompt and different wording.
Closes: #2426
Approved by: matthiasclasen
This avoids a crash or deadlock if the timeout is reached during test
teardown, after the GMainLoop has already been freed. That appears to
be more likely to happen when run as an installed-test.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://github.com/flatpak/flatpak/issues/2422Closes: #2425
Approved by: matthiasclasen
We ran into some issues on flathub where a build with very large
files caused the parallel delta generation to use a lot of paging,
essentially blocking progress. This option can at least allow you
to make progress in that case, although we should ideally have
a better solution.
Closes: #2416
Approved by: alexlarsson
There was a typo here: (gpointer *) pid_data should have been
(gpointer *) &pid_data, so that g_hash_table_iter_next() would make
pid_data a pointer to a PidData struct. Instead, the previous
implementation left pid_data set to NULL, leading to a NULL dereference
and segmentation fault whenever a name fell off the bus while a watched
client existed.
Instead of directly inserting the missing "&", I've used a pattern
that avoids needing the cast, in an attempt to make it more obviously
correct.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #2417
Approved by: matthiasclasen
Currently the flatpak install command reliably produces this error:
** (flatpak:21996): CRITICAL **: 22:38:52.472: polkit_unix_process_set_property: assertion 'val != -1' failed
This is caused by a recent patch to polkit[1] to address CVE-2018-19788,
which apparently means you can't pass -1 to
polkit_unix_process_new_for_owner() for the uid. So change Flatpak to
pass the actual UID instead.
[1] 2cb40c4d5fCloses: #2414
Approved by: alexlarsson