Advanced Grammar else clause

Hi,

I would like to have multiple conditions for a part’s source in snapcraft.yaml, and fail if none of the conditions match. I would like something like this to work:

    source: 
      - on amd64:   amd64-specific
      - on i386:    i386-specific
      - on arm64:   arm64-specific
      - else fail

Where if the snap is being built on amd64, i386, or arm64, then those options are used and the build continues, but if anything else (say armhf or s390x, etc.) is used then the snap immediately fails.

However the current result is that it always fails if it’s not run on arm64 (or just whatever one happens to be on the last in the list is what it seems to be). To currently accomplish what I want I have to nest all the expressions like so (but note the else fail is still at the root):

    source: 
      - on amd64:   amd64-specific
      - else:
        - on i386:    i386-specific
        - else:
           - on arm64:   arm64-specific
      - else fail

Is this intended behavior?

Sorry for necrothread, but did you discover the best way for doing this?

I did not, perhaps @cjp256 could comment on this nowadays?