Commit Graph

4536 Commits

Author SHA1 Message Date
Alexander Larsson
28514f6fb9 list: Sort table by ref
Closes: #2450
Approved by: alexlarsson
2018-12-20 15:50:07 +00:00
Alexander Larsson
89650f503c table-printer: Add support for sorting rows
Closes: #2450
Approved by: alexlarsson
2018-12-20 15:50:07 +00:00
Alexander Larsson
1ff83a8a60 utils: Add flatpak_compare_ref
This compares the refs on a per-segment basis, so
org.foo.bar comes before org.foo.bar.suffix

Closes: #2450
Approved by: alexlarsson
2018-12-20 15:50:07 +00:00
Matthias Clasen
1d26870fa8 portal: Use the new --cwd option
The first argument of the Spawn portal call is the cwd
for the command to use inside the new sandbox. The portal
was mistakenly using it as cwd when running flatpak
on the host, which leads to errors. Fix this by
passing the cwd to flatpak via the new --cwdd option.

Closes: #2418

Closes: #2443
Approved by: alexlarsson
2018-12-20 15:35:24 +00:00
Matthias Clasen
f453544aaa Document the --cwd option
Closes: #2443
Approved by: alexlarsson
2018-12-20 15:35:23 +00:00
Matthias Clasen
ca9bd766e6 run: Add a --cwd option
Bubblewrap has a --chdir option to control the directory
that the command is run in. Add an argument for this to
the flatpak_run_app function, update all callers, and add
a --cwd option to flatpak run that uses this new argument.

Closes: #2443
Approved by: alexlarsson
2018-12-20 15:35:23 +00:00
Alexander Larsson
54d3ceb9b8 cli-transaction: Fix up sizing of download column
We need to take the "< " part into consideration when even when counting
the size of string without it, because they align the same. Otherwise
we cause the column to resize and wrap.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
830a750d20 cli: Limit length of progress bar
This limits the witdh of the progress bar, because it looked really
weird on a wide terminal and kept changing width as the text at the
end (speed, time left, etc) changed.

It is now never more than 20 chars wide, which is fine with the
new increase in fidelity using unicode blocks.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
4514286596 CLI: Use unicode chars in progress reporting
There are unicode full blocks and 1/8ths horizontal parts of a block, so
we can use this for the progress bar to get a lot more fidelity.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
0a825c298b Use unicode chars for in-table progress.
We use unicode chars like ✓, ⍻ and ✗ for the checkmark area in the table.
Also use an em-dash instead of minus in the spinner.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
c4e76f6374 table-printer: Handle utf8 correctly for string widths
We're counting characters, not bytes, so we need g_ut8_strlen() & co.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
8eb91968ff list: Add arch to default column set
Without this its impossible to tell apart e.g. multiple
runtimes for different arches.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
17a2174644 CLI: Rename Architecture => Arch in list headers
Its really wasteful to have headers much wider than the
items in the column.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
f57c46bf26 info: Move Sdk out of the commit group
Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
b732716c62 utils: Drop as_app_load_for_deploy()
This is not needed anymore

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
6ef03d91c4 list: Get appdata from the deploy data
Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
a0101e5468 info: Convert to use appdata from the deploy data
Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
504fcf3107 lib: Add support for appdata to FlatpakInstalledRef
This adds a function to load the full appdata.xml.gz, as well as
fast accessors to the pre-parsed fields.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
b20ee7e26a dir: Add new version of DeployData with parsed appstream data
We load the per-app appstream xml.gz during deploy and inject name,
summary and version from it into the deploy data. For older deploys
that don't have this data we re-create it when needed (with the hope
that updates to app eventually makes this unnecessary due to new deploys).

Additionally this removes the support for generating deploy files where
they don't exist, as support for this predates xdg-app 0.6, so should not
exist in real life.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Alexander Larsson
9a37475e76 deploy-data: Prepare for versioning
This adds a version to the deply data format, assuming that if
there is no version then it is 0. Also extends all loaders so that
it can specify a required version, with the goal that most users
are fine with old versions, but if you need more recent we have
a (costly) conversion process to upgrade (will be added later).

The library and the flatpak list/info commands require the most
current version for full info, all other users can use any version.

Also, as part of this we now pass the ref to flatpak_load_deploy_data()
as this will be needed later for the backwards compat support.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
d925ab396e Fix another compiler warning
Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
b9e082d0b4 Fix ci build
The polkit autoptr definition was causing an
unused function warning when building without
system helper support.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
4c42bc46b7 Fix oci registry tests
These were relying on details of the remote-ls output.
We can avoid this by explicitly specifying what columns
we want.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
d5c1668ffb tests: Be less picky about remote-ls output
We don't need to insist that the ref is the first column.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
05b2a0b2e3 remote-ls: Do away with most -d compat handling
It is not really worth preserving output 1-1 here,
we can just update the tests to accept the new output.

The one aspect we preserve here is that we don't show
the origin by default when only listing a single remote.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
1f64886c6e remote-ls: Update the docs
Add the new columns, and match column order
with --help output.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
99dbab082b remote-ls: Revise the output
Make the columns match the list columns. Add
description, version, arch, branch. Use the
expand and ellipsize capabilities of the table
printer.

This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
27cf46d8ea Fix test failures
test-repo.sh was needlessly assuming that the application ID
is the first column in flatpak list -d output. Other tests
don't do the same. This is why test-repo.sh was broken by
the addition of the description column in list output.

Change the test to remove that assumption.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
f53ad59ccf list: Update the docs
Add new columns, and update the example.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
a2841db0fb list: Revise the output
Add new description, installation and version columns,
revise the list of default columns, and make use of the
new ellipsization support in the table printer.

This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
479f4be01d remote-info: Revise the output
Show a description and show the appstream version,
and tidy up the formatting.

This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
7aed19e73a info: Revise the output
Show a description and show the appstream version,
and tidy up the formatting.

This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
cca8355b72 search: Update the docs
Document the --columns option as we do everywhere.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
9dd70d3744 search: Add columns
Add the standard --columns argument handling to search.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
a0f577862f search: Revise the output
This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
64b2bb33b1 Export a column helper
Make the find_column function public so we can use
it in more places.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
e843f63804 Add some appstream utilities
Add utilities to load an AsStore for a deployed app,
to get an AsApp for a ref, and to get various pieces
of information from an AsApp.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
f0d4665901 Add ellipsizing to the table printer
Optionally mark a column as ellipsizing.

Currently, this won't work correctly if more
than one column is ellipsizing.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
8d2f76e96e Add a string ellipsizing utility
Add a function to ellipsize a string to a certain length.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
883de69c09 repo, info, remote-info: Share timestamp formatting
Make format_timestamp() a shared utility,
instead of having 3 almost identical copies.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
1bab520197 Document FLATPAK_ID
Mention this environment variable in flatpak-run(1).

Closes: #2447
Approved by: alexlarsson
2018-12-19 14:35:39 +00:00
Matthias Clasen
f9a73904bd Set a custom prompt
Differentiate sandbox shells by a custom prompt.
We set FLATPAK_ID to the app id, and PS1 to a prompt
using it. PS1 can be overridden by runtimes or --env.

Closes: #2447
Approved by: alexlarsson
2018-12-19 14:35:39 +00:00
Matthias Clasen
8669182716 Fix a remote-ls option clash
When the --app-runtime option was added, we inadvertently
added a conflict between the short options for --all and
this new option. To fix this, remove the short option for
--app-runtime.

Closes: #2441

Closes: #2442
Approved by: mwleeds
2018-12-18 20:03:10 +00:00
Alexander Larsson
d85068aeb3 cli-transaction: Better handle resizes
The terminal size can change between two redraws, and this will also
cause the cursor to move, so we read the window size and current
cursor position each time we redraw instead of at the end of last redraw.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
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