Commit Graph

1160 Commits

Author SHA1 Message Date
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
Matthew Leeds
4e81789167 Consistently use flatpak_load_http_uri()
Currently Flatpak has a few different implementations of helper
functions to download a URI using libsoup, but the best one seems to be
in common/flatpak-utils-http.c. So this commit deletes the others and
makes use of flatpak_load_http_uri() in place of download_uri() in a
few places. This has a couple consequences:
1) It means that we're now properly checking HTTP status codes rather
than assuming that the request was successful, in the install command,
remote-add command, and in FlatpakTransaction. This fixes an assertion
failure seen by a user when they tried to use a flatpakref URL that hit
a 404.
2) It means that in the places where we're using flatpak_load_http_uri()
we are only supporting http:// and https:// URLs not, say, file:// ones.
For the install and remote-add commands this was already being enforced.
For the handling of flatpakref files and bundles in FlatpakTransaction,
I believe it's just convention because it doesn't make much sense to
do anything else; this commit enforces that convention.

Also, add a unit test for the case of trying to install a flatpakref at
a URL that hits a 404 error.

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

Closes: #2740
Approved by: matthiasclasen
2019-03-06 23:44:50 +00:00
Alexander Larsson
26b6bb4990 build-update-repo: Add --no-update-[summary,appstream]
We'd like to use these in flat-manager for more detailed updates
of the repo.

Closes: #2730
Approved by: alexlarsson
2019-02-27 11:20:58 +00:00
AsciiWolf
75690a08bb Fix missing translatable string
Closes: #2724
Approved by: mwleeds
2019-02-25 22:10:10 +00:00
Matthew Leeds
e8816b7663 Remove extra newlines in variable definiton blocks
Uncrustify has an option "nl_func_var_def_blk" which is supposed to
ensure there's a newline character between the block of variable
definitions and the rest of the function body, but it gets confused and
thinks that the first instance of "g_autoptr" or "g_auto" being used on
a variable is the start of the function body. So this commit removes
those extra newline characters and removes that option in uncrustify.cfg
so they don't get re-added the next time uncrustify is run.

Here's the command I used:

perl -0777 -i -pe 's/\n(\n\s*g_auto\()/\1/g' `git ls-tree --name-only
-r HEAD | grep \\\.[ch]$ | grep -v common/valgrind-private.h |
grep -v app/flatpak-polkit-agent-text-listener\\\.[ch]`

I ran it again with "g_autoptr" in place of "g_auto", and made a few
manual edits to add back the newline when the g_auto* was in the middle
of a function body rather than at the top.

Closes: #2715
Approved by: matthiasclasen
2019-02-25 18:12:30 +00:00
Matthew Leeds
a0d3d65476 Remove extra newlines near curly braces
Edit uncrustify.cfg to add options to remove extra newlines near opening
and closing braces, and run uncrustify again.

Closes: #2715
Approved by: matthiasclasen
2019-02-25 18:12:30 +00:00
Matthew Leeds
8d962a686f Run uncrustify
I had to make a few manual edits but other than those the changes look
reasonable.

Closes: #2715
Approved by: matthiasclasen
2019-02-25 18:12:30 +00:00
Matthias Clasen
ce0981cb6d table printer: Use cell width, throughout
This should make it safe to use Escape sequences
in table content without messing up the alignment.

Closes: #2689
Approved by: alexlarsson
2019-02-14 09:12:40 +00:00
Matthias Clasen
71b5b66da6 Add utilities for 'cell width'
These functions are like g_utf8_strlen and g_utf8_offset_to_pointer,
but know to skip the Escape sequences we use.

Closes: #2689
Approved by: alexlarsson
2019-02-14 09:12:40 +00:00
Matthias Clasen
e9382b34bd cli transaction: Make the checks green
Success ought to be green.

Related: #2671

Closes: #2676
Approved by: mwleeds

Closes: #2689
Approved by: alexlarsson
2019-02-14 09:12:40 +00:00
Matthew Leeds
4607739677 Delete stray semicolons
Closes: #2703
Approved by: matthiasclasen
2019-02-14 06:14:59 +00:00
Alexander Larsson
2ea428a541 Revert "cli transaction: Make the checks green"
This reverts commit e209ac9e10.

We're counting thee escape sequences as width, until we fix
this we disable this.

Closes: #2686
Approved by: alexlarsson
2019-02-06 09:17:49 +00:00
Alexander Larsson
06a2f4d82d Actually always return non-null from flatpak_dir_get_display_name()
This also changes this to a non-const as we need to generate it.

Closes: #2683
Approved by: alexlarsson
2019-02-05 11:45:54 +00:00
Matthias Clasen
f8dfcf66f8 Only install polkit agent when needed
We don't need a polkit agent for simple things like
flatpak --installations. Only install it for running
actual commands.

Closes: #2679
Approved by: alexlarsson
2019-02-05 10:35:26 +00:00
Mathieu Velten
65634d214c build-init: use the sdk branch from the sdk ref when checking extensions
Closes: #2664
Approved by: alexlarsson
2019-02-04 09:51:54 +00:00
Matthias Clasen
e209ac9e10 cli transaction: Make the checks green
Success ought to be green.

Related: #2671

Closes: #2676
Approved by: mwleeds
2019-02-02 01:38:32 +00:00
Alexander Larsson
f74b54503a build-commit-from: Fix the collection-ref binding
We accidentally got an extra variant making the
type variant(a(ss)) instead of just a(ss).

Closes: #2666
Approved by: alexlarsson
2019-02-01 16:48:09 +00:00
Matthias Clasen
d5e2970725 cli transaction: Adapt to an api change
In f7a566e2ab, the flatpak_installation_get_display_name()
api was changed to (almost) always return a non-NULL string. Adapt
to this change, in order to use the preferred messages here.

Closes: #2655

Closes: #2668
Approved by: alexlarsson
2019-02-01 16:30:17 +00:00
AsciiWolf
6075a5e7d0 Make the Nothing to do. string translatable 2019-01-31 15:19:29 +01:00
Simon McVittie
ea227187d4 build-export: Allow sandboxing on icon validator to be disabled
During build-time tests, we can't rely on bwrap working.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #2661
Approved by: alexlarsson
2019-01-31 14:02:24 +00:00
Matthew Leeds
2b40e68e16 build-commit-from: Fix handling of ostree.collection-refs-binding
In a previous iteration of the work for supporting multiple collection
bindings on a commit[1][2] the key ostree.collections-binding was used,
but it was decided that ostree.collection-refs-binding makes more sense.
So update build-commit-from in one place where the old key was still
being used. This impact of this bug is that we would overwrite the value
of ostree.collection-refs-binding on the new commit with the one on the
source commit (which may not have all the same collection-refs
associated with it).  However since the libostree support for that key
hasn't been merged that wouldn't cause any problems yet.

[1] https://github.com/flatpak/flatpak/pull/2634
[2] https://github.com/ostreedev/ostree/pull/1805

Closes: #2644
Approved by: matthiasclasen
2019-01-29 23:04:54 +00:00
Alexander Larsson
ed71e4680c Handle versions of appstream-glib prior to 0.5.15
These don't have AS_BUNDLE_KIND_FLATPAK, but we can just
assume all bundles are flatpak bundles in the appstream data
we get from flatpak.

Closes: #2650
Approved by: alexlarsson
2019-01-29 10:19:28 +00:00
Alexander Larsson
441c1f52ea build-commit-from: Support --extra-collection-id
If this is passed, we add an extra collection id binding to
the commit, as well as create a separate ref for that particular
collection id.

This weakly depends on:
  https://github.com/ostreedev/ostree/pull/1805
In that without that change ostree pull will not respect
multiple collection-id bindings. It will still work for
the main/first collection id though.

Closes: #2634
Approved by: alexlarsson
2019-01-28 08:37:51 +00:00
Matthias Clasen
c9430b15f8 cli transaction: Use raw mode
We don't want line editing to interfere with our
formatting, so we turn on raw mode while we do
fancy progress reporting. We use raw mode at the
same times as we hide the cursor.

This should prevent partial Escape sequences from
showing up in the output.

Closes: #2638
Approved by: alexlarsson
2019-01-25 12:03:47 +00:00
Matthias Clasen
370c667887 columns: Be more precise and helpful
Complain about ambiguous suffixes, and and spell out
the allowed values when complaining about suffixes.

Closes: #2624
Approved by: matthiasclasen
2019-01-23 12:45:00 +00:00
Matthias Clasen
1770a7b600 Mention ellipsization in --columns=help output
Closes: #2624
Approved by: matthiasclasen
2019-01-23 12:45:00 +00:00
Matthias Clasen
350456abdd Turn off completion debug
This accidentally snuck in.

Closes: #2623
Approved by: matthiasclasen
2019-01-21 22:16:34 +00:00
Ryan Gonzalez
3333069a68 remote-delete: Avoid a "remote not found" error when deleting an -origin remote
Closes: #2626
Approved by: matthiasclasen
2019-01-21 22:02:35 +00:00
Ryan Gonzalez
26d2fb18fe remote-delete: Avoid deleting all refs
Fixes #2625

Closes: #2626
Approved by: matthiasclasen
2019-01-21 22:02:35 +00:00
Matthias Clasen
8f4d929e45 build-export: Use the --sandbox option for icon validation
Instead of setting up the sandbox ourselves, rely
on the --sandbox option to do so.

Closes: #2618
Approved by: alexlarsson
2019-01-21 09:17:29 +00:00
Matthias Clasen
52e511e501 info, remote-info: Use print_wrapped
This makes the NAME - DESCRIPTION line at the top
wrap nicely at word boundaries.

Closes: #2620
Approved by: alexlarsson
2019-01-21 09:01:22 +00:00
Matthias Clasen
6ad0332cca Make --columns more powerful
Allow to override ellipsization with a suffix on the colum.
Use
:s or :start for ellipsization at the start,
:m or :middle for ellipsization in the middle,
:e or :end for ellipsization at the end,
:f or :full for no ellipsization.
This can be helpful when it is important to see certain
columns in full.

Closes: #2621
Approved by: alexlarsson
2019-01-21 08:32:13 +00:00
Alexander Larsson
25c9a57ccb repair: Only warn about non-existing remotes for normal refs.
For example, someone today got warning messages for deploy refs:
 Remote (null) for ref deploy/runtime/org.freedesktop.Platform.html5-codecs/x86_64/18.08 is missing

Closes: #2611
Approved by: matthiasclasen
2019-01-18 15:02:56 +00:00
Matthew Leeds
ec61e6aac6 cli-transaction: Fix a typo
Closes: #2575
Approved by: alexlarsson
2019-01-17 07:40:29 +00:00
Matthias Clasen
f52d00f391 build-export: Use the icon validator
Validate all exported icons to be loadable png, svg or
jpeg files with a resolution of no more than 512x512.

Closes: #2523
Approved by: alexlarsson
2019-01-17 07:27:31 +00:00
Matthias Clasen
2f28a940b3 uninstall: Deal with empty installations
Don't let empty installations disrupt uninstall --all
or uninstall --unused. Just skip empty installations.

Closes: #2590

Closes: #2599
Approved by: mwleeds
2019-01-16 00:30:52 +00:00
Matthew Leeds
6bf47b4c26 app: Support DeployCollectionID in flatpakrepo
Unfortunately when I added the DeployCollectionID key for flatpakrepo
files I only added support for it in flatpak_dir_parse_repofile and
missed adding it to the remote-add command. So fix the oversight so that
flatpakrepo files that use the key are properly interpreted.

Closes: #2598
Approved by: matthiasclasen
2019-01-15 23:43:43 +00:00
Matthew Leeds
1ea2864088 Remove no longer needed #define directives
Now that we depend on libostree 2018.9, these aren't needed.

Closes: #2593
Approved by: matthiasclasen
2019-01-15 20:02:17 +00:00
Matthew Leeds
69a977d43a app: Properly return NULL not FALSE
This probably doesn't make any difference but at least the code is more
readable.

Closes: #2593
Approved by: matthiasclasen
2019-01-15 20:02:17 +00:00
Alexander Larsson
ba4463caea completion: Avoid read-past-start-of-string
This just reorders the check, so in practice it should make no difference
but it fixed a valgrind warning.

Closes: #2591
Approved by: alexlarsson
2019-01-15 12:13:15 +00:00