Commit Graph

6076 Commits

Author SHA1 Message Date
Simon McVittie
4ebb4db06f data: Document the Development interface
This is heavily based on the corresponding documentation for the
portal.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Simon McVittie
727d45eb8c data: Briefly document the SessionHelper interface
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Simon McVittie
14870402d0 portal: Adjust documentation for SpawnSignal, SpawnExited
This is based on documentation that I wrote for Steam's pressure-vessel,
which has a Launcher interface based on the API and implementation of
the Flatpak portal.

I haven't renamed exit_status to wait_status like commit 63feb3cc in
flatpak-xdg-utils, just in case the name is significant in someone's
code-generation. However, don't be fooled: it's a wait-status, not
an exit status.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Simon McVittie
ba5c3a7e9a portal: Document the symbolic names of the flags
They aren't currently in any installed header file, but that doesn't
mean we can't suggest a name for dependent projects to #define.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Simon McVittie
f9b90d5c32 portal: Document forwards-compatibility for flags and options
Flags are assumed to be critical, similar to the convention for modern
Linux syscalls: if an unknown flag is given, the call will fail.
Callers are expected to guard their use of flags with a version check
or a fallback.

Conversely, options are assumed to be non-critical "hints", similar
to org.freedesktop.Notifications: if an unknown option is given, the
call will succeed as though the option had not been present. Callers
are expected to carry out an explicit version check if they need to
know whether an option is going to be respected or not.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Simon McVittie
b5a5b18103 portal: This is the flatpak portal, not the documentation portal
Also specify that it's on the session bus, not some other bus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Simon McVittie
4aa7af4379 portal: Fix typos in documentation
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Phaedrus Leeds
5248f0771a Merge pull request #3873 from wjt/sideload-repos-systemd-nonexistent-media-dir
sideload-repo-systemd: Don't require media dir to exist
2020-09-23 10:36:56 -07:00
Will Thompson
c59a5db5a9 sideload-repo-systemd: Don't require media dir to exist
When launched when the session starts, /run/media/%u may not exist if
the user has never mounted any removable storage devices. This causes
the unit to fail on login.

Relax the check to just validate that the argument has been provided.
Since we use shopt -s nullglob, the "$media_dir"/* glob will expand to
the empty list if $media_dir does not exist.

(The other option is to add a condition check to the .service, but the
script might conceivably want to clean up some stale symlinks.)
2020-09-23 10:02:31 +01:00
Phaedrus Leeds
b3218b6e75 Merge pull request #3863 from rffontenelle/patch-1
Update Brazilian Portuguese translation
2020-09-22 18:44:35 -07:00
Phaedrus Leeds
eea84212e9 Merge pull request #3866 from wjt/create-sideload-symlinks-nullglob
sideload-repo-systemd: Various fixes
2020-09-22 13:21:39 -07:00
Phaedrus Leeds
192da15f60 sideload-repos-systemd: Update a comment 2020-09-21 20:49:01 -07:00
Phaedrus Leeds
093b22f5a3 sideload-repo-systemd: Only remove owned sym links
Check file ownership to ensure flatpak-create-sideload-symlinks.sh
only cleans up links it created. This could be relevant on multi-user
systems with fast user switching.
2020-09-21 20:48:51 -07:00
Phaedrus Leeds
49096521fd sideload-repos-systemd: Make sym link more human friendly
Use escaping rather than checksumming to generate a unique name, as
discussed here:
https://github.com/flatpak/flatpak/pull/3866#issuecomment-694784359
2020-09-21 18:16:26 -07:00
Phaedrus Leeds
9b82fbfabb sideload-repos-systemd: Adjust whitespace 2020-09-21 18:14:38 -07:00
Will Thompson
c43e8e1331 sideload-repos-systemd: Don't launch service in a tight loop
man systemd.path has the following to say:

> When a service unit triggered by a path unit terminates (regardless
> whether it exited successfully or failed), monitored paths are checked
> immediately again, and the service accordingly restarted instantly.

On my system, I observe that once /run/media/wjt is created,
flatpak-sideload-usb-repo.service is invoked in a tight loop. I think
what's happening is that PathExists=/run/media/wjt continues to be true,
so the service keeps getting restarted.

What we instead want is to activate the .service:

- On login
- When the media directory *changes* (because mount points beneath it
  appear or disappear)

Remove PathExists from the .path, and instead mark the .service as
WantedBy default.target so it is launched on login.
2020-09-18 11:57:38 +01:00
Will Thompson
8c61324b6b sideload-repo-systemd: Set 'nullglob' option
Previously, if there were no existing symlinks, this script would fail:

    wjt@camille:~$ LANG=en_GB.utf8 bash -x /usr/libexec/flatpak-create-sideload-symlinks.sh /run/media/wjt
    + test 1 -eq 1
    + test -d /run/media/wjt
    + for f in "$1"/*
    + test -d '/run/media/wjt/*'
    + continue
    + for f in /run/flatpak/sideload-repos/automount-*
    + test -e '/run/flatpak/sideload-repos/automount-*'
    + rm '/run/flatpak/sideload-repos/automount-*'
    rm: cannot remove '/run/flatpak/sideload-repos/automount-*': No such file or directory

This is due to the surprising POSIX shell behaviour that a glob that
matches no files expands to itself, rather than to the empty list.

http://mywiki.wooledge.org/BashFAQ/004

The POSIX solution is to add 'test -L $f' inside the loop to check if
the variable actually exists.  The first loop in this script uses this
technique: it has a 'test -d "$f"', seen in the trace above.

Bash implements a 'nullglob' feature which gives globs the behaviour you
might hope for. Set it in this script.
2020-09-18 11:09:35 +01:00
Rafael Fontenelle
37d42d46e4 Update Brazilian Portuguese translation 2020-09-16 08:01:43 -03:00
Bastien Nocera
6b46d9a0ed common: Allow skewering when converting in app-id for DConf migration
Allow a snake-case in the app-id to convert to a '-' or '_' in the
DConf path to be considered similar enough for DConf migration purposes.

This allows the org.gnome.SoundJuicer app-id to migrate its
/org/gnome/sound-juicer DConf path.

F: Ignoring D-Conf migrate-path setting /org/gnome/sound-juicer/
2020-09-15 08:59:53 +02:00
Bastien Nocera
c6802d2c0e common: Prepare DConf path parsing for changes
Separate the variables used to keep track of which character we were
checking in each of the paths.

No functional changes.
2020-09-15 08:59:53 +02:00
Phaedrus Leeds
d7c481aff8 build-commit-from: Fix whitespace 2020-09-15 08:58:49 +02:00
Phaedrus Leeds
92742d8387 dir: Remove superfluous flatpak_dir_ensure_repo()
This is no longer needed since a FlatpakRemoteState is passed in, which
ensures the repo exists. The similar call was already removed from
flatpak_dir_install().
2020-09-15 08:58:49 +02:00
Phaedrus Leeds
65c9e15fc9 flatpak-variants.gv: Fix typo
Similar fix for the ostree data here:
https://gitlab.gnome.org/alexl/variant-schema-compiler/-/merge_requests/7
2020-09-15 08:58:49 +02:00
Phaedrus Leeds
baa5ba2e8d remote-info: Remove duplicate warning 2020-09-15 08:58:49 +02:00
Phaedrus Leeds
08f692962e Avoid shadowing local variables
Avoid shadowing variables that are already declared in a previous scope,
and make such occurrences compile-time errors. These are not functional
changes.

In a few places do related code cleanup.

A similar ostree PR is here:
https://github.com/ostreedev/ostree/pull/2195
2020-09-15 08:58:49 +02:00
Phaedrus Leeds
d7cca22d7c info: Only load from specified installation
flatpak_find_deploy_for_ref() will look for a deploy across all
installations, but we want to use the user-specified one, e.g. user if
--user was passed.

Pointed out here:
https://github.com/flatpak/flatpak/pull/3853#discussion_r487711857
2020-09-15 08:58:49 +02:00
Phaedrus Leeds
8b43c43b30 Update bubblewrap submodule
To add -Werror=shadow we need
https://github.com/containers/bubblewrap/pull/389
2020-09-15 08:58:49 +02:00
Phaedrus Leeds
075c86ca4f portal: Fix unset GError issue
Fix lookup_installation_for_path() to not leave the GError pointer unset
on its error code path. This error is only used by the caller for a
debug message, and shouldn't be hit normally, but it could mean a NULL
pointer dereference when we try to print error->message.
2020-09-15 08:53:05 +02:00
Simon McVittie
5ce60b5e54 tests: Exercise host-os, host-etc and os-release in fake system roots
Now that FlatpakExports can be told to look for /etc and /usr in a
fake directory hierarchy, we can assert that systems resembling
particular OSs' layouts still work, even if we are not running on that
OS right now. In particular, this provides unit tests for commits
12e3dc05, 08d65c54, 7872935e and fe2536b8.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-14 11:12:25 +02:00
Simon McVittie
1b28b5395d tests: Assert that symlinks point to the right place
The previous implementation was rather simplistic, and assumed that
all symlinks that get exported are in /tmp/something/test_full/.
Tighten up the assertions, while also coping with symlinks that are
created at top level, such as /bin -> usr/bin.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-14 11:12:25 +02:00
Simon McVittie
89a4e330b4 tests: Allow asserting that a bind-mount has a different target
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-14 11:12:25 +02:00
Simon McVittie
5af5700af8 exports: Allow redirecting /etc, /usr from the host to an alternative
This is primarily for test coverage ("design for test"): it will let us
pretend a temporary directory is the host for the purposes of testing
--filesystem=host-etc, --filesystem=host-os, and the os-release handling
from #3733.

It can also be used to build a bwrap command-line that will be used on
the host, while already inside a container, which will be useful for
Steam's pressure-vessel tool (which copies some of the Flatpak code).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-14 11:12:25 +02:00
Phaedrus Leeds
d73d6c16f3 sideload-repos-systemd: Use systemd-tmpfiles
Instead of using a systemd service to create the directory we need for
sideloading (/run/flatpak/sideload-repos), use a systemd-tmpfiles conf
file. This is more elegant, and the service also had a bug which meant
it would create a "/run/flatpak;" directory instead of the one intended.

Since systemd-tmpfiles-setup.service runs before sysinit.target and path
units are run after sysinit.target, the tmp directory should be in place
when flatpak-sideload-usb-repo.path runs in the systemd user instance.

Endless OS already has a file at /lib/tmpfiles.d/flatpak.conf, so we
can't use that filename.
2020-09-14 10:57:46 +02:00
Phaedrus Leeds
238317d99b Avoid critical error in remote-info command
Without this patch, the remote-info command will sometimes emit a
critical error "g_utf8_strlen: assertion 'p != NULL || max == 0' failed"
and print (null) for the "Commit:" field, since the commit doesn't get
initialized properly.
2020-09-14 09:32:27 +02:00
Alexander Larsson
d8086141fb Don't loop authentincating if updating to the current version
In case we need to authenticate for updates (in my test case i was
doing an OCI downgrade) we might need to download a commit object (or
in the OCI case a manifest json), so it did a request_required_tokens(),
but that noticed during the flatpak_transaction_normalize_ops() call
that the partial resolve to a particular commit actually was the
same as the local installed commit and marked op->skip = TRUE.

However, when we got back to resolving the op again we didn't actually
look at the skip, so it kept looping wanting (but never doing) auth.

The fix is to just directly resolve ops marked as skipped.
2020-09-14 09:30:30 +02:00
Alexander Larsson
7622aab962 OCI: Fix progress reporting
Somewhere during the progress reporting cleanup we lost the progress
for OCI pulls, this puts it back.
2020-09-14 09:30:14 +02:00
Owen W. Taylor
25ff00994f OCI: extract appstream data for runtimes
Runtimes also have appstream data - with description, license information,
and so forth, so we should extract the appstream data from the index
for refs that start with runtime/ as well.
2020-09-11 09:35:05 +02:00
Phaedrus Leeds
59f582e6cd Merge pull request #3834 from piotrdrag/piotrdrag/update-potfiles-200905
Update POTFILES.in 200905
2020-09-09 14:01:51 -07:00
Phaedrus Leeds
bf6f4cebf5 Merge pull request #3837 from scootergrisen/patch-3
Update danish translation
2020-09-09 14:00:37 -07:00
Phaedrus Leeds
f701535bf5 Merge pull request #3844 from yurchor/uk_update3
Update Ukrainian translation
2020-09-09 13:59:21 -07:00
Phaedrus Leeds
1be24d0d31 Merge pull request #3832 from ktosiek/flatpak-enter-dbus-address
Fix DBUS_*_BUS_ADDRESS in flatpak enter
2020-09-09 13:58:27 -07:00
Yuri Chornoivan
216ac981e2 Update Ukrainian translation 2020-09-09 21:20:18 +03:00
scootergrisen
d234d6e19c Update danish translation 2020-09-06 17:43:30 +02:00
Piotr Drąg
4f7a90dffa Update POTFILES.in 2020-09-05 12:33:48 +02:00
Tomasz Kontusz
e39b94b26c Fix DBUS_*_BUS_ADDRESS in flatpak enter
Fixes #3820.
2020-09-04 18:27:21 +02:00
Phaedrus Leeds
54bef2f29a Merge pull request #3829 from milotype/milotype20200903
Update Croatian
2020-09-03 12:59:39 -07:00
milotype
6ce722c3fe Update Croatian
- update is based upon the current .pot file at: 
https://l10n.gnome.org/vertimus/flatpak/master/po/hr/
2020-09-03 14:14:05 +02:00
Phaedrus Leeds
a70b7a7628 installation: Clarify that SDKs aren't considered used
The docs claimed that SDK runtimes are considered used even if there is
no app using them or runtime for which they are the SDK, but the
implementation does not match that.

We could change the implementation to always consider SDK runtimes used,
but that would be problematic because some apps use an SDK as their
runtime, and in that case the runtime would persist forever after the
app is uninstalled, instead of eventually being garbage collected by the
subsequent commits to this one.
2020-08-31 16:29:03 +02:00
Phaedrus Leeds
47c88706e0 app: Make mask and pin output more machine readable
This way we can use "wc -l" in the tests to check how many masks/pins
there are.
2020-08-31 16:29:03 +02:00
Phaedrus Leeds
097faa8411 uninstall: Note pinned runtimes in --unused output
When "flatpak uninstall --unused" is run, we don't remove unused
runtimes that are pinned. List them in the output so the user knows they
are being left installed.

This commit also adds new library API,
flatpak_installation_list_pinned_refs().
2020-08-31 16:29:03 +02:00