Skip to content

Python guest Justfile: validate checksums for already-present case #84

@crepererum

Description

@crepererum

What

The Python guest Justfile has an optimization that avoids downloading the CPython WASM build and the WASI SDK again if they are already downloaded:

# skip if already downloaded
if [ -d python-sdk ]; then
echo "python sdk already present"
exit 0
fi

# skip if already downloaded
if [ -d wasi-sysroot ]; then
echo "wasi sdk already present"
exit 0
fi

That should not only check presence but also the checksum of the already-downloaded files and should re-download if the checksums mismatch.

Why

Whenever we upgrade the CPython version or the WASI SDK, developers will locally still have an outdated copy and without just clean they will not use the new versions. This isn't an issue for our CI though.

Note that this is NOT a security issue since the checksum was validated when the data was originally downloaded, it's just that it doesn't automatically upgrade the version of a local development setup.

How

In the if-branch, do something similar to these checks

echo "{{SHA256_PYTHON_SDK}} python-sdk.zip" | sha256sum -c
echo "{{SHA256_PYTHON_SDK_BUILD}} build-python-sdk.zip" | sha256sum -c

echo "{{SHA256_WASI_SDK_SYSROOT}} wasi-sysroot.tar.gz" | sha256sum -c

and if they fail, wipe the downloaded data and re-download.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions