Commit Graph

906 Commits

Author SHA1 Message Date
Matthias Clasen
ebe1403cd8 build-commit-from: Shorten usage text
The usage text should really fit on one line.
Reword the blurb to make that true at least for English.
2018-10-17 17:54:03 -04:00
Matthias Clasen
a99502a620 build-init: Improve error handling
Don't segfault if DIRECTORY does not look like a local path.
2018-10-17 17:54:03 -04:00
Matthias Clasen
aacc649158 build-bundle: Improve error handling
Don't fail in obscure ways if commandline options don't
look like files.

Closes: #2191
2018-10-17 17:53:50 -04:00
Matthias Clasen
8f5c43a784 history: Always handle --columns=help
The test for --columns was failing in ci because flatpak
gets built without libsystemd there. Avoid this by always
handling --columns=help nicely, even if libsystemd is not
used.

Closes: #2244
Approved by: alexlarsson
2018-10-15 06:51:58 +00:00
Matthias Clasen
4009466913 document-list: Handle --columns=help properly
In this case, the columns helper function returns an
empty array of columns. Exit cleanly without trying
to contact the documents service, in this case.

Found while writing tests.

Closes: #2244
Approved by: alexlarsson
2018-10-15 06:51:58 +00:00
Matthias Clasen
afc87ad1e5 Add a history command
The history command pulls the transaction log entries
out of the journal, and presents them nicely.

We use the sd-journal api for this, so we need to
link against libsystemd now, but we make the dependency
optional. If libsystemd is not available, the history
command will simply print an error.
2018-10-11 14:51:51 +02:00
Alexander Larsson
99fbbc25c6 build-finish: Inherit permissions from runtime by default
In version 0.99.1 (065053775b) flatpak
stopped inheriting permissions from the runtime, because that made
the story about application permissions way to complicated. What
we want is to have a static set of permissions for the app that
is frozen at install time.

However, inheriting permissions from the runtime makes a lot of sense
as certain permissions are required from the runtime, in particular this
is used by the kde runtime to read the kdeglobals file, etc.

So, to combine the best of the two worlds, we now do inherit permissions,
but at build-time (and you can disable it if you want). This way
kde apps don't have to repeat themselves, but we still get static
application permissions.

Closes: #2230
Approved by: alexlarsson
2018-10-10 15:40:58 +00:00
Matthias Clasen
24141bd093 Remove --show-columns leftovers
When I decided to add --columns without --show-columns,
I remove the option everywhere. Almost. These are the
leftovers I forgot.

Closes: #2227
Approved by: alexlarsson
2018-10-10 14:56:57 +00:00
Matthias Clasen
e9ffa9dda6 remote-ls: Show runtimes
Add a runtime column that shows the runtime an application
is using, and add an --app-runtime option to allow filtering
by the used runtime.

Closes: #2224
Approved by: alexlarsson
2018-10-10 10:29:08 +00:00
Matthias Clasen
3a01ca36cf config: Parse languages better
Do some actual checking on the value to prevent nonsense
from getting into the config.
2018-10-10 12:21:33 +02:00
Matthias Clasen
0febda1e6f list: Spell out subpaths
This is useful information when debugging language-related
issues.
2018-10-10 12:21:33 +02:00
Matthias Clasen
40f413836a Drop xdg-app migration support
It has been long enough. It is unlikely that we can still
find any xdg-app installations in the wild.
2018-10-10 12:20:27 +02:00
Matthias Clasen
c0708e7f0e Redo usage_error
Don't show full --help output, but just recommend
the right --help command to run.

Closes: #2209
Approved by: alexlarsson
2018-10-10 08:48:10 +00:00
Matthias Clasen
b9f6c9e78a Revamp command error handling
Don't show the full --help output immediately, instead
say 'see flatpak --help' and make a suggestion for a
misspelt command.

Closes: #2209
Approved by: alexlarsson
2018-10-10 08:48:10 +00:00
Matthias Clasen
eb2d9051b8 Add a Levenshtein distance implementation
No originality here, just a simple matrix-based implementation.

Closes: #2209
Approved by: alexlarsson
2018-10-10 08:48:10 +00:00
Matthias Clasen
22c5664f10 config: Improve error handling
Use usage_error for commandline-related errors,
as we do elsewhere. And be more specific in the
error messages.

Closes: #2203
Approved by: alexlarsson
2018-10-10 08:32:52 +00:00
Matthias Clasen
c269460ef9 config: Default to --list
When no option is specified, just do the reasonable thing.

Closes: #2203
Approved by: alexlarsson
2018-10-10 08:32:52 +00:00
Matthias Clasen
36d5134e97 enter: Allow giving application ID
With the instance infrastructure, we can go from
the ID of a running application to its monitor PID,
so we can accept the application ID here. Whats more,
we can offer completion for it.

Note that completion only works if you use sudo -E,
since the flatpak used for complcations needs to see
the session environment to find running instances.

Closes: #2181
Approved by: alexlarsson
2018-10-10 06:28:28 +00:00
Matthias Clasen
9c84b88e46 Add a kill command
This sends SIGKILL to a running sandbox process.
The command has completion for running applications,
for both application IDs and instance IDs.

Closes: #2180

Closes: #2181
Approved by: alexlarsson
2018-10-10 06:28:28 +00:00
Matthias Clasen
17aededa45 document-list: Add --columns option
Use the same pattern we use elsewhere, and allow
selecting columns to display. And add some more columns.

Closes: #2193
Approved by: alexlarsson
2018-10-08 09:16:09 +00:00
Matthias Clasen
41ff62072e document-list: Some restructuring
This is in preparation for using the table printer.

Closes: #2193
Approved by: alexlarsson
2018-10-08 09:16:09 +00:00
Matthias Clasen
189d22c0db repo: Avoid a compiler warning
Initialize mode_string. Its the right thing to do.

Closes: #2192
Approved by: alexlarsson
2018-10-08 09:01:21 +00:00
Matthias Clasen
dd546ad365 Make FlatpakInstance api public
This can be of use in frontends like GNOME Software.

Closes: #2201
Approved by: alexlarsson
2018-10-08 08:36:23 +00:00
Matthias Clasen
170a8774bc remote-ls: Add --columns option
This is more flexible than --show-details.

Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
f8c69e5b01 remotes: Add a --columns option
This is more flexible than --show-details.

Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
c0d858748b list: Add a --columns option
This is more flexible than --show-details.

Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
6a199ddeb4 ps: Port to column helpers
Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
259e438d4b Add table printer convenience api for columns
This code is repeated in ever single command using
columns, so lets pull it into a utility function.

Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
498870c3dd Add helpers for dealing with --columns
Since we will have multiple commands with this style
of option, lets establish some common utilities.

Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
ff91bcf007 repo: Add a --commits option
Show commits for a branch in a similar format
to ostree log. We also show static deltas when
they are available.

Closes: #2156
Approved by: alexlarsson
2018-10-05 13:49:52 +00:00
Matthias Clasen
6c6c279730 repo: Add some debug spew
It is useful to know where the wrong data I'm seeing
comes from.

Closes: #2156
Approved by: alexlarsson
2018-10-05 13:49:52 +00:00
Matthias Clasen
8509810171 repo: Default to --info
If no options are specified, print general info.
Otherwise, the command is a bit useless.

Closes: #2156
Approved by: alexlarsson
2018-10-05 13:49:52 +00:00
Matthias Clasen
f6b338286b repo: Add a newline after metadata
Without this, we can end up with the shell prompt
getting tucked behind the last line of the metadata,
which is confusing.

Closes: #2156
Approved by: alexlarsson
2018-10-05 13:49:52 +00:00
Matthias Clasen
79b7d436fe repo: Add repo mode to --info
This information is easily available, might as well show it.

Closes: #2156
Approved by: alexlarsson
2018-10-05 13:49:52 +00:00
Matthias Clasen
f3a3ea9c67 list: Add an option to filter by runtime
This lets you use list --app --app-runtime=org.gnome.Platform//3.24
to see which apps on your system still depend on this old runtime.

Closes: #2175
Approved by: alexlarsson
2018-10-05 13:36:33 +00:00
Matthias Clasen
3f0eb7e481 transaction: Fix up a signal signature
We were emitting the ::operation-done signal with
different arguments than declared for the signal.
This showed up as test failure when comparing
the result argument.

Closes: #2187
Approved by: alexlarsson
2018-10-05 13:34:49 +00:00
Alexander Larsson
bdf5c87429 tables: Avoid trailing spaces
In a table, if some row is wide then *all* rows will be that wide
with spaces at the end. This is not great in e.g. the remote-ls
case where one row has a long EOL message.

This commit strips all the trailing whitespace from each row to avoid
this.

Closes: #2189
Approved by: alexlarsson
2018-10-05 11:22:18 +00:00
Matthew Leeds
7c5751a4f9 create-usb: Avoid updating the source repo summary
This commit removes the call to flatpak_dir_update_summary() in the
create-usb implementation. It turns out that libostree does not rely on
a summary being present when a pull is local (meaning it uses a file://
URI). I'm not sure where I got the idea that create-usb depends on a
summary in the source repo. I went back to the first commit that
introduced the "ostree create-usb" command and even using that a summary
isn't required, so it seems unlikely that this changed recently.

One important benefit of removing the summary update is that currently
summary generation takes an exclusive lock, and we've seen on Endless
the attempt to acquire that lock time out (possibly due to a prune
happening in another process).

We could also remove the system-helper method UpdateSummary since it
doesn't have any users after this commit, but maybe someone will need it
in the future, and technically removing it would be an API break.

Closes: #2166
Approved by: alexlarsson
2018-10-02 06:32:54 +00:00
Matthias Clasen
651c86d3c6 run: Allow selecting an installation
It may be an unlikely case, but if the same app
is installed in multiple installations, there was
no way to select which one to run, so far.

Closes: #2146

Closes: #2158
Approved by: alexlarsson
2018-10-01 13:05:12 +00:00
Matthias Clasen
6c806f2dd9 repo: Don't use remote ostree-metadata
The code was looking for a ref with the name
ostree-metadata, but using an api that falls
back to remote refs with the same name, which
is not desirable here.

Use a different ostree api instead that only
resolves local refs.

Closes: #1805

Closes: #2157
Approved by: alexlarsson
2018-10-01 11:40:37 +00:00
Matthew Leeds
b0ee220d02 uninstall: Refine definition of what is used
Currently it's possible for Flatpak to consider a runtime used but
consider its Locale extension unused when executing `flatpak uninstall
--unused`, which doesn't make much sense.  This only happens if the
runtime is indirectly used; in other words it's used as a related ref
rather than directly as the runtime of an installed app.

In the case of Endless, `com.endlessm.EknServicesMultiplexer` uses all
versions of `com.endlessm.apps.Platform`, and since v1 isn't used by any
app on this computer its Locale extension is considered unused:

$ flatpak list --runtime -a | grep com.endlessm.apps.Platform.*/x86_64/1
com.endlessm.apps.Platform.Locale/x86_64/1      system,partial
com.endlessm.apps.Platform/x86_64/1     system
$ flatpak uninstall --unused
Uninstalling from system:
com.endlessm.apps.Platform.Locale/x86_64/1
Is this ok [y/n]:

This commit changes the behavior of uninstall --unused so that when
something is considered used because it's a related ref, we recursively
check its own related refs so they are considered used too.

Closes: #2103
Approved by: alexlarsson
2018-10-01 10:58:21 +00:00
Alexander Larsson
167bf49ccf build-init: Record the base ref in the metadata
This information is nice to have. For example, it can be used
to optimize deltas by reusing delta parts from the base ref.

Closes: #2140
Approved by: alexlarsson
2018-09-26 12:21:09 +00:00
Matthias Clasen
5213645f58 Split a file
Split flatpak-builtins-add-remote.c into separate files
for the two commands that are defined in here, and rename
things to match the other commands.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
dd822f2781 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
ddbf0103c6 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
de2c69c728 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
356742c7e7 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
86634cfece Rename a file
To avoid unnecessary confusion, rename flatpak-buitins-repo-update.c
to match the command thats defined in it.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:41 +00:00
Matthias Clasen
8f9aa2f35f Fix a thinko in the permission commands
Better to only call g_dir_close() if dir isn't NULL.

Take this opportunity to move the function to utils,
instead of carrying 4 identical copies.

Closes: https://github.com/flatpak/flatpak/issues/2130

Closes: #2133
Approved by: alexlarsson
2018-09-25 12:17:16 +00:00
Matthew Leeds
9091749a27 create-usb: Always use archive mode
Change the create-usb command so that it always creates the destination
repository using the "archive" mode, rather than using archive mode when
xattrs aren't supported and bare-user otherwise. This has a few
advantages:

1. The archive mode works with FAT filesystems, which is what most USB
drives are, and which doesn't support xattrs. This should fix
https://github.com/flatpak/flatpak/issues/2019 but it would be good to
confirm.

2. At least in some quick testing I did, archive mode is about twice as
performant as bare-user mode, in terms of how long it takes for the
create-usb command to complete.

3. This ensures that a tool can safely change the permissions on
".ostree/repo" and subdirectories after create-usb completes, which is
important for Endless since otherwise you can't use `ostree create-usb`
as root and then `flatpak create-usb` as a non-root user on the same USB
drive (or in other words copy OS updates and apps to the same USB).

Closes: #2124
Approved by: alexlarsson
2018-09-24 08:44:24 +00:00