Commit Graph

6305 Commits

Author SHA1 Message Date
David Hewitt
e1c094be15 flatpak-transaction: Mark commit param on operation_done nullable 2020-12-21 09:09:51 +01:00
Phaedrus Leeds
b663394a4d Remove LGTM.com infra
We're switching to a GitHub action with the same underlying technology;
see the previous commit.
2020-12-21 09:08:13 +01:00
Phaedrus Leeds
f47274d38b CI: Add action for CodeQL analysis
Use an Action instead of LGTM.com, as suggested here:
https://github.com/flatpak/flatpak/pull/3970#issuecomment-747658238

Re-use the clang build action for resource efficiency.
2020-12-21 09:08:13 +01:00
Phaedrus Leeds
f2b2ce997d Merge pull request #4025 from pwithnall/git-clone
check: Limit clone depth for clones done as part of CI builds
2020-12-15 07:45:42 -08:00
Philip Withnall
3a83cc3df4 check: Bump OSTree dependency to v2020.8
This avoids having to download `master` and then check out a specific
commit. v2020.8 includes the commit which we were previously building.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-15 09:57:41 +00:00
Philip Withnall
dafc5ed5d8 Merge pull request #4028 from tintou/master
flatpak-installed-ref: Add annotation to content rating table
2020-12-15 09:56:09 +00:00
Corentin Noël
348ccb9565 flatpak-installed-ref: Add annotation to content rating table 2020-12-14 11:25:16 +01:00
Philip Withnall
1b391485f6 check: Limit clone depth for clones done as part of CI builds
There’s no need to fetch the entire git history for OSTree or malcontent
for each CI job. Do shallow clones and don’t fetch tags. This reduces
the bandwidth requirement for clones in a CI job by roughly a factor of
8.5 (from 19.5MB to 2.3MB)

See https://tecnocode.co.uk/2020/07/09/easily-speed-up-ci-by-reducing-download-size/

This is slightly complicated by the fact that OSTree is currently being
built from a relatively-recent git commit. Once the flatpak CI can
depend on a tagged OSTree release (say, 2020.8),
```
--branch master --shallow-since 2020-10-27
```
can be changed to
```
--branch v2020.8 --depth 1
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-12 17:06:40 +00:00
Alexander Larsson
b3321e9179 extra-data: Resolve runtime from the target installation
When installing to an installation we need to find the runtime to use
for the apply-extra-data script from the installation we're targeting,
because that is the one that FlatpakTransaction guaranteed has the
required dependencies (although its possible they came from the
default dependency source too, i.e. the system repos).

In particular, we run into this issue if nothing is installed
anywhere, and then we install an extra-data app into a custom
directory. The transaction will download the runtime, and it
will not be anywhere else. Without this change flatpak only
looked for the dependency in the systam an regular user dirs
where it isn't.
2020-12-09 16:12:25 +01:00
Philip Withnall
a9f5c124c1 flatpak-installation: Add default dep sources to list installed refs
It seems that all `FlatpakTransaction`s add the default dep sources, so
the internal transaction used to list installed refs for updates should
do the same.

This fixes a bug where
`flatpak_installation_list_installed_refs_for_update()` would return an
error saying “The application x requires the runtime y which was not
found” if the app was installed in the user repo, the runtime was
installed in the system repo, and no remote was configured (or one was
configured `xa.noenumerate=true`) in the user repo to provide the
runtime. If a remote was configured, the error wouldn’t be returned, but
the app would be spuriously listed for an update as its runtime couldn’t
be found.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-09 09:05:13 +01:00
Phaedrus Leeds
2a8602ed88 app: Swap order of rebase/uninstall calls
In case the second of these two fails, the first will still have been
added to the transaction. And since it's better to install the renamed
app but not uninstall the old one, than to uninstall the old one but not
install the new one, swap the order.

See also https://github.com/flatpak/flatpak/issues/3991
2020-12-09 09:03:31 +01:00
Simon McVittie
ac15566672 portal: Log a message when a fd cannot be exposed in the sandbox
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:44:27 +01:00
Simon McVittie
1fb8a68020 portal: Negative handles are an error
Always treat a negative handle as being out-of-range.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:44:27 +01:00
Simon McVittie
5562c921e8 portal: Raise an error if fds are out of range
Previously, we'd silently ignore remapped or sandbox-exposed fds that
were not included with the D-Bus message, which seems unlikely to
work as intended.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:44:27 +01:00
Simon McVittie
fe450d54ba test: Return G_DBUS_METHOD_INVOCATION_HANDLED where appropriate
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:34:19 +01:00
Simon McVittie
86dd000dd1 system-helper: Return G_DBUS_METHOD_INVOCATION_HANDLED where appropriate
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:34:19 +01:00
Simon McVittie
7eedd219e9 session-helper: Return G_DBUS_METHOD_INVOCATION_HANDLED where appropriate
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:34:19 +01:00
Simon McVittie
c704685ecf oci-authenticator: Return G_DBUS_METHOD_INVOCATION_HANDLED where appropriate
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:34:19 +01:00
Simon McVittie
e41e04cee3 portal: Return G_DBUS_METHOD_INVOCATION_HANDLED where appropriate
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:34:19 +01:00
Simon McVittie
cc7f863707 common: Add a backport of G_DBUS_METHOD_INVOCATION_HANDLED
This is syntactic sugar added in GLib 2.67.0, which makes it more clearly
correct when we return TRUE after a GDBus error.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-12-09 08:34:19 +01:00
Alexander Larsson
97d1eb8478 Update common/flatpak-exports.c
Co-authored-by: Simon McVittie <smcv@debian.org>
2020-12-09 08:31:45 +01:00
Casey Jao
3aaea7d206 Expose /var/usrlocal if "--filesystem=host" is specified.
As /usr/local points to ../var/usrlocal on Silverblue,
/run/host/usr/local was previously a broken link inside the
sandbox. This patch checks if /var/usrlocal exists and bind-mounts it
to /run/host/var/usrlocal.

See bug #4010.
2020-12-09 08:31:45 +01:00
Gustavo Costa
9311ae9b4d Update Brazilian Portuguese translation 2020-12-07 16:05:00 +01:00
Kukuh Syafaat
25fecb706b Update Indonesian translation 2020-12-07 16:04:50 +01:00
Phaedrus Leeds
77509d865d Merge pull request #4009 from perlpunk/doc-typo
docs: Fix typo in flatpak-search usage
2020-12-06 08:25:17 -08:00
Tina Müller
297076cd4e docs: Fix typo in flatpak-search usage 2020-12-04 20:42:48 +01:00
Alexander Larsson
e08e8344db Tweak NEWS 2020-11-20 15:48:20 +01:00
Alexander Larsson
aafe1f632c Update pofiles 1.9.2 2020-11-20 15:36:30 +01:00
Alexander Larsson
e03f319f19 Bump version to 1.9.2 2020-11-20 15:23:38 +01:00
Alexander Larsson
c2ee7ac9f5 Update NEWS 2020-11-20 15:23:32 +01:00
Alexander Larsson
a03c2739df Add back the ostree.commit.timestamp per-ref metadata for summary
The old summary had a ostree.commit.timestamp in the per-ref metadata
dict. However, since this was not used anymore by flatpak I removed it.
However, it turns out that flathub has infra that depends on this,
so I'm adding it back.

We reuse the data in the old summary for unchanged refs when
rebuilding the summary, to avoid having to read all the commits. In
the new world the new format summaries are used for this, which means
we have to keep the timestamp in that too. However, to not be
unnecessary large its now using a shorter key name, as this is
duplicated for each ref in the summary.
2020-11-20 15:20:15 +01:00
Alexander Larsson
ecda7757bb Fix multiarch support
A typo was causing us to pass the app id as arch, breaking (at least)
multiarch support.
2020-11-20 15:08:58 +01:00
Alexander Larsson
ea116809d1 remote-metadata-update: Don't clean caches if nothing changed
This was causing us to never cache the summary in user installations
2020-11-20 14:01:42 +01:00
Alexander Larsson
07f36b2e90 Fix test-summaries on non-x86-64 2020-11-20 09:27:17 +01:00
Alexander Larsson
a43c617870 tests: Don't hardcode x86-64 2020-11-20 09:27:17 +01:00
Phaedrus Leeds
1f53e73bf3 dir: Fix spurious permission denied errors
Currently this error is happening on the eos3.9 dev branch of Endless
OS:

Nov 19 12:05:55 endless eos-updater-flatpak-installer[464]:
eos-updater-flatpak-installer: Couldn’t apply some flatpak update
actions for this boot: Error opening directory
'/root/.local/share/flatpak/app': Permission denied

The reason is that we have a check in flatpak_dir_list_unused_refs() to
check if the per-user installation exists and only try to list the refs
there if so, but the existence check falsely succeeds due to the systemd
sandboxing on eos-updater-flatpak-installer.service, and
flatpak_dir_list_refs() then fails in find_used_refs(). Specifically the
ProtectHome=yes systemd service option makes /root inaccessible, and due
to a bug in GLib[1] this makes g_file_query_exists() falsely return TRUE
for any paths under /root.

So, check for not found and permission denied errors rather than doing
an existence check, as we should be doing anyway to avoid a
time-of-check/time-of-use race, as explained in the
g_file_query_exists() documentation.

[1] https://gitlab.gnome.org/GNOME/glib/-/issues/1237
2020-11-20 09:16:57 +01:00
Alexander Larsson
09b470c0fd transaction: Add more details to the ABORTED error
This is reported when we reported an error to the user via
::operation-error signal and the app told us to not continue.

If this happens in some weird case and we see the results its nice
to have access to the original error message.
2020-11-19 18:31:40 +01:00
Alexander Larsson
d395763327 Update pofiles for release 1.9.1 2020-11-19 11:12:25 +01:00
Alexander Larsson
c12f4a5b21 Fix build/dist of API docs
We don't want to dist the stamp files, because they are not actually
created.

Also include the AuthenticatorRequest dbus interface in the docs
2020-11-19 11:01:03 +01:00
Alexander Larsson
d8e0d2785e Update NEWS for release 2020-11-19 09:25:04 +01:00
Alexander Larsson
f650c303e3 Don't auto-install sources for extensions
There was a bug in the extension point matcher which made it
install `org.gnome.Totem.Videosite.YouTubeDl.Sources` (in addition to
`org.gnome.Totem.Videosite.YouTubeDl`) for the `org.gnome.Totem.Videosite`
extension.

We just need to make sure we only match the extension prefix if there
is a single element in the extension name following the extension
name (i.e. '.YouTubeDl', not '.YouTubeDl.Sources').

This fixes https://github.com/flatpak/flatpak/issues/3973
2020-11-18 17:36:10 +01:00
Alexander Larsson
c4c57312ba tests: Un-redirect url after trying redirect
After the --redirect-url= test is finished it leaves the remote with a
different url, which is confusing the other tests.

In particular, at some point we remove the remote and add it back,
which gets us back to the old url, but at that point the summary (from
the newer url) has a later mtime than the old one so the old one keeps
getting used.

So, we unset the redirect and set back the old url. Also, the following test
had to be tweaked for this change.
2020-11-17 15:20:43 +01:00
Alexander Larsson
7043093a5f tests: Avoid unnecessarily recreating the summary file
We enforce --no-update-summary when we create test apps and
runtimes, and then we ensure we always manually call update_repo
after all modifications are done.

This means we save work avoiding summary updates, but it also means we
can do special handling in update_summary and guarantee that this is
the only place this happens. For example, we want this to work around
the mtime handling of summary updates.
2020-11-17 15:20:43 +01:00
Alexander Larsson
bc46f13327 Update NEWS for 1.9.1 2020-11-17 15:20:43 +01:00
Yuri Chornoivan
d60c90c3e6 Update Ukrainian translation 2020-11-17 13:58:34 +01:00
Rodhos
243bb11ce6 Spanish translation (#3966)
* Update spanish translation

* Update spanish translation
2020-11-16 17:41:57 +01:00
Ludovico de Nittis
a17224cd08 context: do not use a cast to convert a pointer to an integer
Building with Clang 11 shows a warning for the cast of the 'gpointer' to
'FlatpakFilesystemMode'.
This is due to '-Wpointer-to-int-cast' being now enabled by default.

common/flatpak-context.c:2144:13: warning: cast to smaller integer type
'FlatpakFilesystemMode' from 'gpointer' (aka 'void *')
[-Wvoid-pointer-to-enum-cast]
fs_mode = (FlatpakFilesystemMode) g_hash_table_lookup (context->filesystems, "host");
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2020-11-16 11:24:38 +01:00
Alexander Larsson
c4d2d6f0a9 cli: Show branch in eol messages 2020-11-16 11:23:10 +01:00
Alexander Larsson
7eb5f4ddc8 cli-transaction: Better handling of EOL refs
We remember what action we took for EOLs, and for sub-refs (ie .Locale)
we reuse that.

Also, we show if eol:ed refs are pinned (as that makes them not be
auto-uninstalled), and we list the apps that use the eol:ed runtime
ref.

Example run:
```
Looking for updates…
Info: (pinned) org.gnome.Sdk.Compat.i386 is end-of-life, with reason:
   The GNOME 3.34 runtime is no longer supported as of 14th August 2020. Please ask your application developer to migrate to a supported platform.
Info: org.gnome.Platform is end-of-life, with reason:
   The GNOME 3.32 runtime is no longer supported as of 11th March 2020. Please ask your application developer to migrate to a supported platform.
Applications using this runtime:
   org.gnome.HexGL
```
2020-11-16 11:23:10 +01:00
Alexander Larsson
39333fdb33 dir: Minor optimization to find_used_ref()
Its commonly the case that a runtime lists itself as its runtime and/or sdk.
So, short circuit this in the finding of used refs.
2020-11-16 11:23:10 +01:00