More advanced grammar support

Advanced grammar is great to help with ensuring that things are declarative instead of imperative, but a key missing support is on the plugin-provided keys, like cmake-parameters, autotools-configure-parameters, meson-parameters, etc. This post is a request for snapcraft plugins to grow support for advanced grammar on keys they add to the snapcraft.yaml schema. Specifically I want to be able to do something like this:

    after: [gegl]
    source-type: git
    plugin: cmake
    build-snaps: [cmake]
      - CFLAGS: -Ofast -g -pipe -flto
      - CXXFLAGS: -Ofast -g -pipe -flto
      - LDFLAGS: -flto
    - -DCMAKE_BUILD_TYPE=Release
    - -DCONFIG_PIC=1

    # Needs advanced grammar support from Snapcraft that isn't available here
    - to armhf:
      - -DAOM_NEON_INTRIN_FLAG=-mfpu=neon

Because this isn’t available I have to do everything the plugin would do for me in an override-build block, which is prone to error in implementation, and is duplicating work that has already been done in Snapcraft upstream.


This should be possible to do in Snapcraft 7.x for core22, while we did not hook it all up, the logic is now detanlged from how parts and plugins work (possible as we removed support for try).

So while not there today, this is now within reach.


In case anyone fancies contributing is where this lives and you can probably see that adding here is simple, validation would also need touching; the hardest part would be the tests

1 Like