Trying to package angband as snap
Didier Roche
didrocks at ubuntu.com
Wed Jul 27 07:02:13 UTC 2016
Le 20/07/2016 à 22:51, Radek Sprta a écrit :
> Hey,
>
> I tried packaging Angband as as snap. This is what I have as
> snapcraft.yaml:
>
> name: angband
> version: "4.0.5"
> summary: Single-player, text-based, dungeon simulation game
> confinement: devmode
>
> apps:
> angband:
> command: games/angband
> plug: [x11, unity7, home, pulseaudio]
>
> parts:
> angband:
> plugin: autotools
> configflags: ["--enable-sdl"]
> source: http://rephial.org/downloads/4.0/angband-4.0.5.tar.gz
> build-packages:
> - libsdl1.2-dev
> - libsdl-ttf2.0-dev
> - libsdl-mixer1.2-dev
> - libsdl-image1.2-dev
>
> The game gets packaged, but fails to run, because it looks for the
> files in /share/games/angband instead of $SNAP/share/games/angband
>
> I tried packaging it with '--no-install' and 'prefix=$SNAP' options
> (changing command to angband), but both result in:
> /snap/angband/100001/command-angband.wrapper: 5: exec: angband:
> Permission denied
>
> The snappy-debug gives suggestions such as:
> * adjust program to read necessary files from $SNAP, $SNAP_DATA or
> $SNAP_USER_DATA
> and
> * adjust program to execute binaries directly from $SNAP instead of
> /snap/bin
>
> Do I just fail at snapcraft or does the game really need to be patched?
Hey Radek,
The good news is that you are not alone! It's something we encountered
in quite some project (having data dir hardcoded at build time based on
prefix) without any relocatable path for it. I did file
https://bugs.launchpad.net/ubuntu/+source/snapcraft/+bug/1583250/ at the
time (and just added snappy upstream bug to it).
Gustavo, do you think we can have some actionable actions on this and
some ideas of when a proper solution would be provided? I know we talked
to have a syscalls redirect LD_PRELOAD lib. For context, we are seeing
quite some people having similar issues with desktop apps on the playpen
and not pursuing their snap journey due to this.
Meanwhile, something that worked for some projects is to "install-via:
prefix" like we did for galculator:
https://github.com/ubuntu/snappy-playpen/blob/master/galculator/snapcraft.yaml#L22.
Another solution, that you mentioned is to hardcode
"--prefix=/snap/<snap_name>/current" is an immediate fix, but it means:
* the snap depends on being installed at that location, which isn't
ensured in the future.
* then, you end up mostly with you binaries in
/snap/<snap_name>/current/snap/<snap_name>/current/bin (notice the
repetition), which is way you have the exec issue and need to move the
content post-build to the correct location via a custom plugin or the
"organize" keyword.
Cheers,
Didier
More information about the Snapcraft
mailing list