RuntimeError: 'PARTS_CALL_FIFO' environment variable must be defined

Trying to compile glib schemas for gtk3 (last two lines):

  desktop-gtk3:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: gtk
    plugin: make
    make-parameters: ["FLAVOR=gtk3"]
    build-packages:
      - libgtk-3-dev
    stage-packages:
      - libxkbcommon0  # XKB_CONFIG_ROOT
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libgtk-3-0
      - libgdk-pixbuf2.0-0
      - libglib2.0-bin
      - libgtk-3-bin
      - unity-gtk3-module
      - libappindicator3-1
      - locales-all
      - xdg-user-dirs
      - ibus-gtk3
      - libibus-1.0-5
    override-prime: |
      craftctl default
      glib-compile-schemas ${CRAFT_PRIME}/usr/share/glib-2.0/schemas

Gives this error:

+ craftctl default
error: 
Traceback (most recent call last):
  File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 68, in _client
    call_fifo = os.environ["PARTS_CALL_FIFO"]
  File "/snap/snapcraft/current/bin/../usr/lib/python3.10/os.py", line 680, in __getitem__
    raise KeyError(key) from None
KeyError: 'PARTS_CALL_FIFO'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 111, in main
    ret = CraftCtl.run(cmd, args)
  File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 45, in run
    _client(cmd, args)
  File "/snap/snapcraft/current/lib/python3.10/site-packages/craft_parts/ctl.py", line 71, in _client
    raise RuntimeError(
RuntimeError: 'PARTS_CALL_FIFO' environment variable must be defined.
Note that this utility is designed for use only in part scriptlets.
Failed to run 'override-prime': Exit code was 1.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.

Any ideas on how to proceed?

snapcraft 8.3.1, snap targeting core20

Solved with this piece of code:

    override-prime: |
      snapcraftctl prime
      glib-compile-schemas usr/share/glib-2.0/schemas
1 Like