Commit Graph

658 Commits

Author SHA1 Message Date
Alexander Larsson
3c9d3a316e Fix incorrect error message in update --appstream
When the specified remote existed, but had no updates we printed
a message like:  error: Remote "flathub" not found

Closes: #1363
Approved by: alexlarsson
2018-01-30 10:54:28 +00:00
Matthew Leeds
6c9d43d67f remote-info: Show collection ID if available
If flatpak is compiled with P2P support and the commit in question has a
collection ID in its metadata, show it.

Closes: #1312
Approved by: alexlarsson
2018-01-24 09:58:16 +00:00
Matthew Leeds
bf07d6b596 remote-info: Fix --show-metadata behavior
When the --show-metadata option is used with remote-info, the metadata
variable is never initialized, causing flatpak to print "(null)". This
commit makes sure the variable is properly initialized so the metadata
prints correctly.

Closes: #1313
Approved by: alexlarsson
2018-01-24 09:48:51 +00:00
Matthew Leeds
d9e4041eb1 app: Fix "multiple installations" prompt
When a remote is found in multiple installations and we ask "Which do
you want to use (0 to abort)?", the 0 choice isn't working because the
min value in the call to flatpak_number_prompt() was set to 1. Fix that
so the user can abort if they want.

Fixes https://github.com/flatpak/flatpak/issues/1305
2018-01-14 23:33:43 -08:00
Philip Withnall
6f5fef5501 app/main: Fix error handling for getting system dir list
The error wasn’t being propagated properly, leading to a NULL pointer
dereference.

Coverity CID: 1463075

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1267
Approved by: alexlarsson
2017-12-20 13:03:37 +00:00
AsciiWolf
9e92bef562 main: Fix typo in translatable string
Closes: #1260
Approved by: mwleeds
2017-12-15 23:52:54 +00:00
Alexander Larsson
659b02011a install: Support local paths/uris
If the remote is a local path (absolute or relative starting with ./)
then we convert this to a file: uri, which are now supported to
install directly from a local repo.

This is very useful when testing locally built apps.

Closes: #1244
Approved by: alexlarsson
2017-12-14 09:27:22 +00:00
Alexander Larsson
6e17756db6 install: Handle passing a file: uri as remote
Closes: #1244
Approved by: alexlarsson
2017-12-14 09:27:22 +00:00
Alexander Larsson
3ade86b292 install: Add --reinstall
If you're installing something and its already installed, we undeploy
the old install first before deploying the new. This makes it very
easy to switch an application from one remote to another, without
having to uninstall first, which is both painful and could cause
the download to be unnecessary large.

Closes: #1241
Approved by: alexlarsson
2017-12-14 09:04:38 +00:00
Alexander Larsson
97683cfbe1 override: Support global overrides
This lets you add overrides that affect all applications. Application
overrides have higher priority so will override the global overrides.

Closes: #1245
Approved by: alexlarsson
2017-12-14 08:49:23 +00:00
Alexander Larsson
2d1c4fd72b build-export: scan repo for hardlinks on commit
This is a no-op on regular (archive) repos, but on bare repos it is
an optimization if the source is a checkout from the repo. This
happens in flatpak-builder (https://github.com/flatpak/flatpak-builder/pull/81)
when it commits the build to the cache during --install without --repo.

Closes: #1249
Approved by: alexlarsson
2017-12-14 08:37:23 +00:00
Alexander Larsson
4e9c031005 update: Add information on wheter updates are per-user
Now that flatpak update does both per-user and systemwide
per default it makes a lot of sense to say which one is being
updated.

Closes: #1248
Approved by: alexlarsson
2017-12-14 08:20:34 +00:00
Alexander Larsson
62df4e083f update: Don't print progress when pulling appstream
This is just noise, these should not be large.

Closes: #1248
Approved by: alexlarsson
2017-12-14 08:20:34 +00:00
Alexander Larsson
d56491766b update: Only update appstream if there are changes
This way we don't even pull if the summary has the same version
as the local version.

Closes: #1248
Approved by: alexlarsson
2017-12-14 08:20:34 +00:00
Alexander Larsson
5eca1836cb Fix clang warning
I got this:
app/flatpak-main.c:364:20: warning: variable 'dir' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          else if (opt_installations != NULL)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
app/flatpak-main.c:374:34: note: uninitialized use occurs here
          g_ptr_array_add (dirs, dir);
                                 ^~~
app/flatpak-main.c:364:16: note: remove the 'if' if its condition is always true
          else if (opt_installations != NULL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
app/flatpak-main.c:358:26: note: initialize the variable 'dir' to silence this warning
          FlatpakDir *dir;
                         ^
                          = NULL

However, that is never hit, its just the compiler being confuses, so we add a
g_assert_not_reached() in the last else case.

Reachability analysis:

If opt_installations is != NULL we will at the very least take the
last if, and if opt_installations == NULL, we will take the first one
if !opt_user, and the second if opt_user.

Closes: #1251
Approved by: alexlarsson
2017-12-14 08:05:57 +00:00
Alexander Larsson
d7bb6d226d remote-info: Properly display an empty history
We were lacking a newline at the end in case the history was
empty.

Closes: #1250
Approved by: mwleeds
2017-12-14 07:01:20 +00:00
Alexander Larsson
e769cdd489 update: Update apps from both system and user installations
Unless you manually specify an installation it looks for updates
in all the standard installations.

This fixes https://github.com/flatpak/flatpak/issues/282

Closes: #1246
Approved by: alexlarsson
2017-12-13 10:03:47 +00:00
Alexander Larsson
1669d9d0a9 build-export: There is no need for the metadata file to be executable
Using 644 instead of 744 matches how flatpak-builder initially creates
this, and makes more sense in general.

Closes: #1239
Approved by: mwleeds
2017-12-13 08:51:07 +00:00
Matthew Leeds
cf732bf901 remote-modify: Remove obsolete code
Now that flatpak_resolve_duplicate_remotes checks if a remote exists, we
don't need to use ostree_repo_remote_get_url to do so. This commit
doesn't change the behavior for remotes with empty URLs (which means
they're disabled), because the empty string is an allowed value as far
as OSTree is concerned.

Closes: #1247
Approved by: alexlarsson
2017-12-13 07:38:28 +00:00
Matthew Leeds
33aaffa328 remotes: Use STANDARD_DIRS in complete function
We should use the same flags for the flatpak_option_context_parse() call
in flatpak_complete_list_remotes as we do in
flatpak_builtin_list_remotes, so the options are parsed correctly.

Closes: #1205
Approved by: alexlarsson
2017-12-12 15:26:41 +00:00
Matthew Leeds
b3828eea46 app: Make remote commands smarter wrt installations
Currently "flatpak remotes" shows remotes across user and system
installations, but other remote commands (remote-delete, remote-modify,
remote-ls, remote-info) only work on one installation: the system one
unless overridden using --user or --installation. This commit changes
each command to infer the correct installation by checking which has
the specified remote. In case multiple installations have remotes by
the same name, the user is prompted to decide which to use.

This commit also adds unit tests and updates the man pages for the
aforementioned commands.

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

Closes: #1205
Approved by: alexlarsson
2017-12-12 15:26:41 +00:00
Matthew Leeds
8a59927fde app: Move installation management to flatpak-main.c
Some builtin flatpak commands work on a single installation, and others
work on multiple installations (such as the remotes command that lists
both system and user remotes). Currently flatpak_option_context_parse()
only supports returning one installation to its caller, and any commands
that want to support multiple installations have to implement that
themselves which leads to a lot of code duplication.

This commit changes flatpak_option_context_parse() to take three new
flags:

    * FLATPAK_BUILTIN_FLAG_ONE_DIR maintains the old behavior by
returning one installation (i.e. user if --user was passed, system if
--system, etc.).

    * FLATPAK_BUILTIN_FLAG_STANDARD_DIRS will get all the installations
specified by the options, or the user and system ones if none were.

    * FLATPAK_BUILTIN_FLAG_ALL_DIRS includes non-default system
installations along with the user and system ones if none were
specified.

These flags also affect what options are parsed and whether the
directories are ensured to exist, so it makes sense in some
circumstances for callers to pass a NULL out_dirs even when not using
FLATPAK_BUILTIN_FLAG_NO_DIR.

This commit also changes all the callers of
flatpak_option_context_parse() so they maintain their behavior. The only
functional change introduced by this is that using --installation
multiple times for commands that only support one now leads to an
error emitted by flatpak rather than by g_option_context_parse().

A follow-up commit will use this refactoring to make many commands
behave more intelligently in determining which installation to use.

Closes: #1205
Approved by: alexlarsson
2017-12-12 15:26:41 +00:00
Alexander Larsson
5815d5e92c update: Don't update appstream for non-enumerable remotes
That doesn't make any sense to do and is likely to get you
errors.

Closes: #1240
Approved by: alexlarsson
2017-12-12 14:27:13 +00:00
Matthew Leeds
bae681d0a9 app: Fix typo in error message
Fixes https://github.com/flatpak/flatpak/issues/1225
2017-12-11 16:18:26 +01:00
Matthew Leeds
4f1af61d06 docs: Document remote-ls without REMOTE
The "flatpak remote-ls" command can be used without specifying a remote,
so change the man page and --help output to reflect that.

Closes: #1210
Approved by: alexlarsson
2017-11-27 08:19:51 +00:00
Matthew Leeds
8ab3394a9b config: Fix comment in flatpak_complete_config 2017-11-25 15:47:03 -08:00
Matthew Leeds
f651d40b06 remotes: Delete rogue comment 2017-11-24 18:20:25 -08:00
Patrick Griffis
50fbafa202 search: Try to support appstream-glib as old as 0.5.10 (Ubuntu LTS)
This disables some less than essential features and re-implements
the rest.

Closes: #1199
Approved by: alexlarsson
2017-11-24 15:44:11 +00:00
Alexander Larsson
6bb0196ffd Make flatpak remote-add --system work with an empty /var/lib/flatpak
This means flatpak can bootstrap itself from an empty /var on stateless
systems, which fixes https://github.com/flatpak/flatpak/issues/113, at
least for the CLI case.

Closes: #1195
Approved by: alexlarsson
2017-11-24 10:54:25 +00:00
Alexander Larsson
55bc8c904f main: Add new flag FLATPAK_BUILTIN_FLAG_OPTIONAL_REPO
This replaces the old unused FLATPAK_BUILTIN_FLAG_NO_REPO with a
version that tries to init the repo, but doesn't fail otherwise.

Also, we drop the explicit flatpak_dir_ensure_path() call, because
flatpak_dir_ensure_repo() calls that anyway.

Closes: #1195
Approved by: alexlarsson
2017-11-24 10:54:25 +00:00
Alexander Larsson
87b6aeec16 info: Add fields to match remote-info
This adds the Date, Subject and Parent fields that are shown
by remote-info so these match for the fields where it makes sense.

Closes: #1192
Approved by: alexlarsson
2017-11-24 07:54:26 +00:00
Matthew Leeds
3b434a9673 search: Log access of flatpak directory
This changes the search command to print debug output when accessing a
flatpak directory, to match the behavior of other commands.

Closes: #1186
Approved by: TingPing
2017-11-22 06:44:56 +00:00
Matthew Leeds
d9061fa276 search: Support --installation=NAME option
The other commands that support --user and --system allow you to specify
an installation using --installation, so this makes search consistent
with that.

Closes: #1185
Approved by: TingPing
2017-11-22 06:36:37 +00:00
Matthew Leeds
b3cb71222b remote-info: Fix help string
flatpak remote-info works for available apps and runtimes. They don't
have to be installed.

Closes: #1184
Approved by: mwleeds
2017-11-21 17:34:34 +00:00
Alexander Larsson
0a9ae464f6 Add remote-info command
This shows information about a ref in a remote. Of particular interest
is the --log option which gives you a history which can be used
with update --commit=XXX to roll back an update.

Closes: #1174
Approved by: alexlarsson
2017-11-21 11:16:06 +00:00
Alexander Larsson
c6c3775bbe Default to no gpg for --oci remotes
OCI doesn't really support this atm anyway, instead it relies on TLS.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00:00
Alexander Larsson
d6ea398dd5 Remove GPG signatures handling for OCI images
This is not really standardized for now, and most registries
depend on TLS security instead.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00:00
Alexander Larsson
c3b155b09a Use the new metastore index API for OCI remotes
This means the url of the remote is a service supporting:
 https://github.com/owtaylor/metastore/blob/master/docs/protocol.md

And we use that to find all flatpak images and the repository url
itself.

This also add support for docker-v2 registries that support OCI
images.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00:00
Alexander Larsson
12e68e7cec Add --readonly switch to flatpak build
This makes /app (or other destinations) read-only, which will be
later used by flatpak-builder when running tests, that should not
affect the build.

Closes: #1172
Approved by: alexlarsson
2017-11-16 16:13:48 +00:00
Alexander Larsson
4c91eeeada Change debug prefix from XA to F
We're not xdg-app anymore

Closes: #1173
Approved by: mwleeds
2017-11-16 08:15:15 +00:00
Alexander Larsson
763c27b008 Initialize variable for the !FLATPAK_ENABLE_P2P case
This variable is never actually read, as it is protected by
the ostree_metadata_checksum check, but some compilers warn about it.

Closes: #1178
Approved by: mwleeds
2017-11-16 07:58:46 +00:00
Alexander Larsson
105f00b918 Update appstream data on "flatpak update" (#1169)
* Update appstream data on "flatpak update"

This is especially useful since we now have flatpak search which uses
this data.

* fixup! Update appstream data on "flatpak update"
2017-11-15 21:23:55 -08:00
Alexander Larsson
a6f65d3b7c Add --log-*-bus to flatpak build
Closes: #1160
Approved by: alexlarsson
2017-11-14 11:57:30 +00:00
AsciiWolf
b0cf7baefd Add colon to the Uninstalling string
Closes: #1163
Approved by: alexlarsson
2017-11-13 14:17:30 +00:00
AsciiWolf
6f186e5987 Make the Uninstalling string translatable
Closes: #1163
Approved by: alexlarsson
2017-11-13 14:17:30 +00:00
Matthew Leeds
686d7cfccc search: Check substrings of app IDs, not just prefixes
Due to the way as_app_search_matches() works, "flatpak search" only
checks if the search text is a prefix of an element of the app ID, not
if it's any substring. Add a substring check, so for example you can
find SuperTuxKart using "flatpak search tuxkart".

Closes: #1161
Approved by: TingPing
2017-11-11 02:23:56 +00:00
Alexander Larsson
ec40383e5f Better phrasing for remote add prompt
As proposed in https://github.com/flatpak/flatpak/issues/1141

Closes: #1157
Approved by: mwleeds
2017-11-09 23:49:36 +00:00
Philip Withnall
58157e7ec7 ls-remote: Fix crash when ostree-metadata ref exists in remote
The code assumes that *all* refs in a remote contain a slash, which
technically is not the case, and pragmatically is definitely not the
case once the remote has an ostree-metadata ref.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1153
Approved by: mwleeds
2017-11-08 22:48:12 +00:00
Philip Withnall
321b931bb2 repo: Improve error messages if no repository metadata is available
If `flatpak repo --info` is run on a repository which doesn’t have a
summary file, or an ostree-metadata branch, it previously printed a very
unhelpful, unadorned, ‘No such file or directory’. Add a bit more
context to that error message.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1155
Approved by: cgwalters
2017-11-08 19:55:08 +00:00
Alexander Larsson
28229056d2 Remove C99 loop initialization
On RHEL7 compiler I got things like:

app/flatpak-builtins-search.c:196:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (guint j = 0; j < remote_stores->len; ++j)

Maybe we should allow this and tweak the warnings, but for now, just make it build.

Closes: #1151
Approved by: alexlarsson
2017-11-06 09:03:50 +00:00