Commit Graph

4667 Commits

Author SHA1 Message Date
Matthias Clasen
b4e68422bf dir: Don't write to the console
In some cases, when NULL was passed for an OstreeProgress,
the library code would instantate its own progress object
and write progress information out to the console. That
is not a good thing for a library to do - it has the
potential to mess up the cli tools output.

Stop doing this, and require that all callers pass
a non-NULL progress.

Closes: #2468
Approved by: alexlarsson
2019-01-11 14:16:37 +00:00
Matthias Clasen
69d5692529 system-helper: Don't pass NULL for progress
When calling into FlatpakDir apis that take an
OstreeProgress, always pass a no-op instance,
never NULL.

Closes: #2468
Approved by: alexlarsson
2019-01-11 14:16:37 +00:00
Matthias Clasen
77bfe8493e Add column completion to all commands
Call flatpak_complete_columns for every command
that understands --columns.

Closes: #2445
Approved by: alexlarsson
2019-01-11 14:00:59 +00:00
Matthias Clasen
ff118dfbc6 completion: Add an api to complete columns
The new function, flatpak_compete_columns, takes an array
of Column structs and completes a --columns= option.

Unfortunately, bash completion does not let us do better
than repeating the entire list of columns for every
possible completion. This is not ideal, but at least
it gives good results for the first column.

Closes: #2445
Approved by: alexlarsson
2019-01-11 14:00:59 +00:00
Matthias Clasen
92b0ad5f7e Handle out-of-space errors nicer
Ostree just gives us a generic G_IO_ERROR_FAILED (boo!),
so we need to scrape the message to infer that this was
out-of-space. Translate this to an explicit error code
that we handle in the UI.

Closes: #2477
Approved by: alexlarsson
2019-01-11 13:46:31 +00:00
Matthias Clasen
b9a274c758 Update more tests
test-info.sh was needlessly relying on the exact output
of flatpak info --show-extensions. Update it to match the
new output.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
b8d0c2a0b6 Update tests
Some tests were depending on the exact flatpak info
output. Update them to match.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
4041bf5ac5 info: Minor cleanup
Use existing defines for metadata fields.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
5a60f69587 remote-info: Fix unicode formatting issues
printf(), and by extension, g_print() interprets
field width in terms of bytes, not characters.
Therefore, using %*s for padding strings with
non-ASCII characters does not work. Instead, use
the new utility function for aligned lines.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
b37a640aea info: Fix unicode formatting issues
printf(), and by extension, g_print() interprets
field width in terms of bytes, not characters.
Therefore, using %*s for padding strings with
non-ASCII characters does not work. Instead, use
the new utility function for aligned lines.

While we are doing this, also fix up the alignment of
the extension sections in the output.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
90ade7ad96 Add a utility for printing aligned
Add a new utility for printing

  TITLE: value

while properly handling Unicode wrt to alignment.

This will be shared between info and remote-info.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
d3447eb3fa table printer: Properly handle title width
Another case of printf field width not being Unicode
safe.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
b3ea2248c7 Fix a few utf8 oversights
We are allowing Unicode output, so we need to
use g_utf8_strlen whenever we want to count the
number of columns occupied by a string.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Ryan Gonzalez
d982f3c21b portal: Forward --devel from the calling instance (closes #2493)
Closes: #2515
Approved by: alexlarsson
2019-01-11 13:20:35 +00:00
Ryan Gonzalez
f9c9c14a5c Expose whether or not devel was used in .flatpak-info
Closes: #2515
Approved by: alexlarsson
2019-01-11 13:20:35 +00:00
Matthias Clasen
64e6764137 session-helper: Drop the unused RequestMonitor api
Nothing is using this now that we have RequestSession.
No need to carry this round.

Closes: #2533
Approved by: alexlarsson
2019-01-11 13:05:58 +00:00
Matthias Clasen
6abe5bef96 system-helper: Introduce a helper for errors
Be more systematic about returning FLATPAK_ERROR unmodified
and wrap everything else in a G_DBUS_ERROR_FAILED.

Closes: #2391

Closes: #2532
Approved by: alexlarsson
2019-01-11 12:50:56 +00:00
Matthias Clasen
6f77da3499 Add some tests for flatpak config
Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
d3b1b86f04 Add tests for ONE_DIR commands
Check that we consistenly reject specifying multiple
installations for commands that only accept one.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
4fc5f54075 Add some completion tests
Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
eb950c6502 update: Use ALL_DIRS for completion
It does not change the outcome, but it is nicer
to use the same value in coomplete as for the
main function.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
c58e21f30d repair: use ONE_DIR for completion
Since we only accept one dir here.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
75e809bb1a install: Use ONE_DIR flag
Since you can't really install in more than
one location at a time.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
207419b168 override: Fix completion for --system/--user
These options were not showing up in completion,
despite being accepted by the override command.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
ddd73c98e5 run: Fix completion for --system/--user
These options were not showing up in completion,
and, if present in the commandline, would prevent
further completion, despite being accepted by
the run command.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
d07e85d8ad info: Fix the --installation arg name
The info command has its own --system/--user/--installation
options, but it was not setting a name for the argument
of --installation. This was showing up in the completion
missing a '=' after --installation.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
d7d317dfe1 history: Complete --user/--system
This was missing from the completion function.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
456e1d569a tests: Ignore custom repos
I was seeing some issues because make check was
picking up a custom installation that was defined
in /etc/flatpak/installations.d/ on my system.
Avoid that by pointing FLATPAK_CONFIG_DIR at
a non-existing place.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
7ba9af1e24 Handle FLATPAK_CONFIG_DIR/remotes.d not existing
OSTree does not like being given a nonexisting directory
here, so check and pass NULL if thats the case.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
3f717cfb83 Move the typedef for FlatpakCompletion
Move this typedef to flatpak-complete.h, where it
belongs. Also add a autoptr definition for it and use
it to avoid leaking the completion in flatpak-main.c.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
76ca86b251 Cosmetics
Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
0f2c45be4d Drop flatpak_cli_transaction_was_aborted
We can look at the error that is returned
by flatpak_transaction_run, no need for this
cli-transaction specific api.

Note that we need to be a little careful to
return the expected error: when there is
an operation error, we need to return that,
instead of an ABORTED error.

Update all users.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
51a7643d41 Document the new options
Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
e1a68f9e8b repair: Use a quiet transaction
When reinstalling refs during repair, the formatted
output of FlatpakCliTransaction is not appropriate.
Use a FlatpakQuietTransaction instead.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
7fc4c5f93f install, uninstall, update: Add a --noninteractive option
When --noninteractive is given, use the new FlatpakQuietTransaction.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
a4ea1dc653 Fix a typo
I wonder how the compiler made sense of this.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
b070b3ccd7 Add FlatpakQuietTransaction
This is FlatpakTransaction subclass that doesn't ask questions
only talks the bare minimum.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
e1d634c0dd cli transaction: Drop flatpak_cli_transaction_run
We can just implement the run vfunc now, and chain up.

Update all callers to use flatpak_transaction_run.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
45860c56f2 transaction: Add a run vfunc
This lets us avoid extra api FlatpakCliTransaction.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
fd44da76e3 Drop flatpak_cli_transaction_install
Move this minor convenience api into its only user.
Using only generic FlatpakTransaction apis lets us
switch out transaction instances easily.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
497b784d21 doc: Add a missing comma
Fix a pervasively copied typo.

Closes: #2553
Approved by: matthiasclasen
2019-01-09 18:45:38 +00:00
Matthew Leeds
92d07b2f8d README: Tweak wording 2019-01-09 07:57:55 -08:00
AsciiWolf
8685c59249 Update Czech translation
Closes: #2550
Approved by: matthiasclasen
2019-01-09 13:32:39 +00:00
Matthias Clasen
d2301bed53 installed ref: Plug a few memory leaks
All the appdata strings were not freed. Oops.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
1dff114e1d info: Add a missing check
Don't consider 'Version:' for indentation when we
don't have version information to show.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
894d61a363 info: Show license information
This seems the right thing to do.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
d57ead8acd remote-info: Show license information
Keep in sync with the info command.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
6161a43f97 Add license to the appdata fields we extract
This was requested before, so might as well add
it at the same time.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
7914fac2fd Merge pull request #2546 from mwleeds/readme-tweaks
README: Tweak a few things
2019-01-08 23:06:19 -05:00
Matthew Leeds
3cf05140d6 fixup! README: Tweak a few things 2019-01-08 14:50:46 -08:00