Commit Graph

5047 Commits

Author SHA1 Message Date
Alexander Larsson
7dedbbb56b FlatpakDir: Break out the remote-config copy code into a helper
Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
4ef72ab991 remote-add: Don't fail if metadata updates fail, just warn
This typically happens when the network is offline or in some weird
state.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
b519b69e38 Add tests for adding remotes from flatpakrefs
Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
11c439cee2 Port flatpak remote-add to use flatpak_parse_repofile
We shouldn't be parsing this in two places in the code.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
6278420ba8 dir: Add flatpak_dir_compare_remote_filter and handle canonicalization
In general xa.filter being "" means don't filter, so that it can be
used to override-unset a previous filter. However, We canonicalize
to unset/NULL when comparing, returing, or setting the ostree config.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
e31023c32f Move flatpak_dir_parse_repofile to utils (and drop the unused dir)
Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
e1ffc0e730 flatpak_dir_parse_repofile: Handle version and comment/desc/etc keys
These were supported by remote-add, so should be supported here too.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
1d49053e62 remote-add: Don't set xxx-is-set if the option comes from a flatpakrepo file
This is meant to mean that the user explicitly overrided it, and
that is not right for a flatpakrepo file.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
6ee61a29fd Remove support for /etc/flatpak/remotes.d config files
This kind of remotes don't work very well, because they are not modifiable
or removable and can cause conflicts with pre-existing remotes.

We instead want to switch to a way to define default remotes that
is applied to the regular ostree repo config, allowing later changes.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Matthias Clasen
25696d67e3 Add tests for dconf utilities
Closes: #2880
Approved by: alexlarsson
2019-05-07 06:11:18 +00:00
Matthias Clasen
74d83d8111 Move dconf utilities to flatpak-utils
This is in preparation for writing some unit tests
for these functions. Apparently they are not too
trivial to get them wrong.

Closes: #2880
Approved by: alexlarsson
2019-05-07 06:11:18 +00:00
Matthias Clasen
0a8de7d1bc fix a typo in path_is_similar
We were trying to check if path2 is longer,
but accidentally checked if it is empty.

Closes: #2880
Approved by: alexlarsson
2019-05-07 06:11:18 +00:00
Alexander Larsson
894151033f tests: Add tests for client-side filtering
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
43aeb2499a flatpak remote-add: Special case if-not-exist to clear filter
If you're adding a remote with --if-not-exists and it exists,
apply the filter key anyway. Typically this is used to allow a
user to use the standard instructions to add a remote even if there
is a pre-existing filtered remote already configured.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
40cc39ebf6 add-remote: Support loading filter from .flatpakrepo file
This is kind of special as it handles non-existing filter keys
as "override to no filters" instead of "leave existing filters" whic
we do for other things. However, that matches how we want to use
.flatpakrepo files to override site-local filters.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
5f6f5f7178 appstream: Include checksum of filter in appstream checkout
If there is a filter for the remote, include the checksum of it
in the directory name for the deploy dir. This way we re-deploy the
appstream if the filter changes.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
2bd55552b6 flatpak remote-modify add --filter and --no-filter options
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
9454e2d65e flatpak remote-add add --filter option
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
bbd108ab80 FlatpakDir: Make empty xa.filter mean no filter
This is useful as it allows us to easily disable a filter via
the system helper.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
72a7f8aa4e flatpak remotes - show filter in list
There is an optional filter column, and a flag for filtered remotes in the
default options.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
f82f0f397d flatpak-remote: Add api to get/set the filter path for a remote
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
4f6428af83 appstream: Automatically rewrite appstream xml during deploy if filtering
This means only refs that are allowed will be visible in the deployed
appstream.

This sometimes means we have to uncompress the xml.gz before rewriting
and then re-compressing that.

As a result of this we now always end up with both the compressed and
the uncompressed xml file, whereas we before didn't get an uncompressed
one if the remote was using the old appstream format.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
5b7b77d922 dir: Apply ref filters in list_all_remote_refs() and lookup_ref()
Full names are:
 * flatpak_remote_state_lookup_ref()
 * flatpak_dir_list_all_remote_refs()

This should be enough to not get any stray refs, because due to the
complexities of p2p all accesses go via FlatpakRemoteState.

The one leftover to non-filtered stuff is the appstream file, a later
commit will handle that.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
4ba18ec160 FlatpakRemoteState: Include the active filter in the state
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
41018724b1 FlatpakDir: Read the xa.filter per-remote config option
If this is set to a pathname in the configuration of a remote we load
that file and keep track of it as a filter. No filter is actually applied
yet though.

There is two levels of caching, consecutive lookups of the filter
with less than 500msec between use the previous value. Once its more
that that we stat() the file and compare the mtime, reloading the file
if the mtime changes. We also directly reload the file if the pathname
changes.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
d45c98c0bd utils: Add flatpak_appstream_xml_filter
This applies a ref filter to an appstreaml xml file

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson
4b39b5c9c0 utils: Add utils to parse and apply ref filter globs
Filters are specified as a list of
op glob

where op can be allow or deny, and the blogs are partial refs
where * means anything in this part of the ref, and non-specified
trailing parts of the ref matches anything.

By default everything is allowed, but if you specify some
deny rules all that they match is denied, except if there is
an specific allow rule.

Internally this takes all the allow and deny globs and convert
them into two combined regular expressions.

Some examples:
 * - match anything
 app/* - match all apps
 runtime/* - match all runtimes
 app/*/x86_64 - match all x86-64 apps
 app/org.gnome.*/*/stable - match all stable gnome apps
 org.gnome.frogr* - match frogr and extensions

This means you can do a both whitelisting:
 deny *
 allow org.the.good.app*
Or blacklisting:
 deny org.the.bad.app*

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Simon McVittie
e0a149858f Don't leak dbus_session_socket from flatpak_run_add_session_dbus_args
The function was already leaking the result of
extract_unix_path_from_dbus_address() in the case where that call
succeeded. Since commit 0e545799 it would also leak the result of
g_build_filename in the case where it checked $XDG_RUNTIME_DIR/bus.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2877
Approved by: matthiasclasen
2019-05-03 15:02:57 +00:00
Rafael Fontenelle
0b6051b1f6 Update Brazilian Portuguese translation
Closes: #2878
Approved by: matthiasclasen
2019-05-03 14:42:34 +00:00
Simon McVittie
e360005d8b Check for missing sentinels in NULL-terminated varargs
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2876
Approved by: matthiasclasen
2019-05-02 16:58:36 +00:00
Alexander Larsson
bed352bb94 Bump bubblewrap to latest version
Closes: #2875
Approved by: alexlarsson
2019-05-02 11:48:51 +00:00
Simon McVittie
0e5457995a run: Make D-Bus session bus default to $XDG_RUNTIME_DIR/bus
This matches what's now implemented in libdbus, GDBus and sd-bus.
If $DBUS_SESSION_BUS_ADDRESS is unset, check whether $XDG_RUNTIME_DIR/bus
is a socket owned by Flatpak's uid; if it is, use it.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2874
Approved by: alexlarsson
2019-05-02 06:51:10 +00:00
Simon McVittie
62629b44b8 app, common: Use glnx_readlinkat_malloc()
readlink() and readlinkat() have weird semantics (they return the
number of bytes they would have written if there was enough space,
even if that's larger than the buffer), but glnx_readlinkat_malloc()
takes care to do the right thing in all situations.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2873
Approved by: matthiasclasen
2019-05-01 16:39:18 +00:00
Simon McVittie
89dc344ccb icon-validator, portal: Guard against overlong symlink targets
If the buffer is too small, readlink() returns the number of bytes that
would have been stored if the buffer had been large enough.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2873
Approved by: matthiasclasen
2019-05-01 16:39:18 +00:00
Alexander Larsson
26ad9154c3 Add flatpak in docker seccomp profile
This is a docker seccomp profile that allows you to run flatpak
inside a docker container, given some special requirements:

 * The host kernel must support unprivileged user namespaces
   (Supported by e.g. fedora and ubuntu kernels)
 * The seccomp profile must be used
   (--security-opt seccomp=flatpak-docker-seccomp.json)
 * flatpak is run as a reguler user, not root, in the container
 * The full host /proc must be visible in the container
   (-v=/proc:/host/proc)

The last one is a bit weird, but the regular /proc in docker
is mounted with some cover-over mounts, and this makes the kernel
disallow mounting a new procfs for the pid namespace. Adding
in a full copy of the host fs causes this to be allowed.

Closes: #2867
Approved by: alexlarsson
2019-04-30 06:20:56 +00:00
Matthias Clasen
5020790f53 Suppress debug output when completing
Any log output interferes with comletion.
We already refrain from installing our verbose
log handlers in this case, but we are still
vulnerable to GLib default message handling,
e.g. via the G_MESSAGES_DEBUG environment
variable. To avoid that, explicitly install
a message handler that suppresses all output.

Closes: https://github.com/flatpak/flatpak/issues/2860

Closes: #2862
Approved by: alexlarsson
2019-04-29 13:40:44 +00:00
Yuri Chornoivan
c3df39a0bd Update Ukrainian translation
Closes: #2865
Approved by: matthiasclasen
2019-04-29 10:51:26 +00:00
Kukuh Syafaat
af9aea6e75 Update Indonesian translation
Closes: #2863
Approved by: matthiasclasen
2019-04-29 10:34:25 +00:00
Alexander Larsson
7cde959b4e Update pofiles 1.3.3 2019-04-26 13:55:51 +02:00
Alexander Larsson
bb04fb4063 Bump version to 1.3.3 2019-04-26 12:22:24 +02:00
Alexander Larsson
68b4420502 Update NEWS for release 2019-04-26 12:22:08 +02:00
Alexander Larsson
0a66707b00 remote-ls: Add --cached option
This prefers cached data, even if stale.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
8057de20a8 remote-info: Add --cached support
This prefers any cached data if available, even if its stale.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
ad11954bf7 lib: Add a flag-using _full version of list/fetch_remote_ref
This adds the flag FLATPAK_QUERY_FLAGS_ONLY_CACHED to use the new
code for this.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
aa24754aa0 FlatpakError: Add more dbus error names
Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
34f463731d system-helper: respect no-interaction for more methods
Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
6088c7d0a1 dir: Add support for getting remote state using only caches
If only_cached is TRUE we never do any network i/o, instead
returning ERROR_NOT_CACHED if this is necessary.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
cf42364e23 dir: Keep track of the cache dir in FlatpakDir
We will need this later

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson
9c9efe19e0 tests: Properly pass -y to install
This bug was unearthed when we suddenly started to fail when you
answered no to the prompt.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson
131ba30ea9 cli: Drop unnecessary "something failed" message with --noninteractive
We reported the error already, just report the exit status.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00