Commit Graph

272 Commits (18451644ffba004395bb016adbdb0bfe7d6ff50e)

Author SHA1 Message Date
Philip Withnall 6321bc9c93 lib: Make P2P API unconditionally public
Rather than a lot of #ifdef mess in the public headers, Alex would
prefer that the P2P API is made unconditionally public. This assumes
that they are unlikely to change in future. If they do, we just make
them return NULL or break API and drop them.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 7b13ff2880 lib/remote: Handle clearing a collection ID in FlatpakRemote
Squash "" to NULL.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 642a5a81a1 lib/remote: Add getter/setter for collection IDs
This isn’t really used internally, but will be used by gnome-software
for when it configures new flatpak remotes.

This is new public API, but is only declared if compiling with
--enable-p2p.

Includes some basic smoketests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 550ebcc4f9 lib/remote: Add enum GType for FlatpakRemoteType
This will only be built when configured with P2P support. We can’t use
glib-mkenums here, as it doesn’t know about the #ifdef
FLATPAK_ENABLE_P2P which surrounds the enum definition. By manually
writing the get_type() function, we can surround it by #ifdefs as
appropriate.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall c4819af5a0 common: Support collection IDs for related refs and extensions
Add support for collection IDs to the code which finds and pulls
related refs and other extensions.

Currently, related refs must have the same collection ID as the parent
ref — this is the most likely scenario anyway. In future, it should be
possible to extend the code to support pulling related refs from other
collections.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall ae7d960372 common: Support collection IDs in flatpak{ref,repo} and bundle files
These are loaded from the ref/repo/bundle metadata and added to the new
remote configuration.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 4c395cec13 lib/ref: Add collection ID support to FlatpakRef
This adds a new collection-id property which is only enabled if
FLATPAK_ENABLE_P2P is defined. The internal machinery for handling it is
always enabled, to reduce the amount of #ifdef spam.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 68ab12fce1 lib: List dynamic remotes in flatpak_installation_list_remotes()
Also expose a new flatpak_remote_get_remote_type() API so that users can
query what type of remote something is — whether it’s a USB or LAN
remote, or something statically configured.

Make this all conditional on compiling with --enable-p2p.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 30a5cf8136 common: Support collections in check_for_updates() and forward the results
Search for updates on peer to peer sources as well as the internet in
check_for_updates(), and pass the resulting OstreeRepoFinderResult array
to the pull() calls, so a consistent set of checksums are pulled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Matthias Clasen ed08538f92 Merge pull request #900 from pwithnall/lan-and-usb-preparation
LAN/USB preparation refactoring
2017-07-08 20:54:28 -04:00
Matthias Clasen 2d5a8ba86b Merge pull request #909 from matthiasclasen/install-flags
Check the right flags
2017-07-08 18:19:14 -04:00
Matthias Clasen 75f93606c3 Check the right flags
flatpak_installation_install_full takes FlatpakInstallFlags,
but it was checking for a FlatpakUpdateFlags field.
2017-07-07 20:20:56 -04:00
Matthias Clasen 854cb841df Fix a typo in the docs 2017-07-07 20:17:32 -04:00
Philip Withnall 81301f0ef4 general: Remove trailing \n from GLib log messages
The GLib logging framework automatically appends a \n to messages, so it
doesn’t need to be added by callers.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-07 17:18:24 +01:00
Philip Withnall f47a696392 build: Add AM_* variables to all per-target special variables
For example, add $(AM_CFLAGS) to mumble_CFLAGS. Since $(WARN_CFLAGS) is
only added to $(AM_CFLAGS), this fixes the lack of inclusion of the
compiler warning flags in the compilation of half of flatpak.

Note that $(AM_*) variables are only used by automake if a more specific
(per-target) special variable is not defined instead. So if you define
mumble_CFLAGS, AM_CFLAGS will not be used for that target unless
explicitly included in mumble_CFLAGS.

See
https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html.

Do the same for $(AM_LIBADD), $(AM_LDFLAGS), etc. These are not
currently defined, but it’s good practice to include them in
mumble_LIBADD (etc.) just in case they’re defined in future. Hopefully
their inclusions will be cargo-culted to any new targets which are
added, retaining full coverage of the code base.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-06 15:05:58 +01:00
Emmanuele Bassi 4aa4f91a1f Add nullable annotations for progress callbacks
The progress callback arguments in the Flatpak.Installation installation
and update methods are nullable, so we should annotate them as such.
2017-06-30 10:32:14 +02:00
Alexander Larsson e47a726061 lib: Fix update checking
There was a typo in 44cf5076
2017-05-22 15:28:53 +02:00
Alexander Larsson 1ecbf0666c lib: Add flatpak_installation_update_appstream_full_sync with progress 2017-05-22 13:32:58 +02:00
Alexander Larsson 644bb1cd41 common: Break out the flatpak progress calculator to a helper method. 2017-05-10 17:24:48 +02:00
Alexander Larsson 44cf5076fa update: Split update into check_for_update and update
This way we can avoid printing "updating foo" for every
app even if there is no update.
2017-05-09 14:08:27 +02:00
Joaquim Rocha de2c6cc85b Add the possibility of installing/updating without static deltas
Sometimes we need to pull a commit without using static deltas to e.g.
make sure that an app with a corrupted commit can still be updated by
pulling the new commit in full.

This option has been added to the FlatpakUpdateFlags,
FlatpakInstallFlags, as well as a parameter for the CLI.
2017-05-02 15:05:48 +02:00
Georges Basile Stavracas Neto 0007edb7bd Ensure commits are available when checking for extra-data
After the introduction of linear progress reports based on
heuristics, Flatpak still couldn't make precise reports for
the extra-data field is contained in the commits. When we
were setting extra-data up, Flatpak didn't have the commits,
so it always failed.

Fix that by downloading the commits first, and then setting
up the extra-data fields.

flatpak/flatpak#609
2017-04-27 17:21:29 +02:00
Simon McVittie 646b4c468b Use correct format string for guint64 on 32-bit
Signed-off-by: Simon McVittie <smcv@debian.org>
2017-04-04 12:17:28 +02:00
Colin Walters 2618a19716 Import ostree's compiler warnings, fix up callers
In ostree I maintain what I consider a "baseline" set of compiler
warnings that should *always* be fatal for a modern C project.

I noticed while working on a previous patch that a `-Werror=format`
warning wasn't fatal.

There are a few that are really, really important like
`-Werror=missing-prototypes`. I also take some like `-Werror=misleading-indentation`
which already caught some bugs.  See also https://lwn.net/Articles/678019/
2017-03-27 10:42:36 +02:00
Georges Basile Stavracas Neto 556782ac06 Fix comment 2017-03-08 15:42:44 +01:00
Georges Basile Stavracas Neto d74956c23a Improve progress calculation
When calculating the progress of a flatpak installation,
it considers the extra-data and OSTree pull as different
operations and that makes the progress to go back and
forth between 0% and 100%.

Consumers of this API, like GNOME Software, end up having
a bad experience reporting the progress of a Flatpak app
instalation.

Fix that by using a set of heuristics to improve the process,
splitting the operation in parts that can be tracked (or at
least estimated).
2017-03-08 15:37:28 +01:00
Richard Hughes d2307ca8b1 Don't include newlines in error messages 2017-02-24 17:03:03 +00:00
Richard Hughes 6125dabf58 Return the container from flatpak_get_system_installations()
This matches what other functions in libflatpak do, and also fixes a memory
leak in the error path.
2017-02-23 17:26:45 +01:00
Mario Sanchez Prada 2e1740297c Report progress for extra data downloads, as we do for OSTree pulls
Otherwise, clients such as GNOME Software won't be able to report
any progress once the flatpak application has been downloaded and
we enter the stage to download the extra data.
2017-02-14 09:00:57 +01:00
Matt Watson ee83b5a70d install: handle arch when installing from a flatpakref
Before this commit
$ flatpak install --arch someArch --from some.flatpakref
Would completely ignore the arch argument and only install for the
default flatpak architecture. Since flatpakref files don't include
an arch field, there's no reason we can't attempt to install the
arch specified on the command line.
2017-01-20 15:28:11 +01:00
Alexander Larsson f20e5f7823 bundles: Support dependencies and runtime-repo
If the bundle contains an origin link we can now install related
things from it, such as locale data.

You can also build the bundle with --runtime-repo=URL, where the url
points to a flatpakrepo file for a repo with runtimes. This works
similar to the RuntimeRepo= feature in flatpakref files.
2016-12-20 16:27:57 +01:00
Mario Sanchez Prada 15e7f14ca3 Adjusted internal representation for storage types of system installations
I set these as separate bits by mistake when there's no good reason for
them to be like that, as they are not flags that are meant to be combined,
but a list of exclusive values.
2016-12-20 09:52:03 +01:00
Mario Sanchez Prada 677cd771e4 Declare new public API as available since 0.8, not 0.6.15 2016-12-19 13:07:33 +01:00
Mario Sanchez Prada a663e5ba73 Add public API: implement the other getters required by GNOME Software
Implemented the following functions along with the required internal APIs:

  * flatpak_installation_get_id ()
  * flatpak_installation_get_display_name ()
  * flatpak_installation_get_priority ()
  * flatpak_installation_get_storage_type ()
2016-12-17 00:32:53 +00:00
Mario Sanchez Prada 8eaa88c016 Add public API: flatpak_installation_new_system_with_id()
It will look for the list of configured system-wide installations
and return the one matching the passed ID, if any.
2016-12-17 00:32:51 +00:00
Mario Sanchez Prada fe1540f988 Add public API: flatpak_get_system_installations()
It's meant to provide a list of the system installations, not
just the default one, which can still be obtained by calling
flatpak_installation_new_system(), as usual.
2016-12-17 00:32:51 +00:00
Mario Sanchez Prada 521c3fcd4b Rename flatpak_dir_get_system() into flatpak_dir_get_system_default()
There will be a way to retrieve the list of all system installations,
not just the default one, so we rename this for backward compatibility.

Note that some (most?) of the places where we will be now using this
renamed function will likely have to migrate to using specific system
installations, but we don't have the necessary APIs yet so we do this
as an initial step to all the incremental changes that will come next.
2016-12-16 19:17:13 +00:00
Alexander Larsson 9ddc4aca48 Support flatpak install --oci to install apps from OCI 2016-12-12 16:22:16 +01:00
Alexander Larsson 63c1aace83 Import OCI initial support to common/* 2016-12-08 17:43:03 +01:00
Alexander Larsson b744cd2493 Add backport of g_autoptr support for json-glib 2016-11-29 10:14:33 +01:00
Alexander Larsson 63842a1247 flatpak_installation_update_appstream_sync: Remove dead code 2016-11-11 11:07:05 +01:00
Alexander Larsson 0695712152 lib: Don't list updates from disabled remotes 2016-10-21 08:46:57 +02:00
Alexander Larsson b2af78fb6f remotes: Add no-use-for-deps property
If this is set for a remote we will never automatically look for
dependencies in it. This makes dependency search faster, as we
don't need to search in app-only remotes.
2016-10-19 11:34:22 +02:00
Mario Sanchez Prada 8decac7d7f Added new public API: flatpak_installation_update_remote_sync()
Provides access to the functionality offered by the new internal API
flatpak_dir_update_remote_configuration(), in a similar way to what
can be done via the command 'flatpak remote-modify --update-metadata'.
2016-10-14 16:42:17 +01:00
Mario Sanchez Prada 69831c60ca Check flatpak_remote_get_default_branch() in test-lib.c 2016-10-14 16:23:15 +01:00
Tiago Gomes 847fdc657f Docs: update system-wide directory used by flatpak 2016-10-07 15:51:38 +01:00
Alexander Larsson bef4de5308 Support default-branch setting in remote configuration
For now this is a purely client side setting which lets you store
the default branch to use for a remote. This is mostly meant to
be used for UI tools, although the CLI could also be made to use this.

You can set this manually in the CLI with --default-branch, or via a
flatpakrepo file (new key DefaultBranch).
2016-10-06 11:36:28 +02:00
Alexander Larsson bd7ab85102 Add FLATPAK_CHECK_VERSION macro
From: https://github.com/flatpak/flatpak/issues/304
2016-09-13 13:30:04 +02:00
Alexander Larsson e3b346c661 lib: Add flatpak_installation_install_ref_file
This gives libflatpak API support for .flatpakref files
2016-09-12 12:13:52 +02:00
Alexander Larsson c076b33ba3 Fix last commit
The checks where inverted.
2016-08-29 16:15:32 +02:00