4200 Commits

Author SHA1 Message Date
Alexander Larsson
847902c303 Update pofiles 1.0.4 2018-10-12 11:26:21 +02:00
Alexander Larsson
0d7da9cffa Update NEWS 2018-10-12 11:21:51 +02:00
Matthew Leeds
619cd08235 common: Reload FlatpakRemoteState after changes
Some remote metadata can cause changes to the local configuration for a
remote, but Flatpak is not properly reloading the new config after
making changes. Specifically in flatpak_transaction_update_metadata() we
call flatpak_dir_update_remote_configuration() for each remote and then
try to reload the configuration by calling flatpak_dir_recreate_repo().
The problem is that while this reloads the config instance stored by the
repo member of the FlatpakDir, the FlatpakTransaction object still has
FlatpakRemoteState objects stored which were initialized from the old
config.

A consequence of this is that if a remote repository has the
"ostree.deploy-collection-id" key set in its metadata, the next
install/update operation from that remote will fail with the error
message "Can't pull from untrusted non-gpg verified remote", and then
subsequent operations will succeed. This is because during the first
operation Flatpak will add the collection ID to the local configuration
in flatpak_transaction_update_metadata() but then in
flatpak_dir_install() the outdated FlatpakRemoteState object will be
used which still has no collection ID.

So this commit frees all the stored FlatpakRemoteState objects on the
transaction, so they will be recreated when they're needed (based on the
new config).

Closes: #2243
Approved by: alexlarsson

(cherry picked from commit ce78f52fcc)
2018-10-12 11:20:41 +02:00
Alexander Larsson
2568bd196f Update NEWS for release 2018-10-12 10:50:33 +02:00
Matthias Clasen
bb979eb867 installation: Don't return freed memory
flatpak_installation_load_app_overrides was returning
freed memory. Oops.

Closes: #2239
Approved by: alexlarsson

(cherry picked from commit fd282a1ab8)
2018-10-12 10:07:32 +02:00
Matthew Leeds
35a4efcb0b common: Don't seg fault if a ref doesn't exist
Currently, if flatpak_installed_ref_get_latest_commit() returns NULL
(which means the ref doesn't exist in the local repo) we assume any
remote commit could be an update in
flatpak_installation_list_installed_refs_for_update() when a collection
ID is not configured on the remote. When a collection ID is configured,
if get_latest_commit() returns NULL it causes a crash in
ostree_repo_load_commit(). So this commit prevents the crash and makes
the behavior in the post-collection-id world consistent with the
behavior in the pre-collection-id world.

It's difficult to write a test for this that's not contrived, without
knowing what circumstances led to the disappearance of the ref from the
repo.

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

Closes: #2229
Approved by: alexlarsson

(cherry picked from commit 6b4402b60e)
2018-10-12 10:07:32 +02:00
Patrick Griffis
9ced088fb5 Implicity grant MPRIS2 permissions
This should be safe to expose without requiring everybody request
it.

Closes: #2226
Approved by: alexlarsson

(cherry picked from commit d6e51ede6d)
2018-10-12 10:07:32 +02:00
Matthias Clasen
f539213a34 dir: Return FALSE when setting an error
This is expected behavior.

(cherry picked from commit e9f2d11f4a)
2018-10-12 10:07:32 +02:00
Alexander Larsson
af7e3f02aa build-finish: Inherit permissions from runtime by default
In version 0.99.1 (065053775b) flatpak
stopped inheriting permissions from the runtime, because that made
the story about application permissions way to complicated. What
we want is to have a static set of permissions for the app that
is frozen at install time.

However, inheriting permissions from the runtime makes a lot of sense
as certain permissions are required from the runtime, in particular this
is used by the kde runtime to read the kdeglobals file, etc.

So, to combine the best of the two worlds, we now do inherit permissions,
but at build-time (and you can disable it if you want). This way
kde apps don't have to repeat themselves, but we still get static
application permissions.

Closes: #2230
Approved by: alexlarsson

(cherry picked from commit 99fbbc25c6)
2018-10-12 10:07:32 +02:00
Alexander Larsson
f0a3f54dfa sandbox: Expose /etc/timezone
This exposes a /etc/timezone with the current timezone, as per the old
debian spec: https://wiki.debian.org/TimeZoneChanges

In case we're using the session-helper this will be extracted from
the host config and applied whenever that changes.

Normally timezone info is specified by /etc/localtime being a symlink
into the locale data, and you can look at the symlink value itself.
However, in the sandbox we can't update a symlink in /etc at runtime,
nor can we make it of the canonical form as that would point into the
runtime. This is why /etc/timezone is used.

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

Closes: #2214
Approved by: alexlarsson

(cherry picked from commit 0b6844f39e)
2018-10-12 10:07:32 +02:00
Alexander Larsson
ae03bb49ac utils: Add flatpak_get_timezone()
This extracts the timezone from the symlink in /etc/localtime as
specified in e.g.
  https://www.freedesktop.org/software/systemd/man/localtime.html

If this doesn't exist, or is not a symlink, then it uses the old
debian /etc/timezone as specified in
  https://wiki.debian.org/TimeZoneChanges

If nothing else works it falls back to UTC.

Closes: #2214
Approved by: alexlarsson

(cherry picked from commit 6dec266189)
2018-10-12 10:07:32 +02:00
Matthias Clasen
6ddf772e97 Include the icon in the tarball
This makes it easier for third-party tools who want
to have an icon to use for flatpak.

Closes: #1344
(cherry picked from commit 1afa70e54d)
2018-10-12 10:07:32 +02:00
Matthias Clasen
6c6a0c251e remote: Save nodeps
flatpak_installation_modify_remote was not saving the nodeps
state. Found while writing FlatpakTransaction tests.

Closes: #2198
Approved by: alexlarsson

(cherry picked from commit de56d34104)
2018-10-12 10:07:32 +02:00
Matthias Clasen
f1c6a6bfe8 transaction: Fix a crash in an error path
This was found while writing transaction tests.
We were passing error, but trying to use the local_error
message.

Closes: #2198
Approved by: alexlarsson

(cherry picked from commit adf896d794)
2018-10-12 10:07:32 +02:00
Matthias Clasen
a73ee1d7ec transaction: Fix up a signal signature
We were emitting the ::operation-done signal with
different arguments than declared for the signal.
This showed up as test failure when comparing
the result argument.

Closes: #2187
Approved by: alexlarsson

(cherry picked from commit 3f0eb7e481)
2018-10-12 10:07:32 +02:00
Alexander Larsson
55126111a9 Post-relase version bump to 1.0.4 2018-10-12 10:07:32 +02:00
Matthias Clasen
f8daed11f3 Merge pull request #2210 from piotrdrag/pl-update-181007
Update Polish translation 181007
2018-10-07 19:33:25 -04:00
Piotr Drąg
ed9bf60e02 Update Polish translation 2018-10-08 00:33:53 +02:00
Alexander Larsson
b6a8cab35f Update pofiles 1.0.3 2018-10-04 14:54:32 +02:00
Alexander Larsson
651785c974 tests: Don't dist the .wrap files (as they don't exist) 2018-10-04 11:22:50 +02:00
Alexander Larsson
1196ff54bf Update version to 1.0.3 2018-10-04 11:08:16 +02:00
Alexander Larsson
eb5ffeab77 Update NEWS for 1.0.3 2018-10-04 11:08:05 +02:00
Alexander Larsson
a94eea8cc7 build-update-repo: Add appstream2 to the metadata cache
The old "appstream" is there already, and this allows us to get
things like download size info for it.

Closes: #2182
Approved by: alexlarsson
2018-10-04 06:58:23 +00:00
Alexander Larsson
35b92d7237 Support --allow=canbus for AF_CAN access
This fixes https://github.com/flatpak/flatpak/issues/2176

Closes: #2179
Approved by: alexlarsson
2018-10-03 14:31:30 +00:00
Kalev Lember
1a827c0469 transaction: Return G_IO_ERROR_CANCELLED when cancelled
Instead of FLATPAK_ERROR_ABORTED, return G_IO_ERROR_CANCELLED when the
passed in GCancellable gets cancelled. This makes it possible to cancel
updates in gnome-software without getting a generic "Aborted due to
failure" error popup.

Closes: #2178
Approved by: alexlarsson
2018-10-03 13:56:49 +00:00
Alexander Larsson
89e2b6679c Don't expose host /dev/shm with --device=all (fixing debian problems)
--device=all really means the device nodes, we should not expose the host
shared memory objects.

This change incidentally fixes issues with --device=all on debian (#2136)
where /dev/shm is a symlink to /run/shm, which doesn't exist in the sandbox.

Closes: #2160
Approved by: alexlarsson
2018-10-03 13:56:44 +00:00
Alexander Larsson
43c7e7eeec tests: Don't generate the .wrap tests, launch them via test-wrapper.sh
There is no need for these files to be generated on disk

Closes: #2170
Approved by: alexlarsson
2018-10-03 13:19:35 +00:00
Alexander Larsson
5ab1b99d62 tests: Run in /tmp
These days we don't really need xattrs for the tests to run,
so move the test runs to /tmp, which brings down make check time
from 5 to 3.5 minutes on my machine.

Closes: #2170
Approved by: alexlarsson
2018-10-03 13:19:35 +00:00
Alexander Larsson
5fa3fbf19e tests: Autogenerate test matrix
Several tests have alternative wrappers that just set some feature
flags. For instance to switch between user and system and with or
without deltas. This change makes those wrappers automatically
generated from a simple description of the features.

For example the test-run.sh test goes from:
-       tests/test-run.sh \
-       tests/test-run-system.sh \
-       tests/test-run-deltas.sh \
-       tests/test-run-system-deltas.sh \
to
+       tests/test-run.sh{{user+system},{nodeltas+deltas}} \

There is some complexity here because the TESTS variable in automake
can't be runtime generated, so we rewrite it during "make
update-test-matrix" and commit the result to git.

The way it works is that make update-test-matrix takes the
TEST_MATRIX_SOURCE list, passes it to tests/expand-test-matrix.sh
which generates all the combinations in tests/Makefile-test-matrix.am.inc
where a test like tests/test-foo.sh{user+system} will get
converted to tests/test-foo.sh@user.wrap and tests/test-foo.sh@system.wrap.

We then have a pattern rule matchin tests/*.wrap which will generate
a wrapper that sets the right environment flags based on $0 and then
spawns the wrapper.

Closes: #2170
Approved by: alexlarsson
2018-10-03 13:19:35 +00:00
Piotr Drąg
58c1b9c46d Update POTFILES.in
Closes: #2172
Approved by: alexlarsson
2018-10-03 09:15:26 +00:00
Umang Jain
8da2c64fa1 dir: Fix parameter naming for consistency
Closes: #2173
Approved by: alexlarsson
2018-10-03 09:02:13 +00:00
Matthew Leeds
7c5751a4f9 create-usb: Avoid updating the source repo summary
This commit removes the call to flatpak_dir_update_summary() in the
create-usb implementation. It turns out that libostree does not rely on
a summary being present when a pull is local (meaning it uses a file://
URI). I'm not sure where I got the idea that create-usb depends on a
summary in the source repo. I went back to the first commit that
introduced the "ostree create-usb" command and even using that a summary
isn't required, so it seems unlikely that this changed recently.

One important benefit of removing the summary update is that currently
summary generation takes an exclusive lock, and we've seen on Endless
the attempt to acquire that lock time out (possibly due to a prune
happening in another process).

We could also remove the system-helper method UpdateSummary since it
doesn't have any users after this commit, but maybe someone will need it
in the future, and technically removing it would be an API break.

Closes: #2166
Approved by: alexlarsson
2018-10-02 06:32:54 +00:00
Robert McQueen
8bd22682f7 installation: nitpicks
Make the new _run_triggers function appear correctly in GtkDoc and cross-link.

Closes: #2164
Approved by: alexlarsson
2018-10-02 06:22:27 +00:00
Matthias Clasen
823511b87a Update tests for changed errors
Great that we're actually testing these.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
868552cb1f Fix localization
On the library side, we need to include gi18n-lib in order
to use dgettext for _().

Closes: #2163

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
e9bf1c3f75 Replace a warning with an error
It is not really nice to have g_warnings pop out of
the library left and right, they should be replaced
by proper errors as far as possible. This is a small
start.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
56d975f8c4 Add a few more error codes
Add FLATPAK_ERROR_INVALID_DATA and use if for cases where
the incoming data for an update or install is faulty, and
add FLATPAK_ERROR_UNTRUSTED, FLATPAK_ERROR_SETUP_FAILED and
FLATPAK_ERROR_EXPORT_FAILED to cover more error conditions.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
5b9d8e5ab8 Translate more error messages
As a rule of thumb, if we use a FlatpakError, the message
is probably worth translating.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
38eebef90c Avoid flatpak_fail in ref parsing
Add an error code for invalid refs, and use it when
composing or decomposing refs.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
9d0fbdd0b4 FlatpakContext: Avoid flatpak_fail
flatpak_fail is a convenient shortcut, but falls short
for actual error reporting. Use proper G_OPTION_ERROR
error codes here.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
df4df62d04 Fix a typo
Its bwrapinfo.json, not brwapinfo.json

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Robert McQueen
33cfa59af6 installation: tidy doc comments on new API additions
Closes: #2162
Approved by: alexlarsson
2018-10-01 14:43:09 +00:00
Robert McQueen
00fcc65157 installation: fix inverted logic in new _NO_TRIGGERS flag
Philip Withnall wins today's gold star.

Closes: #2162
Approved by: alexlarsson
2018-10-01 14:43:09 +00:00
Matthias Clasen
dd7a163a28 run: Document new options
Document --user, --system nd --installation.

Closes: #2158
Approved by: alexlarsson
2018-10-01 13:05:12 +00:00
Matthias Clasen
651c86d3c6 run: Allow selecting an installation
It may be an unlikely case, but if the same app
is installed in multiple installations, there was
no way to select which one to run, so far.

Closes: #2146

Closes: #2158
Approved by: alexlarsson
2018-10-01 13:05:12 +00:00
Matthias Clasen
2290099ead Add a new utility function for finding deploys
flatpak_find_deploy_for_ref_in is a variation of
flatpak_find_deploy_for_ref that allows to restrict
what installations to search in.

Closes: #2158
Approved by: alexlarsson
2018-10-01 13:05:12 +00:00
Robert McQueen
041ae7bd99 installation: add _run_triggers function
Closes: #2161
Approved by: alexlarsson
2018-10-01 12:29:50 +00:00
Robert McQueen
3dea58b53b installation: add _NO_TRIGGERS flags to install/update/uninstall ops
Closes: #2161
Approved by: alexlarsson
2018-10-01 12:29:50 +00:00
Robert McQueen
b881d9576f dir: use g_utime in flatpak_dir_mark_changed
Avoids an un-necessary fsync() call of an empty file.

Closes: #2161
Approved by: alexlarsson
2018-10-01 12:29:50 +00:00
Matthias Clasen
6c806f2dd9 repo: Don't use remote ostree-metadata
The code was looking for a ref with the name
ostree-metadata, but using an api that falls
back to remote refs with the same name, which
is not desirable here.

Use a different ostree api instead that only
resolves local refs.

Closes: #1805

Closes: #2157
Approved by: alexlarsson
2018-10-01 11:40:37 +00:00