Commit Graph

1199 Commits

Author SHA1 Message Date
Alexander Larsson
4ef72ab991 remote-add: Don't fail if metadata updates fail, just warn
This typically happens when the network is offline or in some weird
state.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
11c439cee2 Port flatpak remote-add to use flatpak_parse_repofile
We shouldn't be parsing this in two places in the code.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
1d49053e62 remote-add: Don't set xxx-is-set if the option comes from a flatpakrepo file
This is meant to mean that the user explicitly overrided it, and
that is not right for a flatpakrepo file.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
43aeb2499a flatpak remote-add: Special case if-not-exist to clear filter
If you're adding a remote with --if-not-exists and it exists,
apply the filter key anyway. Typically this is used to allow a
user to use the standard instructions to add a remote even if there
is a pre-existing filtered remote already configured.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
40cc39ebf6 add-remote: Support loading filter from .flatpakrepo file
This is kind of special as it handles non-existing filter keys
as "override to no filters" instead of "leave existing filters" whic
we do for other things. However, that matches how we want to use
.flatpakrepo files to override site-local filters.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
2bd55552b6 flatpak remote-modify add --filter and --no-filter options
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
9454e2d65e flatpak remote-add add --filter option
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
72a7f8aa4e flatpak remotes - show filter in list
There is an optional filter column, and a flag for filtered remotes in the
default options.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Simon McVittie
62629b44b8 app, common: Use glnx_readlinkat_malloc()
readlink() and readlinkat() have weird semantics (they return the
number of bytes they would have written if there was enough space,
even if that's larger than the buffer), but glnx_readlinkat_malloc()
takes care to do the right thing in all situations.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2873
Approved by: matthiasclasen
2019-05-01 16:39:18 +00:00
Matthias Clasen
5020790f53 Suppress debug output when completing
Any log output interferes with comletion.
We already refrain from installing our verbose
log handlers in this case, but we are still
vulnerable to GLib default message handling,
e.g. via the G_MESSAGES_DEBUG environment
variable. To avoid that, explicitly install
a message handler that suppresses all output.

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

Closes: #2862
Approved by: alexlarsson
2019-04-29 13:40:44 +00:00
Alexander Larsson
0a66707b00 remote-ls: Add --cached option
This prefers cached data, even if stale.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
8057de20a8 remote-info: Add --cached support
This prefers any cached data if available, even if its stale.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
6088c7d0a1 dir: Add support for getting remote state using only caches
If only_cached is TRUE we never do any network i/o, instead
returning ERROR_NOT_CACHED if this is necessary.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
131ba30ea9 cli: Drop unnecessary "something failed" message with --noninteractive
We reported the error already, just report the exit status.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson
e3db7a4461 cli: Make FLATPAK_ERROR_ABORTED return a failed exit code.
We now return a NULL error meaning nothing is printed as before
but a FALSE result which means the exist code marks the failure.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson
7eb6467e4d main: Allow flatpak_run() to fail with NULL error
This is very useful for the CLI where you want to fail the operation and
return a failure exit code, but the user actively chose to do so on
a prompt, so you don't need to print out anything.

Semantics are: if return FALSE => print error if non-null, then exit
with failure code.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson
c3f2fe3279 install/update: --noninteractive implies --yes
This mostly worked because QuietTransaction doesn't ask anything, but
some early checks in the commands itself only checked opt_yes.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson
e1f45a3878 Fix install --noninteractive not reporting errors
We need to handle operation_error and report errors, and for
fatal errors remember this and report a failure in run(), because
otherwise it returns ABORTED, which is treated as a failure (because
generally that meant the user chose "no" on some question).

Fixes #2839, #2757

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson
76898c4309 Enforce a more permissive umask
We enforce an umask of 022 (no world/group writable) in the cli and
the system helper. This is necessary, because we need to create
ostree repositories shared between the helper and the client, and
a more strict umask breaks this.

It would be nice if we could just set this in a thread-local way when
needed, but unfortunately umask() is not threadsafe or overridable in
any local way.

This unfortunately means this it will not automatically work for
libflatpak users...

Closes: #2856
Approved by: alexlarsson
2019-04-25 07:13:58 +00:00
Alexander Larsson
2ee4b87c55 remote-ls: Only show the origin column if non-unique
Most of the time it is the same because you specified the remote in
the command anyway.

Closes: #2852
Approved by: alexlarsson
2019-04-24 13:31:35 +00:00
Alexander Larsson
c84db7714e list/remote-ls/search: Split description field
Instead of combining name and comment we split them into two columns.
We also disable the comment column by default for list and remote-ls
as it is very poor in long tables. However, it is still there for search
where it seems more useful.

Also, the Application column title changed to Application ID to make
it clearer what it is compared to the "Name" column.

Closes: #2852
Approved by: alexlarsson
2019-04-24 13:31:35 +00:00
Matthew Leeds
bd18eab6ce create-usb: Delete local repo summary if it exists
Old versions of the create-usb command created a summary file in the
local repo being pulled from (e.g. /var/lib/flatpak/repo) but this
summary generation turned out not to be necessary and was removed. So
any computer which used the create-usb command before commit 7c5751a4f
will have a leftover /var/lib/flatpak/repo/summary file which becomes
outdated as apps are updated and installed. This causes problems for the
next invocation of (a recent version of) the create-usb command which
will use the outdated summary during the pull and fail with an error
message like:

error: Importing 3b1293596e9aa67f6fd0daeae477cb94603a4e8ca9e825f446d3dd04a2b5d5ec.commit:
fstatat(3b/1293596e9aa67f6fd0daeae477cb94603a4e8ca9e825f446d3dd04a2b5d5ec.commit): No such file or directory

So this commit makes the create-usb command delete the summary if it
exists before pulling onto the repo on the USB drive. This means USB
copies will work again for any users that used the USB app copy feature
in Endless OS 3.4.7.

Closes: #2854
Approved by: alexlarsson
2019-04-24 13:28:21 +00:00
Alexander Larsson
0b05a502a7 remote-ls: Don't list eol:ed app unless -a
Closes: #2853
Approved by: matthiasclasen
2019-04-23 16:07:13 +00:00
Alexander Larsson
5abe002f25 list: Skip origin column if all origins are the same
Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Alexander Larsson
277a443744 list: Skip arch column if all arches are the same
Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Alexander Larsson
05ac7f4833 CLI: Add skip_unique_if_default to Column
Additionally flatpak_table_printer_set_columns now takes a boolean
to say whether the arguments in use are the default.

Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Alexander Larsson
c25de61cd1 table-printer: Add support for skipping unique columns
If a column is marked skip_unique it will be entierly skipped
if all the rows have the same unique value for it. This is
useful for example to skip the arch column if all arches are
the same.

Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Matthias Clasen
51fce8eee7 permission-reset: Add an --all option
This lets users do a 'factory reset' of the permission store.

Closes: #2830
Approved by: alexlarsson
2019-04-23 07:54:06 +00:00
Matthias Clasen
d65ebf19f3 list: Add a runtime column
This is useful information, so we should allow showing it.

Closes: #2815
Approved by: alexlarsson
2019-04-12 09:13:34 +00:00
Umang Jain
e17b2635d6 run: Support migration from old app-ids to new app-id
flatpak run checks if there is any previous-ids for the app and
sees if there is a corresponding app-dir in ~/.var/app/ .
If so, it renames that app-dir to the new app-id and provides
a symlink from old app-id dir to new app-id dir, and exposes
these symlinks to the sandbox. The symlink is needed because even
though the XDG_DATA_DIR and other environment variables are set
to the new ID by flatpak run, the app itself could've stored
(eg in GSettings, or other files) paths which contained the old ID.

https://phabricator.endlessm.com/T23532

Closes: #2775
Approved by: alexlarsson
2019-04-12 08:59:35 +00:00
Ryan Gonzalez
7357b2bc63 cli-transaction: Use the new rebase support
Switch to the new eol signal and call flatpak_transaction_add_rebase()
if a rebase was requested.

Closes: #2775
Approved by: alexlarsson
2019-04-12 08:59:35 +00:00
Alexander Larsson
6d757f865e dir: Tweak flatpak_ensure_data_dir() function
Instead of returning the data dir it now takes it as an argument
This will help us later avoid recomputing it.

Closes: #2775
Approved by: alexlarsson
2019-04-12 08:59:35 +00:00
Alexander Larsson
b01a52e7c6 build-commit-from: Add support for--end-of-life-rebase=OLD=NEW
This lets you rebase an app, as well as other matching refs (OLD is
used as a prefix match) such as locale and debug extensions.

r your changes. Lines starting

Closes: #2775
Approved by: alexlarsson
2019-04-12 08:59:35 +00:00
Ryan Gonzalez
440bee1d51 build-export: Add --end-of-life-rebase
Closes: #2775
Approved by: alexlarsson
2019-04-12 08:59:35 +00:00
Alexander Larsson
889e3b862a build-update-repo: Support setting comment/description/homepage/icon
This just sets the option in the "flatpak" group, similar to how
the title works. Nothing uses this yet.

Closes: #2814
Approved by: alexlarsson
2019-04-10 14:34:32 +00:00
Alexander Larsson
69e869c9d2 Support comment/description/homepage/icon in remote-add too
Closes: #2814
Approved by: alexlarsson
2019-04-10 14:34:32 +00:00
Matthias Clasen
720ef6b72f repo: Show new remote config fields
Print out comment, description, homepage and icon if they are set.

Closes: #2812
Approved by: alexlarsson
2019-04-10 11:57:16 +00:00
Matthias Clasen
624099f039 remote-modify: Allow setting the new remote fields
Add --comment, --description, --homepage and --icon options.

Closes: #2812
Approved by: alexlarsson
2019-04-10 11:57:16 +00:00
Matthias Clasen
dc32aae658 remote-add: Add -is-set keys for the new fields
This lets us keep track of which fields have been
explicitly set.

Closes: #2812
Approved by: alexlarsson
2019-04-10 11:57:16 +00:00
Matthias Clasen
43b58b1b19 remotes: Add columns for flatpakrepo fields
Allow showing all information that we have
about remotes.

Closes: #2812
Approved by: alexlarsson
2019-04-10 11:57:15 +00:00
Matthias Clasen
ec9e55f140 remote-add: Store all .flatpakrepo keys
Application installers want to have access to
these fields to present repositories to the user,
so store them in our repo config, using xa.
prefixed keys.

Closes: #2812
Approved by: alexlarsson
2019-04-10 11:57:15 +00:00
Rafael Fontenelle
95e692794b Fix misspellings
Closes: #2807
Approved by: matthiasclasen
2019-04-08 12:50:42 +00:00
Matthew Leeds
0b20f3d48f run: Try to determine the branch if unspecified
Currently when the user doesn't specify a branch to the run command, for
apps it will use the current branch and for runtimes it just tries to
use "master" and fails if that doesn't work. Since runtimes don't have
current branches, it would be nice if we could determine the right one
to use rather than just erroring out. So this commit changes the
implementation so that it looks at each installed runtime and if only
one matches it is used. If there's more than one match the user is
prompted to choose. This is the first interactivity added to the run
command but I don't think that's an issue; any time it's run in a
non-interactive shell it will error out upon encountering ambiguity.

Also, add a couple unit tests for the success path and error paths.

Fixes https://github.com/flatpak/flatpak/issues/2780

Closes: #2788
Approved by: matthiasclasen
2019-03-30 13:02:10 +00:00
Matthew Leeds
ec234d7d6c app: Rename a variable for clarity
Calling this variable disable_interaction doesn't make sense because
there's still interaction if there's more than one option, so rename it
to assume_yes.

Closes: #2788
Approved by: matthiasclasen
2019-03-30 13:02:10 +00:00
Umang Jain
dcde1473d3 trivial: Use g_autoptr to automatically free GErrors
Closes: #2785
Approved by: matthiasclasen
2019-03-26 12:10:52 +00:00
Alexander Larsson
c9a7dd9425 Fix flatpak-list --arch
It was looking at the wrong part of the ref...

Closes: #2765
Approved by: mwleeds
2019-03-19 18:43:11 +00:00
Matthew Leeds
d690497549 cli transaction: Fix "required runtime found" prompt
On the next lines after this prompt we list each remote so it doesn't
make much sense to mention the first one in the prompt.

Closes: #2761
Approved by: alexlarsson
2019-03-19 13:44:29 +00:00
Alexander Larsson
d0026af959 build-update-repo: Add --static-delta-ignore-ref=PATTERN
This is useful if you don't want to e.g. generate deltas for debug
or source refs.
2019-03-12 14:53:36 +01:00
Alexander Larsson
aa978ea88a build-update-repo: Fix typo delete -> delta 2019-03-12 14:53:36 +01:00
Alexander Larsson
e3357bacad utils: Add some mtree helpers and rename create_root to something more correct
Closes: #2753
Approved by: alexlarsson
2019-03-12 09:08:12 +00:00