Commit Graph

4687 Commits

Author SHA1 Message Date
Matthias Clasen
7022291045 info: Ellipsize end-of-life messages
These can be long, so ellipsize them.

Closes: #2499
Approved by: matthiasclasen
2019-01-11 18:33:52 +00:00
Matthias Clasen
ccd602dd19 Fix a compiler warning
The largest warning ever. Go clang!

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:45 +00:00
Matthias Clasen
0360fa84ef Adapt format_choices tests
The formatting has changed, and our tests catch that. Yay!
Also fix the build with glib master.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:45 +00:00
Matthias Clasen
9e27fc67fe testcommon: Add another table ellipsization test
This tests the situation when we can't accommodate
the requested width with the available shrinkage.

This used to cause an infinite loop in the table
printer.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:45 +00:00
Matthias Clasen
b095ca8ac6 datetime tests
Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:45 +00:00
Matthias Clasen
4ff95d94e8 build-export: Document that NOW is a valid timestamp
We may not want to guarantee all the formats that this
datetime parser accepts, but NOW seems useful enough and
is already mentioned in flatpak-build-commit-from(1).

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
a35030ab5e build-commit-from: Document missing options
Document --end-of-life, --timestamp and --disable-fsync.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
16cf081f97 tests: Add tests for app helpers
Link testcommon against libflatpak-app.la and
add tests for some utility functions.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
402e2020d8 Add a way to force fancy output on
This will be used for testing the table printer formatting.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
8391e4ac6f Build a convenience library for app helpers
This will let us write tests for some of these
functions.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
46e1f8f3b0 Add a test for some private utilities
Add another test that links against libflatpak-common.la
and tests functions that are not part of the public
library api.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
ed8fbbe6df testlibrary: Test a few new apis
Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
490924c5f0 tests: Add appstream version to test app
Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
9375872c82 Plug a small memleak
If we hit an unknown column, we were leaking
an already-allocated column array.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
7ce3eda5b5 build-finish: Validate --require-version argument
Use the same function that flatpak uses to parse this
field from metadata to ensure that we don't accept
invalid data.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
f39b5a2795 dir: Be more careful with self->repo
It is possible for self->repo to be NULL, therefore
call flatpak_dir_ensure_repo() in a bunch more places,
before accessing self->repo.

Closes: #2483

Closes: #2484
Approved by: matthiasclasen
2019-01-11 16:12:33 +00:00
Matthias Clasen
354bdc8955 Allow multiple choice when resolving installed refs
This is a bit more flexible than "All of the above",
in that it allows to select a subset of the available
choices.

Closes: #2559
Approved by: alexlarsson
2019-01-11 15:57:44 +00:00
Matthias Clasen
9ff489519c Add a utility to prompty for multiple choices
This is a variant that allows to enter multiple numbers,
either individually, or as range. Parts can be separated
by space or comma. Examples:
1-3,5
1 2 4
6

Closes: #2559
Approved by: alexlarsson
2019-01-11 15:57:44 +00:00
Matthias Clasen
5e6a6b6564 uninstall: Allow selecting all matches
Add a "All of the above" choice.
Might come in handy sometimes.

Closes: #2559
Approved by: alexlarsson
2019-01-11 15:57:44 +00:00
Alexander Larsson
a3d109de8f cli-transaction: Use Op instead of Change for title
This uses less horizontal space, given that all the elements in the
column is one-character strings. Also, Op seems to better describe this
than Change.

Closes: #2560
Approved by: alexlarsson
2019-01-11 14:51:44 +00:00
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