Commit Graph

4158 Commits

Author SHA1 Message Date
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
Matthias Clasen
14cd84fa68 Be stricter about exports
We were exporting files in subdirectories of all the common
directories. This only really makes sense for icons. For
desktop files, D-Bus service files and mime types, we should
only export from the exact directory itself.

Note that this makes us no longer support the obsolescent
vendor-prefix convention of the desktop entry spec, which was
only relevant for KDE4 and breaks app-id matching.

Closes: #2142

Closes: #2152
Approved by: alexlarsson
2018-10-01 11:26:34 +00:00
Andreas Zuber
c102bd2b50 common: fix the "can't mkdir parents" error
This fixes the “bwrap: Can't mkdir parents for /var/run/user/1000/.dbus-proxy/: No such file or directory” error. This error occurs on systems where the path in the XDG_RUNTIME_DIR variable contains a symlink under var, for example /var/run → /run.

The reason for the error is that bubblewrap was called both with “--bind /var /var” and “--bind /var/run/user/1000/.dbus-proxy/ /var/run/user/1000/.dbus-proxy/”. This leads to the destination path already existing but with “/var/run” being a symlink. Bubblewrap then tries to make sure the mount point is present in the sandbox and creates all the dirs with its parents, which fails for “/var/run/user” because its parent is a symlink.

This fix simply resolves the path used for the runtime dir before it adds it to the bind parameter.

Closes: #2137
Approved by: alexlarsson
2018-10-01 11:12:07 +00:00
Matthew Leeds
b0ee220d02 uninstall: Refine definition of what is used
Currently it's possible for Flatpak to consider a runtime used but
consider its Locale extension unused when executing `flatpak uninstall
--unused`, which doesn't make much sense.  This only happens if the
runtime is indirectly used; in other words it's used as a related ref
rather than directly as the runtime of an installed app.

In the case of Endless, `com.endlessm.EknServicesMultiplexer` uses all
versions of `com.endlessm.apps.Platform`, and since v1 isn't used by any
app on this computer its Locale extension is considered unused:

$ flatpak list --runtime -a | grep com.endlessm.apps.Platform.*/x86_64/1
com.endlessm.apps.Platform.Locale/x86_64/1      system,partial
com.endlessm.apps.Platform/x86_64/1     system
$ flatpak uninstall --unused
Uninstalling from system:
com.endlessm.apps.Platform.Locale/x86_64/1
Is this ok [y/n]:

This commit changes the behavior of uninstall --unused so that when
something is considered used because it's a related ref, we recursively
check its own related refs so they are considered used too.

Closes: #2103
Approved by: alexlarsson
2018-10-01 10:58:21 +00:00
Kukuh Syafaat
5bf5bab859 Update Indonesian translation
Closes: #2159
Approved by: alexlarsson
2018-10-01 06:31:26 +00:00
Matthias Clasen
d83adbc71a docs: Document environment variable handling
Mention how flatpak run handles environment variables,
and include the blacklist of variables we always override.

Closes: #2141
Approved by: alexlarsson
2018-09-27 07:29:18 +00:00
Matthias Clasen
24d70fee0a ref: Document thread-safety
State that FlatpakRef objects are immutable and
can thus be used freely across threads.

Closes: #2141
Approved by: alexlarsson
2018-09-27 07:29:18 +00:00
Matthias Clasen
8132978169 installation: Document thread-safety
Based on my understanding of the matter, we claim
that FlatpakInstallation api is threadsafe.

This commit rewords things a bit, to more strongly
recommend FlatpakTransaction as the preferred API
for the tasks that it covers.

Closes: #2141
Approved by: alexlarsson
2018-09-27 07:29:18 +00:00
Matthias Clasen
22f12aa7b7 transaction: Document thread-safety
Based on my understanding of the matter, we claim
that FlatpakTransaction api is threadsafe.

Closes: #2141
Approved by: alexlarsson
2018-09-27 07:29:18 +00:00
Matthias Clasen
7ea96906dc transaction: Flesh out the docs
Explain why 'transaction' is really a misnomer.

Closes: #2141
Approved by: alexlarsson
2018-09-27 07:29:18 +00:00
Matthias Clasen
1c665eca5e Merge pull request #2143 from mwleeds/runtime-error-msg-typo
common: Fix wording of missing runtime error
2018-09-26 20:53:43 -04:00
Matthew Leeds
3ac63fdcdf common: Fix wording of missing runtime error 2018-09-26 13:53:56 -07:00
Alexander Larsson
167bf49ccf build-init: Record the base ref in the metadata
This information is nice to have. For example, it can be used
to optimize deltas by reusing delta parts from the base ref.

Closes: #2140
Approved by: alexlarsson
2018-09-26 12:21:09 +00:00
Matthias Clasen
146ff4845d Update POTFILES.in
Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
5213645f58 Split a file
Split flatpak-builtins-add-remote.c into separate files
for the two commands that are defined in here, and rename
things to match the other commands.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
dd822f2781 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
ddbf0103c6 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
de2c69c728 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
356742c7e7 Rename a file
This is anther step towards making command names
match the files they are defined in.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:42 +00:00
Matthias Clasen
86634cfece Rename a file
To avoid unnecessary confusion, rename flatpak-buitins-repo-update.c
to match the command thats defined in it.

Closes: #2132
Approved by: alexlarsson
2018-09-26 09:02:41 +00:00
Matthias Clasen
8f9aa2f35f Fix a thinko in the permission commands
Better to only call g_dir_close() if dir isn't NULL.

Take this opportunity to move the function to utils,
instead of carrying 4 identical copies.

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

Closes: #2133
Approved by: alexlarsson
2018-09-25 12:17:16 +00:00
Matthew Leeds
9091749a27 create-usb: Always use archive mode
Change the create-usb command so that it always creates the destination
repository using the "archive" mode, rather than using archive mode when
xattrs aren't supported and bare-user otherwise. This has a few
advantages:

1. The archive mode works with FAT filesystems, which is what most USB
drives are, and which doesn't support xattrs. This should fix
https://github.com/flatpak/flatpak/issues/2019 but it would be good to
confirm.

2. At least in some quick testing I did, archive mode is about twice as
performant as bare-user mode, in terms of how long it takes for the
create-usb command to complete.

3. This ensures that a tool can safely change the permissions on
".ostree/repo" and subdirectories after create-usb completes, which is
important for Endless since otherwise you can't use `ostree create-usb`
as root and then `flatpak create-usb` as a non-root user on the same USB
drive (or in other words copy OS updates and apps to the same USB).

Closes: #2124
Approved by: alexlarsson
2018-09-24 08:44:24 +00:00
Matthew Leeds
bd81ec7b5d create-usb: Don't leave a GError set
This commit avoids passing the error pointer to
flatpak_dir_get_deploy_data() in add_related() because we're not
treating the error as fatal. Otherwise the already-set error pointer can
get passed to flatpak_dir_update_summary() causing libostree to hit an
assertion failure when it checks (error == NULL || *error == NULL) in
_ostree_repo_lock_push().

Closes: #2110
Approved by: alexlarsson
2018-09-24 08:32:08 +00:00
Matthias Clasen
3eed1f42a5 Add more tests
Test some more of the FlatpakRef api, including properties.

Closes: #2108
Approved by: alexlarsson
2018-09-24 08:18:10 +00:00
Simon McVittie
36e3644d18 test-webserver: Fix race condition
If we rely on the background subshell to create the httpd-output file,
and we are unlucky, then the "cp" invocation in the loop might execute
before the file has been created, and fail. This appears to have
happened on Debian's arm64 autobuilder, which failed with:

    Running web server: PYTHONUNBUFFERED=1 setsid python3 /<<PKGBUILDDIR>>/tests/http-utils-test-server.py 0
    Web server pid: 13319
    Waiting for web server (1/300)...
    cp: cannot stat '/var/tmp/tap-test.p1cxRN/httpd-output': No such file or directory

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #2098
Approved by: alexlarsson
2018-09-24 08:06:51 +00:00
Matthias Clasen
66167ba5e8 Add the new submodule to autogen.sh
This is not perfect, but will make fresh checkouts work
as well as before.

Closes: #2121
Approved by: alexlarsson
2018-09-24 07:55:20 +00:00
Matthias Clasen
2b3b4e8e53 Merge pull request #2128 from piotrdrag/pl-update-180923
Update Polish translation 180923
2018-09-23 18:19:06 -04:00
Piotr Drąg
e02ed6e945 Update Polish translation 2018-09-23 18:30:36 +02:00
Philip Withnall
56b23fea65 Merge pull request #2119 from mwleeds/implement-deploy-collection-id
Replace xa.collection-id with ostree.deploy-collection-id
2018-09-21 14:06:16 +01:00
Matthew Leeds
48ceed70be Replace xa.collection-id with ostree.deploy-collection-id
Currently Flatpak reads a repo metadata key called "xa.collection-id" to
decide whether to configure a collection ID on a remote. This commit
drops support for xa.collection-id and replaces it with
ostree.deploy-collection-id, which is a key defined by OSTree but so far
only implemented here.

The reason for the change is so that collection IDs can only be deployed
to users running recent versions of Flatpak and OSTree. The current
situation is that Endless wants to deploy collection IDs (and therefore
support for doing USB updates) to users, but servers such as Flathub
can't safely set xa.collection-id in their metadata, because many users
are still using old versions of Flatpak and OSTree[1] which would hit
various bugs[2][3][4] on the P2P code paths that are enabled by
collection IDs. Defining a new key means that only users running
recent (as-yet-unreleased) versions of Flatpak and OSTree will pay
attention to it and deploy the collection ID, leaving the users on old
versions unaffected.

The reason this metadata key is being defined at the level of OSTree
instead of Flatpak, is that OSTree may want to implement it in the
future.

The functionality of deploying a collection ID by setting the
"deploy-collection-id" key in the config on the server side (which in
turn causes ostree.deploy-collection-id to be set) is already covered by
the unit tests in test-update-remote-configuration.sh; this commit just
tweaks them to use the new key.

Another solution I proposed to this problem was to have a key
"eos.collection-id" which would only be understood by the Endless fork
of Flatpak, and use that temporarily until enough people are running
recent versions of Flatpak, at which point "xa.collection-id" can be
used. But this solution (abandoning xa.collection-id upstream) allows us
to avoid that migration step and leave users on old versions of Flatpak
completely unaffected.

[1] https://ahayzen.com/direct/flathub.html#downloadsbyflatpakstacked
[2] https://github.com/ostreedev/ostree/commit/e4e6d85ea
[3] https://github.com/flatpak/flatpak/commit/5813639f
[4] https://github.com/flatpak/flatpak/commit/5b21a5b7
2018-09-19 17:23:08 -07:00
Matthias Clasen
d129175eaa Merge pull request #2105 from AsciiWolf/cs-update
Update Czech translation
2018-09-16 12:12:50 -04:00
Matthias Clasen
0b1b43331a Merge pull request #2096 from cho2/l10n
Update Indonesian translation
2018-09-16 12:06:30 -04:00
AsciiWolf
3607352433 Update Czech translation 2018-09-15 17:06:34 +02:00
Kukuh Syafaat
f593020f69 Update Indonesian translation 2018-09-14 20:07:06 +07:00
Alexander Larsson
2ec63469ec Update po/* 1.0.2 2018-09-13 14:00:56 +02:00
Alexander Larsson
d16b393a34 bundles: Fix leak
The collection id check that was added leaks if we were able
to read the collection-id, but then it was ignored.

Closes: #2093
Approved by: alexlarsson
2018-09-13 09:53:25 +00:00
Alexander Larsson
10fb620031 Update dbus-proxy version to get .gitignore 2018-09-13 11:00:31 +02:00
Alexander Larsson
c53b127048 Bump version to 1.0.2 2018-09-13 10:53:55 +02:00
Alexander Larsson
a3030845de Update NEWS 2018-09-13 10:51:47 +02:00
Alexander Larsson
a0a85d6aa8 Import dbus-proxy as a submodule instead
Since we now broke out dbus-proxy to a separate module, build
the in-tree copy as a submodule.

Closes: #2092
Approved by: alexlarsson
2018-09-13 07:58:36 +00:00
Alexander Larsson
1959f6bf75 Allow building with system version of xdg-dbus-proxy
Closes: #2092
Approved by: alexlarsson
2018-09-13 07:58:36 +00:00
Matthew Leeds
7b0e84f527 main: Don't spuriously print usage info
Currently if any command errors out with G_IO_ERROR_NOT_SUPPORTED,
flatpak prints the usage information (the output of --help), but this is
not correct. For example if the create-usb command hits that error when
trying to use extended attributes on a filesystem that doesn't support
them, the help output is printed as we saw here:
https://github.com/flatpak/flatpak/issues/2019#issuecomment-416798304

So this commit removes the check for G_IO_ERROR_NOT_SUPPORTED in
flatpak-main.c and the helper function it uses. The flatpak_run()
function handles printing usage info for the overall flatpak command,
and subcommands use the usage_error() function to print usage
information, so there's no need for it.

Closes: #2082
Approved by: alexlarsson
2018-09-12 07:17:29 +00:00
Matthew Leeds
e4befb12ac common: Better handle NULL collection IDs
Currently if you install from a flatpak bundle that doesn't have a
collection ID set or from a flatpakref file that has the CollectionID
key set to the empty sting, you end up with an invalid configuration on
the origin remote created. This is because the collection_id parameter
of flatpak_dir_create_origin_remote() is set to the empty string, not
NULL, and create_origin_remote_config() then only checks for NULL when
deciding whether to set gpg-verify-summary to true or false. Then
because there's no collection ID configured but gpg-verify-summary is
set to false, you get the error "Can't pull from untrusted non-gpg
verified remote" when trying to pull related refs or update the app.

This commit fixes the bug by checking for the empty string when the
collection ID is read from a bundle or ref file, and collapsing that
into NULL.

Closes: #2081
Approved by: alexlarsson
2018-09-12 07:07:13 +00:00