SNAPCRAFT_PART_INSTALL with base:core20?

I’m migrating a snap to base: core20 that uses override-stage like this:

    override-stage: |
      if [ -e "$SNAPCRAFT_PART_INSTALL/usr/bin/kodi" ]; then
        sed --in-place s'!/usr!${SNAP}/usr!' $SNAPCRAFT_PART_INSTALL/usr/bin/kodi
      fi
      rm -f $SNAPCRAFT_PART_INSTALL/usr/share/applications/python2.7.desktop
      snapcraftctl stage

This worked fine with base:core18, but fails with base:core20 as SNAPCRAFT_PART_INSTALL is unset:

export | grep SNAPCRAFT
export SNAPCRAFTCTL_CALL_FIFO='/root/parts/tmpp4ef9e3c/function_call'
export SNAPCRAFTCTL_FEEDBACK_FIFO='/root/parts/tmpp4ef9e3c/call_feedback'
export SNAPCRAFT_ARCH_TRIPLET='x86_64-linux-gnu'
export SNAPCRAFT_BUILD_ENVIRONMENT='managed-host'
export SNAPCRAFT_EXTENSIONS_DIR='/snap/snapcraft/5472/share/snapcraft/extensions'
export SNAPCRAFT_HAS_TTY='True'
export SNAPCRAFT_INTERPRETER='/snap/snapcraft/5472/usr/bin/python3'
export SNAPCRAFT_PARALLEL_BUILD_COUNT='2'
export SNAPCRAFT_PART_SRC='/root/parts/kodi/src'
export SNAPCRAFT_PART_SRC_WORK='/root/parts/kodi/src/'
export SNAPCRAFT_PRIME='/root/prime'
export SNAPCRAFT_PROJECT_DIR='/root/project'
export SNAPCRAFT_PROJECT_GRADE='devel'
export SNAPCRAFT_PROJECT_NAME='egmde-confined-desktop'
export SNAPCRAFT_PROJECT_VERSION=''
export SNAPCRAFT_STAGE='/root/stage'
export SUDO_COMMAND='/bin/bash -c env SNAPCRAFT_BUILD_ENVIRONMENT=managed-host HOME=/root SNAPCRAFT_HAS_TTY=True snapcraft stage'

Is there a new way to identify the install directory?

$SNAPCRAFT_PART_INSTALL should be used during the build step

$SNAPCRAFT_STAGE should be used during the stage step

Prior to the stage step, (selected) items are copied to $SNAPCRAFT_PART_INSTALL to $SNAPCRAFT_STAGE. If it worked prior, it’s because Snapcraft will typically hard link instead of copy, when possible.

1 Like