Strange syntax in libreoffice snap


#1

I’m examining the snapcraft recipe of the libreoffice snap and found the weird syntax in the apps.app_name.plugs and apps.app_name.environment keys:

apps:
    libreoffice:
        command: libreoffice.wrapper
        desktop: lib/libreoffice/share/xdg/startcenter.desktop
        environment: &environment
            TMPDIR: $XDG_RUNTIME_DIR
        plugs: &plugs
            - bluez
            - cups-control
            - desktop
            - gsettings
            - home
            - network
            - network-bind
            - opengl
            - pulseaudio
            - removable-media
            - screen-inhibit-control
            - unity7
            - wayland
    base:
        command: libreoffice.wrapper --base
        desktop: lib/libreoffice/share/xdg/base.desktop
        environment: *environment
        plugs: *plugs
    calc:
        command: libreoffice.wrapper --calc
        desktop: lib/libreoffice/share/xdg/calc.desktop
        environment: *environment
        plugs: *plugs
    draw:
        command: libreoffice.wrapper --draw
        desktop: lib/libreoffice/share/xdg/draw.desktop
        environment: *environment
        plugs: *plugs
    impress:
        command: libreoffice.wrapper --impress
        desktop: lib/libreoffice/share/xdg/impress.desktop
        environment: *environment
        plugs: *plugs
    math:
        command: libreoffice.wrapper --math
        desktop: lib/libreoffice/share/xdg/math.desktop
        environment: *environment
        plugs: *plugs
    writer:
        command: libreoffice.wrapper --writer
        desktop: lib/libreoffice/share/xdg/writer.desktop
        environment: *environment
        plugs: *plugs
    filebug:
        command: filebug.py
        environment: *environment
        plugs:
            - desktop
            - network

The following apps seems to be reusing the value of the first app, is this syntax documented anywhere?


#2

These are features of YAML named ‘Anchors’ (with &) and ‘Aliases’ (with *) it’s a way of defining a block once and reusing it.

https://yaml.org/spec/1.2/spec.html#id2765878