snapcrafters / sommelier-core

Package a Windows application for Linux using a Snap with Wine.
MIT License
30 stars 10 forks source link

Support winetricks commands with spaces/multiple args #27

Closed n8marti closed 2 years ago

n8marti commented 2 years ago

I've contributed to a DEB package that sets up a Windows app via wine. The setup script runs a few winetricks commands, one of which is a single command with two arguments: winetricks settings fontsmooth=rgb

installs=( \
    "corefonts" \
    "ddr=gdi" \
    "settings fontsmooth=rgb" \
    "dotnet48" \
)
for i in "${installs[@]}"; do
    winetricks_install $i
done

I would like to be able to use this same command winetricks settings fontsmooth=rgb in an app installed with sommelier, but it would need to be somehow reworked, because it currently assumes that each space-separated term passed to TRICKS is a separate winetricks command. Consider this a request for an enhancement, or maybe a request for ideas on a workaround?

merlijn-sebrechts commented 2 years ago

Oof, that's a big oversight from our part!

As a workaround, you can use the pre-install hook. Take a look at this part of sommelier-core.

https://github.com/snapcrafters/sommelier-core/blob/bac81b4a3907e3f661feaf76b8eedf4061d370e4/scripts/sommelier#L124-L128

This feature isn't documented yet as its main use is to workaround bugs in sommelier-core and we want people to report and fix the bugs instead of working around them ;)

merlijn-sebrechts commented 2 years ago

I don't see how we can fix the TRICKS environment variable in a backwards-compatible way. I think we will need to create a new environment variable which uses ; as separator instead of spaces. Maybe we can just call it SOMMELIER_TRICKS, since all new environment variables of sommelier-core are prefixed with SOMMELIER_.

n8marti commented 2 years ago

Well, this may still be a necessary improvement in general, but I just discovered that running winetricks fontsmooth=rgb works just the same as ```winetricks settings fontsmooth=rgb". So in my case I can just simplify my TRICKS list by omitting "settings" from it. This appears to be what I've done with ddr=gdi already.

merlijn-sebrechts commented 2 years ago

I will close this issue for the moment. Please re-open it if you find a trick that still requires spaces and the workaround above doesn't work.