diff --git a/snapcraft/parts/plugins/matter_sdk_plugin.py b/snapcraft/parts/plugins/matter_sdk_plugin.py index e37c04dfa40..0f2813db0f5 100644 --- a/snapcraft/parts/plugins/matter_sdk_plugin.py +++ b/snapcraft/parts/plugins/matter_sdk_plugin.py @@ -167,11 +167,12 @@ def get_build_commands(self) -> List[str]: ] ) - # Prepend the Matter SDK related PATH to the beginning of the PATH environment variable - # and save it to the matter-sdk-env.sh file + # Prepend the Matter SDK related PATH to the beginning of the PATH environment variable, + # save it to the matter-sdk-env.sh file, + # and copy the file into the staging area. commands.extend( [ - 'echo "export PATH=$MATTER_SDK_PATHS\\$PATH" >> matter-sdk-env.sh', + 'echo "export PATH=$MATTER_SDK_PATHS\\$PATH" >> $CRAFT_STAGE/matter-sdk-env.sh', ] ) diff --git a/tests/spread/plugins/craft-parts/matter-sdk/snapcraft.yaml b/tests/spread/plugins/craft-parts/matter-sdk/snapcraft.yaml index 2a38b859a39..73766084c81 100644 --- a/tests/spread/plugins/craft-parts/matter-sdk/snapcraft.yaml +++ b/tests/spread/plugins/craft-parts/matter-sdk/snapcraft.yaml @@ -34,7 +34,7 @@ parts: after: [matter-sdk] override-build: | # Source the Matter SDK environment variables - source ../../matter-sdk/build/matter-sdk-env.sh + source $CRAFT_STAGE/matter-sdk-env.sh # Build the lighting app for snapcraft spread testing purposes cd ../../matter-sdk/build/examples/lighting-app/linux diff --git a/tests/unit/parts/plugins/test_matter_sdk_plugin.py b/tests/unit/parts/plugins/test_matter_sdk_plugin.py index 1d83781173d..0431fa1fd00 100644 --- a/tests/unit/parts/plugins/test_matter_sdk_plugin.py +++ b/tests/unit/parts/plugins/test_matter_sdk_plugin.py @@ -110,7 +110,7 @@ def test_get_build_commands(part_info): "set +u && source scripts/setup/bootstrap.sh --platform build && set -u", "echo 'Built Matter SDK'", 'MATTER_SDK_PATHS="${PATH%$OLD_PATH}"', - 'echo "export PATH=$MATTER_SDK_PATHS\\$PATH" >> matter-sdk-env.sh', + 'echo "export PATH=$MATTER_SDK_PATHS\\$PATH" >> $CRAFT_STAGE/matter-sdk-env.sh', ] assert plugin.get_build_commands() == expected_commands