Skip to content

Extend advanced grammer to all keys of snapcraft #6064

@soumyaDghosh

Description

@soumyaDghosh

I believe the advanced grammar should be usable throughout the complete snapcraft.yaml. Projects targeting multiple architectures currently requires maintaining multiple manifests for multiple architectures. An example pain point is, consider, there are 3 services, only 1 needs to run in both amd64 and arm64, the other 2 are exclusive to only one architecture, how can one handle that?

  app1:
    command: app1
    daemon: simple
    restart-condition: always
    restart-delay: 5s

  app2:
    command: app2
    daemon: simple
    restart-condition: always
    restart-delay: 5s
    after:
      - on amd64:
        - app1

  app3:
    command: app3
    daemon: simple
    restart-condition: always
    restart-delay: 5s
    after:
      - on arm64:
        - app1

I believe this should be fairly simple. Also, another scenario, where I just don't want to build a particular part in one architecture, currently I'll have to do this

part:
  override-build: |
    if [ "${CRAFT_ARCH_BUILD_FOR}" == "arm64" ]; then
      echo "skipping..."
    else
      craftctl default
    fi

But I think this not really a very clean solution. Also, I believe using the advanced grammar on keys like cmake-parameters is also essential and is fairly simple. The current solution is very hacky

part:
  cmake-parameters:
    - -DPI=${PI}
    - -DX86=${X86}
  build-environment:
    - on arm64:
      - PI: "ON"
      - X86: "OFF"
    - on amd64:
      - X86: "ON"
      - PI_SNAP: "OFF"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions