Commit Graph

4492 Commits

Author SHA1 Message Date
Alexander Larsson
2255e7c73f table-printer: Don't print newlines for skipped rows
Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
9296f741bd update: Print a message if there were no updates
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
e7871a03c6 transaction: Try harder to identify empty transactions
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
b2fa8902fd install: Add a friendly message
The initial search for remotes and refs can take a while.
Provide a message similar to what we say for updates.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
3895eacab2 Implement a new commandline UX
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
908703d64a table printer: Add per-column expand api
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
3a3ec26ebf transaction: Add api to get the start time of progress
This lets us calculate the download speed, and estimated
time remaining.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
030eb4de3f transaction: Add api to get transferred size
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
3fe15ef665 table printer: Add a decimal cell setter
The download column really hsold be decimal, and we want
to update it while the download is running.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
11532d3f5b Use the new utility function throughout
This gives us consistency and improved output.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
a5b9b59c7b Add a utility for formatting choices
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
bc652bee99 Disable fancy output for --verbose
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
ba92cb7126 Add a way to disable fancy output
We disable fancy output when we can detect it,
but it is a good idea to have a way to explicitly
opt out too.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
19368bd00b transaction: Add api for sizes
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
03d197f302 p2p resolve: Return sizes as well
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
8fa0f73067 table printer: Add cell and row apis
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
732ee49fee Add some tty handling utilities
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
2018-12-18 14:50:26 +00:00
Matthias Clasen
970697f21c transaction: Add useful details to the docs
The guaranteed sequence of signals is useful information
for any user this api.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
5d068ab7f8 Fix another small memory leak
g_variant_iter_loop is tricky - if you exit the loop via
break or return, you have to clean up.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
ce8d976af2 system-helper: Plug a small memory leak
g_variant_loop only takes care of memory handling if
you don't jump out of the loop.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthew Leeds
a092c0784c README: Fix some punctuation
Use an em dash instead of two hyphens, so the Markdown isn't rendered as
a bullet point in the middle of a paragraph.
2018-12-17 13:42:11 -08:00
Matthias Clasen
0666e9fc25 Some tweaks to README wording
This reads a bit smoother in a few places.

Closes: #2438
Approved by: alexlarsson
2018-12-17 08:39:33 +00:00
Matthias Clasen
dc5a451389 Add docs for flatpak-spawn
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
2018-12-17 08:29:52 +00:00
Matthias Clasen
62332f9389 portal: Improve docs
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
2018-12-17 08:29:52 +00:00
Matthias Clasen
9a1febd981 portal: Suport a watch-bus flag
This behaves just the same as the watch-bus flag that
was reently added to HostCommand.

Closes: #2439
Approved by: alexlarsson
2018-12-17 08:16:42 +00:00
Matthias Clasen
f53ef41032 portal: validate arguments better
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
2018-12-17 08:16:42 +00:00
Matthias Clasen
07a0fd2811 Document the new env vars
Closes: #2440
Approved by: alexlarsson
2018-12-17 08:14:43 +00:00
Matthias Clasen
2a8a0ec69a Pass host xdg dirs into the sandbox
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: #2424

Closes: #2440
Approved by: alexlarsson
2018-12-17 08:14:43 +00:00
Matthias Clasen
d13211f5e6 Merge pull request #2434 from matthiasclasen/compiler-warning
Silence compiler warnings
2018-12-15 09:12:00 -05:00
Matthias Clasen
0261fb5d38 Silence compiler warnings
clang was complaining about a number of unused
variables in testlibrary.c. Drop them
2018-12-14 20:56:52 -05:00
Matthias Clasen
11a9bef97e Merge pull request #2432 from aleixpol/clangbuild
Fix build with clang
2018-12-14 15:55:51 -05:00
Matthias Clasen
041c99d834 Merge pull request #2431 from aleixpol/master
Don't use the last percentage if the total size changed
2018-12-14 13:35:59 -05:00
Aleix Pol
192066517c Fix build with clang
Fixes #2430
2018-12-14 18:50:05 +01:00
Aleix Pol
b6eddbccff Don't use the last percentage if the total size changed
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
2018-12-14 18:27:17 +01:00
Matthias Clasen
06019e357d Merge pull request #2427 from matthiasclasen/wording-tweak
Revise some strings slightly
2018-12-13 00:28:59 -05:00
Matthias Clasen
0a7fc79647 Revise some strings slightly
This reads better when seen in action.
2018-12-12 23:53:45 -05:00
Matthew Leeds
fa9225344e app: Make single-choice prompts friendlier
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
2018-12-13 04:30:48 +00:00
Matthias Clasen
df5b705941 Merge pull request #2419 from matthiasclasen/env-docs
doc: Mention xdg vars
2018-12-12 16:15:41 -05:00
Simon McVittie
4c92f5e3c1 testlibrary: Don't leak source IDs
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/2422

Closes: #2425
Approved by: matthiasclasen
2018-12-12 18:39:12 +00:00
Alexander Larsson
90dad12697 build-update-repo: Add --static-delta-jobs option
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
2018-12-12 16:15:16 +00:00
Matthew Leeds
aa19b18ee0 fixup! doc: Mention xdg vars 2018-12-11 21:32:00 -08:00
Matthias Clasen
f3748affc4 doc: Mention xdg vars
When I made the list of overridden environment variables,
I forgot the 3 most important ones, XDG_{DATA,CACHE,CONFIG}_HOME.
2018-12-11 23:36:19 -05:00
Simon McVittie
4111dbadaf session-helper: Don't crash on NameOwnerChanged
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
2018-12-11 15:43:37 +00:00
Matthew Leeds
5a7d13399f app: Avoid a critical libpolkit error
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] 2cb40c4d5f

Closes: #2414
Approved by: alexlarsson
2018-12-11 10:45:39 +00:00
Matthew Leeds
6e42104020 system-helper: Fix an outdated comment 2018-12-10 22:04:37 -08:00
Alexander Larsson
d39660da32 Update pofiles for release 1.1.1 2018-12-10 14:05:04 +01:00
Alexander Larsson
9d8216ece2 Fix memleak in flatpak_bwrap_bundle_args 2018-12-10 13:53:08 +01:00
Alexander Larsson
45171e0ab0 Fix memleak in get_locale_langs_from_accounts_dbus 2018-12-10 13:52:54 +01:00
Alexander Larsson
2248ced6f2 info: Fix memleak 2018-12-10 13:52:39 +01:00
Alexander Larsson
ddbc5266b8 Fix leak in build-finish
We already found the deploy_dir, no need to do it again.
2018-12-10 11:51:38 +01:00