The architectures
field in snapcraft.yaml
behaves the same way it did in snap.yaml
and it basically hints the store into on what architectures to offer this snap.
The original introduction of this was fat packages. We can change the semantics, but this is how architectures
works today:
name: my-package
architectures: [amd64]
...
parts:
source: .
plugin: dump
Regardless of the architecture (armhf, amd64, i386) this is ran on this will happen
$ snapcraft
Snapped my-package_1.0_amd64.snap
With snap.yaml
containing a architectures: [amd64]
entry.
And for
name: my-package
architectures: [amd64, armhf]
...
parts:
source: .
plugin: dump
Will result in
$ snapcraft
Snapped my-package_1.0_multi.snap
With snap.yaml
containing a architectures: [amd64, armhf]
entry.
If left out, snapcraft
will set it to the architecture of the build host.
So in essence it is the architectures to say it will work on at runtime but not where this build should be triggered on.
We don’t do breaking changes in the format, but the use case of this is so confusing that we have not promoted it but I don’t mind breaking the semantic meaning of this in snapcraft
and tell people that want to dump a python file and create a snap on amd64
to push it to pi
to just use --target-arch
(for the few not knowing about this already).
This feature is really old as well, I wasn’t in the snapcraft conversations at that time:
commit a86d80aa22f8b728ec116ad87a652f34d1571992
Author: <redacted>
Date: Tue Jul 28 16:00:10 2015 -0400
Look in library-triplet locations and set architectures in package.yaml
So that is the explanation of why it is not enough, but it is so backwards that if there is consensus I don’t mind changing this behavior with the caveat of knowing this might break some existing builds.