Skip to content

flatpak-spawn: Add the ability to set a custom path for /app or /usr - #39

Merged
alexlarsson merged 6 commits into
flatpak:masterfrom
smcv:replace-usr
Aug 2, 2021
Merged

alexlarsson merged 6 commits into
flatpak:masterfrom
smcv:replace-usr

Conversation

@smcv

@smcv smcv commented Dec 8, 2020 •

Copy link
Copy Markdown
Contributor

Based on the refactoring from #38.


  • Factor out and improve path_to_handle() #38

  • flatpak-spawn: Add the ability to set a custom path for /app or /usr

    This is a client-side for
    Allow caller to supply a /usr to use instead of the runtime flatpak#4018.

    Steam's pressure-vessel tool does the equivalent of this to launch
    a parallel container with /usr supplied by the Steam Runtime, and an
    empty /app, although currently it has to use code derived from
    flatpak-spawn rather than using the runtime's copy of flatpak-spawn.

  • test-spawn: Check contents of options dict more extensibly

    Instead of asserting that there is a hard-coded number of items in the
    dict, count how many items we have checked and then assert that there
    are no extra items left over at the end. This will make it easier to
    test more options that add more items.

  • tests: Exercise flatpak-spawn --app-path and --usr-path

Comment thread src/flatpak-spawn.c Resolved
@smcv
smcv force-pushed the replace-usr branch 2 times, most recently from 8f6cee8 to fc92208 Compare December 10, 2020 13:16
@smcv smcv changed the title Draft: flatpak-spawn: Add the ability to set a custom path for /usr flatpak-spawn: Add the ability to set a custom path for /app or /usr Jan 19, 2021
@smcv
smcv force-pushed the replace-usr branch 2 times, most recently from cf302c4 to 9494a47 Compare June 11, 2021 12:12
@smcv
smcv marked this pull request as ready for review June 11, 2021 12:14
@smcv

smcv commented Jun 11, 2021

Copy link
Copy Markdown
Contributor Author

@gasinvein reminded me that this was still marked as a draft. The Flatpak feature was finalized and merged, so this is now ready (other than needing #38 reviewed first).

I've also added a unit test, now that #47 has provided a framework for testing it. No changes in the actual implementation.

@smcv
smcv requested review from TingPing and alexlarsson June 11, 2021 12:15
smcv added 6 commits July 23, 2021 22:02
This will let us deal with arguments that are a single path, instead
of a GStrv of paths.

Signed-off-by: Simon McVittie <[email protected]>
The Flatpak portal will reject paths that do not resolve to the same
thing in the container and on the host system. For example,

    --sandbox-expose-path="$HOME/.config/my/file"

will not work, even if

    --sandbox-expose-path="$HOME/.var/app/com.example.App/config/my/file"

would.

Existing apps like GNOME Web (Epiphany) get away with this because the
files they are exposing are below $XDG_CONFIG_HOME, $XDG_DATA_HOME or
$XDG_CACHE_HOME, which take values below ~/.var/app, but the same is
not necessarily going to be true for apps like Steam that use --persist.

Signed-off-by: Simon McVittie <[email protected]>
This is a client-side for
<flatpak/flatpak#4018>.

Steam's pressure-vessel tool does the equivalent of this to launch
a parallel container with /usr supplied by the Steam Runtime, and an
empty /app, although currently it has to use code derived from
flatpak-spawn rather than using the runtime's copy of flatpak-spawn.

Signed-off-by: Simon McVittie <[email protected]>
Instead of asserting that there is a hard-coded number of items in the
dict, count how many items we have checked and then assert that there
are no extra items left over at the end. This will make it easier to
test more options that add more items.

Signed-off-by: Simon McVittie <[email protected]>
@alexlarsson
alexlarsson merged commit 81119c4 into flatpak:master Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants