Commit Graph

3019 Commits (ccdc551b441564328a5b4f6ffcd504674db8832f)
 

Author SHA1 Message Date
Alexander Larsson ccdc551b44 Update .gitignore 2017-08-25 09:41:39 +02:00
Alexander Larsson a5a12d14ee The module is flatpak-builder, not flatpak 2017-08-25 09:40:42 +02:00
Alexander Larsson faba587a72 Move common/flatpak-utils.* to src/builder-flatpak-utils.* 2017-08-25 09:36:49 +02:00
Alexander Larsson 5823533bd7 Move builder/ to src/ 2017-08-25 09:30:53 +02:00
Alexander Larsson 9d1f1ed59c Delete non-builder files 2017-08-25 09:27:42 +02:00
Matthias Clasen bbfb53abd6 Merge pull request #976 from sgnn7/README_fixes
Fixed README.md
2017-08-23 14:07:09 -04:00
Matthias Clasen 4b030b934d Merge pull request #980 from pwithnall/flatpak-remote-type
Add missing flatpak_remote_get_remote_type() implementation
2017-08-23 14:03:06 -04:00
Philip Withnall 15df314ca4 lib/remote: Add implementation of flatpak_remote_get_remote_type()
This is declared in the header file, but was never actually implemented.
Oops.

If anybody is hit by this issue, they can work around it by using
g_object_get() to get the FlatpakRemote:type property, which this is the
getter for.

Add it to the tests as well, so it gets exercised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-23 16:59:11 +01:00
Philip Withnall 00e5a0d325 lib/remote: Add documentation for the class properties
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-23 16:55:02 +01:00
Alexander Larsson 706d13895e Inherit min-percent-free-space from system repo into child repo
This way you can at least work around the free space check in *some*
way.
See https://github.com/flatpak/flatpak/issues/975
2017-08-23 11:13:45 +02:00
Srdjan Grubor 140b646a58 Fixed README.md
Many fixes to phrasing, wording, proper noun capitalization, etc
2017-08-22 10:52:33 -05:00
Matthias Clasen 503b2f8b4c Merge pull request #974 from AsciiWolf/cs-update
Update Czech translation
2017-08-22 08:42:55 -04:00
AsciiWolf 227e547367 Update Czech translation 2017-08-21 19:58:33 +02:00
Alexander Larsson cc8c8e6e30 Update pofiles 2017-08-21 18:25:30 +02:00
Alexander Larsson 3ac5747e39 Bump version to 0.9.8 2017-08-21 18:15:26 +02:00
Alexander Larsson 570665d0ae Update NEWS for release 2017-08-21 18:15:18 +02:00
Alexander Larsson a44bae6936 builder: Install all subpaths when installing dependencies
This means we e.g. always get the entire locale.
2017-08-21 17:26:03 +02:00
Alexander Larsson c6ef29c06b builder: Add support for defining extensions in flatpak-builder
This takes a list of properties and generate finish arguments.
Additionally you can specify "bundle": true, which causes f-b to emit
an actual extension implementation, similar to e.g. the locale
and debuginfo extension.
2017-08-21 15:46:06 +02:00
Alexander Larsson 0305628758 common: Fix up error reporting for local extra data
Report the actual error message if we failed to read the file.
2017-08-21 10:40:20 +02:00
Manuel Quiñones 9e38de1556 extra-data: Support reading from local directory
Lookup extra-data files as
~/.local/share/flatpak/extra-data/SHA256/FILENAME, Similar to files
downloaded in the .flatpak-builder directory.

For now, if a corresponding file exists, assume it's the full download
and read bytes from it.  Then proceed to do the same checks as for the
bytes downloaded by Soup.

In the future this directory could be used to support resumed downloads
by storing partial downloads.
2017-08-21 10:33:15 +02:00
Matthias Clasen 39a8abb788 Merge pull request #972 from piotrdrag/pl-update-170818
Update Polish translation
2017-08-18 13:02:40 -04:00
Piotr Drąg 2d14812f18 Update Polish translation 2017-08-18 18:50:16 +02:00
Alexander Larsson 1aadc3ee40 build: Fix issues when symlinks in / point into /var
Set up /var to $appdir/var binding after all the other filesystem
setup has happened. Before we did not do this, so a link from e.g.
/foo to /var/foo would be created in the appdir var rather than the tmpfs
var, which would fail with EEXIST the second time because that directory
is persisted.

In particular, this was problematic on endless os where /var/home is
a symlink.
2017-08-18 17:06:03 +02:00
Alexander Larsson 37fa3461c9 builder: Add --delete-build-dirs
This makes sure we always delete build dirs, even if there
was a build failure. This is useful for automatic build systems
like flathub or continuous integration.

This fixes https://github.com/flatpak/flatpak/issues/646
2017-08-18 16:29:17 +02:00
Alexander Larsson 326507602c build-update-repo: Don't remove next-to-last deltas
When creating a new commit of an app, we create deltas of it and from
its parent to it, and remove all other deltas. This can be problematic
during the switchover to the new delta, because some active operation
may be using the current delta when its deleted.

We fix this by keeping the parent and grandparent-to-parent deltas
around (but we never *generate* them).
2017-08-18 15:53:09 +02:00
Alexander Larsson 18451644ff Update to latest libglnx (and fix some callers) 2017-08-18 15:34:29 +02:00
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 154187f4f1 common/dir: Refactor handling for pull options
Factor out the pull options which are common to the collection-based and
non-collection-based code paths. This should make the code a little
easier to read.

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall bf537b3034 common: Ensure ostree-metadata pulls are cached
When the summary file is updated, it’s kept in a local cache, so that
parts of flatpak can refresh it at will without network impact. We need
the same for the ostree-metadata ref, which stores the repository’s
metadata when collection IDs and P2P are used.

Implement that by comparing the checksum of the ostree-metadata ref from
the summary file and from the local repository. If they differ, it’s
almost certainly going to be because the summary file is advertising a
more up-to-date ostree-metadata ref, which we should pull. If they don’t
differ, there’s no need to try and update the ref. Therefore, this
chains off the caching of the summary file.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall bcaec00e7a tests: Increase timeout values in testlibrary
1s is apparently not enough to install the test application on my
machine.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall f1dbe9bc50 tests: Print spawned program argv in testlibrary
This makes debugging failures a little easier.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 1932c66e0f tests: Drop use of GMainLoop in testlibrary
Use g_main_context_iteration() manually in a loop instead; this makes
the termination conditions more obvious. This does not change the
behaviour of the test.

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 9989188a1e tests: Add support for collection IDs to test-repo.sh
This adds variable support for collection IDs: they can either be
enabled on the server, on the server and client, or not at all. If
enabled on the server, apps and runtimes are built with collection IDs
and the repository has one set. If enabled on the client, the remote
config is added to the local repository with a collection ID and GPG
verification enabled. They are controlled with
USE_COLLECTIONS_IN_{SERVER,CLIENT}={yes,no}.

These variables are used in the new wrapper tests,
test-repo-collections.sh and test-repo-collections-server-only.sh.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall dd63bdbd61 common: Prevent pulling ostree-metadata unless gpg-verify is true
Add a sanity check and error message which prevents pulling the
ostree-metadata ref (the repository metadata) unless GPG verification is
enabled, as it needs to be signed to be trusted.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 0bbf8f3d21 common: Clarify some error and debug messages in flatpak-dir.c
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall b6828cda31 repo-update: Disallow changing collection IDs
Emit an error message if the user tries to change the collection ID of
an existing repository between two non-empty values. Allow them to set a
collection ID where one was not set before. Changing the collection ID
once it’s already been set will break updates for all clients who have
previously pulled from the repository.

If a developer really wants to change the collection ID for a
repository, they’re going to have to recreate the repository from
scratch.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 5c0eef7bde remote-add: Verify that GPG is enabled if collections are
Emit an error message if a collection ID is specified but GPG is not
enabled, since pulling using collection IDs requires GPG.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 19dbbd5f8c tests: Use AM_TESTS_ENVIRONMENT rather than TESTS_ENVIRONMENT
The latter is reserved for the user to set in their environment. The
former is what the makefile is supposed to set.

See
https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html.

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 e5e52b4b79 common/utils: Allow collection-id to be updated from repo config
In order to provide a transition path for repositories to add collection
IDs to themselves and propagate those collection IDs to clients’ remote
configurations, add another repo config key which controls whether the
repository’s collection ID is published. If xa.collection-id is set in
the repo’s published metadata, the client will update its configuration
to the given ID — but only if no ID is set already. This is a one-time
transition to prevent malicious repositories from remotely changing the
user’s configuration to associate their remote with a well-known
collection ID they don’t own.

Add a test for this.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 36c8fdb4a4 common/dir: Support updating collection-id from remote configuration
To allow staged deployment of collection-ID-based repositories,
introduce the code to update a local repository configuration to add a
collection ID to it, based on updated metadata from the remote (as is
currently supported for other configuration keys).

As a security measure, this only allows updating the collection ID from
an empty to a non-empty value. We do not allow collection IDs to be
renamed (or a malicious repository owner could bypass the user’s manual
verification of the collection ID by changing it after the user has
configured an unrelated remote).

The idea is that most repositories should remain without collection IDs
for now, and use this mechanism to set their collection IDs in future,
once the functionality is more stable.

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 959d54df3b system-helper: Fix incorrect whitespace
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall d3f1dccae2 common/dir: Drop an unnecessary wrapper function
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall e972201061 common/dir: Propagate errors from invalid configurations
Rather than silently ignoring them. Note that invalid configurations
are distinct from missing configuration keys.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall 358e204fb3 common/dir: Handle NULL out parameter correctly when getting config
ostree_repo_get_remote_option() requires the out parameter to be
non-NULL.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall bc0f90764e common/dir: Fix error handling for flatpak_dir_lookup_repo_metadata()
It can return FALSE with an error set, or FALSE without one set, which
indicates the key was not found.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall bc46274ae4 common/dir: Verify commit bindings when pulling from an untrusted repo
When pulling from a local, untrusted repo (i.e. one which the user
downloaded into, and we want to pull into the trusted system repo),
verify the collection ID and ref bindings in the commit metadata for
each commit.

This is something which is normally done by libostree, but since we’re
rewriting the commit manually, we’re bypassing that part of the pull()
code path.

This is an inlined version of the check from verify_bindings() in
libostree.

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