Does setting environment variables work with override-build?

@Lin-Buo-Ren that’s quite a ways beyond the intended purpose of scriptlets. If you want to enable ccache on your host, go for it, snapcraft will use it. If you want to enable it in CI, go for it. What you’re doing here is not really supported. However, I will point out that you get get bin in the staging area in the PATH another way: make sure parts that need it have after: [ccache] specified. For example, run snapcraft pull with your parts like this:

# ...

parts:
  part1:
    plugin: nil
    override-build: |
      install -d $SNAPCRAFT_PART_INSTALL/bin
      echo "#!/bin/sh\necho 'hello there'" > $SNAPCRAFT_PART_INSTALL/bin/this-is-a-test
      chmod a+x $SNAPCRAFT_PART_INSTALL/bin/this-is-a-test

  part2:
    plugin: nil
    override-pull: this-is-a-test
    after: [part1]

You’ll see that part2 can use the executable placed by part1:

$ snapcraft pull
Preparing to pull part1 
Pulling part1 
'part2' has prerequisites that need to be staged: part1
Preparing to build part1 
Building part1 
Staging part1 
Preparing to pull part2 
Pulling part2 
hello there
1 Like