Commit Graph

7164 Commits

Author SHA1 Message Date
Matthias Clasen
596f0f68d5 dir: Add an api to set a source pid
This will be used by the system helper to indicate
what process it is acting on behalf of.
2018-10-11 14:51:51 +02:00
Piotr Drąg
76dd97e918 Update POTFILES.in
Closes: #2236
Approved by: mwleeds
2018-10-10 18:15:57 +00:00
Matthias Clasen
bde3a86333 Adapt tests to the previous commit
One of the transaction tests contains the situation
that was modified in the previous commit. Update it
to expect the new behavior. At the same time, add
some comments to the tests to guide the reader.
2018-10-10 19:26:58 +02:00
Matthias Clasen
00400803fa transaction: Error if asked to uninstall deps
If a transaction contains both an install for an app
and an uninstall for the runtime that it needs, error
out, since this is inconsistent.

Closes: #2196
2018-10-10 19:26:58 +02:00
Alexander Larsson
99fbbc25c6 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
2018-10-10 15:40:58 +00:00
Matthias Clasen
e5d74a7d74 docs: Fix alphabetic ordering of commands
The permissions were misplaced.

Closes: #2218
Approved by: alexlarsson
2018-10-10 15:26:23 +00:00
Alexander Larsson
0b6844f39e 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
2018-10-10 15:12:21 +00:00
Alexander Larsson
6dec266189 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
2018-10-10 15:12:21 +00:00
Matthias Clasen
24141bd093 Remove --show-columns leftovers
When I decided to add --columns without --show-columns,
I remove the option everywhere. Almost. These are the
leftovers I forgot.

Closes: #2227
Approved by: alexlarsson
2018-10-10 14:56:57 +00:00
Matthias Clasen
03f6b1fcd2 Some test setup fixes
Actually set XDG_RUNTIME_DIR. And assert that the
paths are as we want them to be, from glib's view.

Closes: #2235
Approved by: alexlarsson
2018-10-10 14:42:32 +00:00
Matthew Leeds
6b4402b60e 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
2018-10-10 13:54:23 +00:00
Alexander Larsson
41a8b94e9b coverage: Don't do parallell make check
This is running into some kind of timeout for me.

Closes: #2232
Approved by: alexlarsson
2018-10-10 10:42:45 +00:00
Matthias Clasen
e9ffa9dda6 remote-ls: Show runtimes
Add a runtime column that shows the runtime an application
is using, and add an --app-runtime option to allow filtering
by the used runtime.

Closes: #2224
Approved by: alexlarsson
2018-10-10 10:29:08 +00:00
Matthias Clasen
3a01ca36cf config: Parse languages better
Do some actual checking on the value to prevent nonsense
from getting into the config.
2018-10-10 12:21:33 +02:00
Matthias Clasen
0febda1e6f list: Spell out subpaths
This is useful information when debugging language-related
issues.
2018-10-10 12:21:33 +02:00
Matthias Clasen
10d6330eca tests: Check that updating subpaths works
This test updates an runtime to the same commit, just
changing the subpaths, and makes sure that works as
expected.
2018-10-10 12:21:15 +02:00
Matthias Clasen
ca4d4a9c3b Add a second language to the test app
This will let us test subpaths better.
2018-10-10 12:21:15 +02:00
Matthias Clasen
c8db26cc35 Make the test app not hang
We want an app that keeps running for some of the
library tests, but other tests expect it to return
right away. Make this opt-in.
2018-10-10 12:21:15 +02:00
Matthias Clasen
d4df921940 Modify the instance test
Avoid the initial sleep statement, and instead poll
for the child pid.

We also need the test app to stick around and not
exit right away, so change it to exec a shell.
2018-10-10 12:21:15 +02:00
Matthias Clasen
83bb5b9c52 instance: Be more defensive in get_child_pid
There is a race; flatpak_installation_launch may return
before bubblewrap has written the bwrapinfo.json file.
Make flatpak_instance_get_child_pid() deal with this and
document that the function may return 0 for a little
while.
2018-10-10 12:21:15 +02:00
Matthias Clasen
60948db6ac Add a test for FlatpakInstance
This shows some shortcomings of the current instance
life-cycle management, with sleeps being necessary
to work around races.
2018-10-10 12:21:15 +02:00
Matthias Clasen
ee9cfde582 fixup! Add a test for related refs
Configure the installation to install de, so we have
a known setup that we can test against.
2018-10-10 12:21:15 +02:00
Matthias Clasen
ccbd5b52e9 fixup! tests: Generate a .Locale extension 2018-10-10 12:21:15 +02:00
Matthias Clasen
91f7266f1a Add a test for related refs
Since we have a related ref now, might as well test it.
2018-10-10 12:21:15 +02:00
Matthias Clasen
c7090c5c0b tests: Generate a .Locale extension
Give the test app a Locale extension, so we can test
things around related refs and subpaths. Fix up the
library tests to work with a related ref in the repo.
2018-10-10 12:21:15 +02:00
Matthias Clasen
1709f3bc1b Add a test for --gl-drivers
It is something we can easily test, so why not.
2018-10-10 12:21:15 +02:00
Matthias Clasen
89545de1f5 Add more library tests
Various new tests, mainly about transaction and remote.
2018-10-10 12:21:15 +02:00
Matthias Clasen
1afa70e54d 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
2018-10-10 12:20:39 +02:00
Matthias Clasen
40f413836a Drop xdg-app migration support
It has been long enough. It is unlikely that we can still
find any xdg-app installations in the wild.
2018-10-10 12:20:27 +02:00
Matthias Clasen
c0708e7f0e Redo usage_error
Don't show full --help output, but just recommend
the right --help command to run.

Closes: #2209
Approved by: alexlarsson
2018-10-10 08:48:10 +00:00
Matthias Clasen
b9f6c9e78a Revamp command error handling
Don't show the full --help output immediately, instead
say 'see flatpak --help' and make a suggestion for a
misspelt command.

Closes: #2209
Approved by: alexlarsson
2018-10-10 08:48:10 +00:00
Matthias Clasen
eb2d9051b8 Add a Levenshtein distance implementation
No originality here, just a simple matrix-based implementation.

Closes: #2209
Approved by: alexlarsson
2018-10-10 08:48:10 +00:00
Matthias Clasen
22c5664f10 config: Improve error handling
Use usage_error for commandline-related errors,
as we do elsewhere. And be more specific in the
error messages.

Closes: #2203
Approved by: alexlarsson
2018-10-10 08:32:52 +00:00
Matthias Clasen
c269460ef9 config: Default to --list
When no option is specified, just do the reasonable thing.

Closes: #2203
Approved by: alexlarsson
2018-10-10 08:32:52 +00:00
Matthias Clasen
3a96ac4d71 transaction: Some more docs
Flesh out the long description some more.

Closes: #2202
Approved by: alexlarsson
2018-10-10 08:16:17 +00:00
Matthias Clasen
f79c9c7539 Document the SuggestRemoteName key
Found it missing from the docs while writing tests.

Closes: #2199
Approved by: alexlarsson
2018-10-10 08:03:35 +00:00
Matthias Clasen
36d5134e97 enter: Allow giving application ID
With the instance infrastructure, we can go from
the ID of a running application to its monitor PID,
so we can accept the application ID here. Whats more,
we can offer completion for it.

Note that completion only works if you use sudo -E,
since the flatpak used for complcations needs to see
the session environment to find running instances.

Closes: #2181
Approved by: alexlarsson
2018-10-10 06:28:28 +00:00
Matthias Clasen
9c84b88e46 Add a kill command
This sends SIGKILL to a running sandbox process.
The command has completion for running applications,
for both application IDs and instance IDs.

Closes: #2180

Closes: #2181
Approved by: alexlarsson
2018-10-10 06:28:28 +00:00
Matthias Clasen
02506d0eab transaction: Only allow to run once
Currently, the code will happily run an already-executed
transaction again, with dubious outcomes. Just prevent
this from happening.

Closes: #2195
Approved by: alexlarsson
2018-10-10 00:14:21 +00:00
Matthew Leeds
6cf12639f2 Merge pull request #2194 from matthiasclasen/master
Fix a typo
2018-10-09 17:14:18 -07:00
Matthew Leeds
7b6dc1ec8b Merge pull request #2213 from alexlarsson/master
Bump version to 1.1.0 on master
2018-10-09 17:13:46 -07:00
Matthew Leeds
36bce67618 Merge pull request #2204 from matthiasclasen/repair-docs
repair: Refer to ostree fsck
2018-10-09 17:13:18 -07:00
Matthias Clasen
a3bdc615f9 Merge pull request #2225 from mwleeds/fix-deploy-collection-typo
doc/build-update-repo: Fix a typo
2018-10-09 17:24:04 -04:00
Matthew Leeds
df19efe1b2 doc/build-update-repo: Fix a typo 2018-10-09 14:17:31 -07:00
Matthias Clasen
17aededa45 document-list: Add --columns option
Use the same pattern we use elsewhere, and allow
selecting columns to display. And add some more columns.

Closes: #2193
Approved by: alexlarsson
2018-10-08 09:16:09 +00:00
Matthias Clasen
41ff62072e document-list: Some restructuring
This is in preparation for using the table printer.

Closes: #2193
Approved by: alexlarsson
2018-10-08 09:16:09 +00:00
Matthias Clasen
189d22c0db repo: Avoid a compiler warning
Initialize mode_string. Its the right thing to do.

Closes: #2192
Approved by: alexlarsson
2018-10-08 09:01:21 +00:00
Matthias Clasen
dd546ad365 Make FlatpakInstance api public
This can be of use in frontends like GNOME Software.

Closes: #2201
Approved by: alexlarsson
2018-10-08 08:36:23 +00:00
Alexander Larsson
873c56d279 Bump version to 1.1.0 on master 2018-10-08 10:33:49 +02:00
Matthias Clasen
45302f90d5 installation: Remove unused functions
We don't have any properties; no need for set/get_property.

Closes: #2206
Approved by: alexlarsson
2018-10-08 08:25:10 +00:00