Commit Graph

999 Commits

Author SHA1 Message Date
Alexander Larsson
7fd085acd7 appstream: Generate appstream2/$arch branches with uncompressed xml
These delta better, and the files will be downloaded as compressed
.filez objects anyway.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
5102a19d22 appdata: Sort by ref-order to make appdata stable
This is nice for e.g. doing deltas of them.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
484c743e4a appdata: Include compatible arches in main arch when unique
For example, if a i386 build is in the repo but no x86-64 version then
also add the i386 build to the x86-64 appstream data.  However, don't
add it if that would cause a duplicate (i.e. both the x86-64 and i386
version).

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
096f7d4fb5 appstream: Drop flatpak_dir_check_for_appstream_update
This early bailout is not really needed, because noop updates is
pretty fast. Also, doing that breaks the timestamp updates.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Matthew Leeds
9afca51507 remote-ls: Allow a URI instead of remote name
This fixes the ability of the remote-ls command to take a file:// URI
instead of a remote name, which is especially useful for repos on USB
drives (created via `ostree create-usb`) which are temporary and don't
warrant being added to the repo config. This commit also updates
relevant documentation, adds a unit test, and updates a few variable
names to improve readability.

I can't find a commit in the history where this was working, but it's
working on the Endless fork of flatpak so I think there was agreement at
some point that it's desired behavior.

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

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Matthew Leeds
79907f4236 dir: Fetch ostree-metadata independently of summary
Currently _flatpak_dir_get_remote_state() only fetches the
ostree-metadata ref if it was able to fetch the remote summary, but this
is unnecessary because we don't need to know the checksum just to fetch
it, and this is especially problematic in the offline use case when the
remote summary can't be fetched. So this commit makes flatpak fetch
ostree-metadata even if the summary fetch failed, which is consistent
with how things worked before commit fedb0e5bd.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
516e249e50 lib/installation: Use "collection refs" when listing refs
When listing refs installed or from a remote, only the refs matching the
main collection-id were being returned. However, it is very important to
have access to all refs, independently from their collection-id,
especially when trying to list remotes coming from a USB repository.

These changes add the mentioned refs and update the places that use
this list, both in the lib and in the CLI.

For the implementation to become easier, we introduce also a
FlatpakCollectionRef, that should be replaced by OstreeCollectionRef
once the latter becomes part of the general API (currently it is in the
experimental one).

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Sam Spilsbury
b8cfe2e7a3 dir: Export d-bus .services files that we are allowed to own
Closes: #1589
Approved by: alexlarsson
2018-04-19 07:31:25 +00:00
Sam Spilsbury
a8620a5592 utils: Export flatpak_name_matches_one_*_prefix
We will use this later to determine what files to export
in both the build-export and build-finish stages.

Closes: #1589
Approved by: alexlarsson
2018-04-19 07:31:25 +00:00
Sam Spilsbury
b0b8f55ecb run: Export flatpak_context_get_session_bus_policy_allowed_own_names
We will use this later to work out which .service files we can export
based on names that we are allowed to own.

Closes: #1589
Approved by: alexlarsson
2018-04-19 07:31:25 +00:00
Matthew Leeds
ac690c4a1e Merge pull request #1590 from alexlarsson/batch-prunes
Batch prunes of the local repo
2018-04-18 23:48:13 -07:00
Matthew Leeds
2ec5f25599 dir: Fix grammar in a debug statement 2018-04-18 23:41:49 -07:00
Matthew Leeds
63052a51d6 dir: Update outdated comment 2018-04-18 16:16:18 -07:00
Sam Spilsbury
ceeda9b16d run: Add --no-documents-portal option
This prevents flatpak from trying to talk to the documents portal
on startup.

Closes: #1584
Approved by: alexlarsson
2018-04-18 12:05:16 +00:00
Alexander Larsson
1355713db7 Batch prunes of the local repo
This moves the prune call out of flatpak_dir_update() and
flatpak_dir_uninstall() and instead does this manually at all call
sites. The advantage is that we now only call it *once* even if you
uninstall or update multiple apps.

This means update everything is much faster as we don't have to scan
over the entire local repo for each updated app.
2018-04-18 12:00:12 +02:00
Sam Spilsbury
0cfcb90ed8 builtins-build: Search for best matching tagged extension when building extension
Closes: #1531
Approved by: alexlarsson
2018-04-18 07:43:56 +00:00
Sam Spilsbury
efa183e3d6 dir: Also handle tagged extension names in find_remote_related and find_local_related
Closes: #1531
Approved by: alexlarsson
2018-04-18 07:43:56 +00:00
Sam Spilsbury
b6d1a20223 flatpak-utils: Remove tag from extension name before adding it
Closes: #1531
Approved by: alexlarsson
2018-04-18 07:43:56 +00:00
Matthew Leeds
14dde8a37d dir: Use child_repo_ensure_summary() more
This introduces no functional change; it just makes use of a helper
function and updates a comment.
2018-04-17 11:46:02 -07:00
Matthew Leeds
1e1ed6911e dir: Tweak an outdated comment 2018-04-17 11:31:41 -07:00
Sam Spilsbury
66e343fcb8 dir: Add support for X-Flatpak-RunOptions in exported desktop files
A desktop file can specify this key to add additional arguments
to flatpak run. Right now, only 'no-a11y-bus' is supported.

Closes: #1579
Approved by: alexlarsson
2018-04-17 08:50:56 +00:00
Alexander Larsson
4bf892a06f common: Rename FlatpakRemoteState->remote to remote_name
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
482b494d9f Fix unused function warning in non-p2p case
_flatpak_dir_fetch_remote_state_metadata_branch is only used when building
with p2p, so #ifdef the entire function.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
9646f42ba8 dir: Remove unused function flatpak_dir_lookup_ref_from_summary
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
88edfda861 dir: Pass FlatpakRemoteState to flatpak_dir_pull/install/update
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
0e5baf3837 dir: Remove unused functions
flatpak_dir_get_remote_metadata and flatpak_dir_lookup_repo_metadata are now
not used anymore.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
48796fb29d dir: Pass FlatpakRemoteState to flatpak_dir_list_remote_refs
Reusing the summary and metadata here helps us a lot as typically we
often want to look up the cache data again for every ref in the list.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
2db82391c0 dir: Use FlatpakRemoteState for flatpak_dir_check_for_update
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
1936d2daae dir: Pass FlatpakRemoteState to flatpak_dir_find_remote_related
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
d791625d77 transaction: Use FlatpakRemoteState to look up metadata
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
346dcc04c1 dir: Use FlatpakRemoteState in flatpak_dir_remote_list_refs
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
78de3ba384 dir: Use FlatpakRemoteState in flatpak_dir_fetch_remote_commit
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
76bf02cb74 dir: Use FlatpakRemoteState in flatpak_dir_remote_has_ref
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
38df7f823b dir: Use FlatpakRemoteState in flatpak_dir_find_latest_rev()
This also makes this function static, as its not needed anywhere else.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
4b73e7fc2e dir: Use FlatpakRemoteState in flatpak_dir_find_remote_related()
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
f16f8b1d8b dir: Change update_remote_configuration to use RemoteState
This means we only look up the summary once for the entire operation.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
245c605828 dir: Add FlatpakRemoteState object
This is an object that contains the state of a particular remote
at a point in time, such as the summary and the metadata. Storing
this in an object means we can reuse these data instead of constantly
looking them up.

This is more efficient, but also avoids possible inconsistencies if
the state changes during an operation.

There is also an "optional" mode for the state where we don't fail in
the p2p/collection-id case if it fails to load the summary or metadata.
This is useful in order to support certain operations "offline" (i.e.
with no network connection to the main repo).

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
60270000c8 dir: Remove unused methods fetch_remote_default_branch and fetch_remote_title
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
fedb0e5bd9 dir: Pass summary and collection_id to fetch_remote_repo_metadata()
All callers need to get this anyway, so lets only do it once.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
25c9b0a4a1 dir: Break out flatpak_dir_get_remote_metadata
Split out the remote metadata loader, so you can do multiple lookups
on it if needed.

Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
23256d6d3f dir: Fix handling of empty dirs when listing installed refs
Before, we would list a ref as installed if the directory for the
ref was in the installation. However, if that was empty then we
would still consider that as installed. We also now require
there to be an active symlink with a deploy file in it.

This caused issues for me on update, because we listed some app
as installed, but then failed to update it.

Closes: #1573
Approved by: alexlarsson
2018-04-16 06:26:59 +00:00
Alexander Larsson
66699c0774 deploy: Store end-of-life data in deploy
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
8d7f888bf1 build-update-repo: Add end-of-line metadata to summary
This adds a "sparse-cache" metadata dict to the summary, where
we can add additional per-ref information that we don't expect
to be there for most refs. Initially we add the eol and
eol-rebase info to it so that we can see which remote refs
are end-of-line.

Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
42335c74a0 appstream: Don't include end-of-line refs in appdata
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
0303433c7b table-printer: Add append_with_comma_printf
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
8e992e04ad flatpak-utils.c: Remove leftover spew
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
957544ca30 flatpak-utils: Mark strings for translation
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
2cdb099ab3 Verify that the system cache directory supports user xattrs
Installation will fail with some weird error later if this is not true.
2018-04-04 17:31:31 +02:00
Alexander Larsson
a6ec434aed run: Escape : as \: in --filesystem= paths
This way we never get confused about which part of the argument
is the permission suffix, which could be exploitable if you can
control the --filesystem calls such as with sandboxed Spawns.
2018-04-04 17:25:59 +02:00
Alexander Larsson
11ef9999b6 Add flatpak portal
This listens to org.freedesktop.portal.Flatpak and lets flatpak
sandboxes do flatpak specific things.

Initially this only allows access to "Spawn", which lets you start a
new copy of the current or latest version of the calling app,
optionally with sandboxing.

This allows the app to re-start itself with the latest version after
an update, and the sandboxing is useful for apps that want to manually
sandbox part of themselves.

You can also expose one or more subdirectories of
~/.var/app/$appid/sandbox/ to the app, read-write or read-only. This is
useful to communicate with the sandbox.
2018-04-04 17:25:59 +02:00