So far so good. But now I’m hitting a wall when I try to set 2 different debs as sources
parts:
my-app:
source:
- on amd64: http://redacted/x86.deb
- on arm64: http://redacted/arm64.deb
source-type: deb
plugin: dump
I thought that was what I needed, but my arm64 snap contains the x86 files. So I think my yaml selecting the source deb based on the host arch, i.e. it will use the arm64 deb if I build the snap on an arm64 system.
How can I select different sources for different target platforms?
That produces the same behavior. Since I’m building the snaps on x86, snapcraft is just repackaging x86.deb.
I think your suggestion produces a my-app-1 with x86.deb and my-app-2 has no sources at all. Which is the same problem I have on my approach.
I think I would need to be able to set for <arch> instead of on arch on the sources, which would be in line with the build-on / build-for keywords.
E.g.
parts:
my-app:
source:
- for amd64: http://redacted/x86.deb
- for arm64: http://redacted/arm64.deb
source-type: deb
plugin: dump
No, I don’t. And I don’t think I need it? I’m not building anything, just repackaging pre built artifacts.
Anyways, I happened to find another similar thread Specialize parts based on architecture , and there I got a hint about Advanced Grammar. Turns out what I needed was the to keyword. Now I have this, which works as expected:
parts:
my-app:
source:
- on amd64 to amd64: http://redacted/x86.deb
- on amd64 to arm64: http://redacted/arm64.deb
source-type: deb
plugin: dump
I’d do something like this and manually unpack based on detection of arch at build time. Not tested, just to give you an idea, but we have done this in the past. It’s a bit manky but works.