Gilles Peskine | 0f4df8f | 2021-01-18 20:31:07 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | |
| 5 | usage () { |
| 6 | cat <<EOF |
| 7 | Usage: $0 PATH_TO_PSA_CRYPTO_API_TREE |
| 8 | Update the rendered copy of the PSA Cryptography API specification. |
| 9 | |
| 10 | 1. Check out the desired version of the PSA Crypto API specification. |
| 11 | git clone https://github.com/ARMmbed/psa-crypto-api |
| 12 | git checkout <TAG> |
| 13 | 2. Build the specification. |
| 14 | cd psa-crypto-api |
| 15 | sudo docker build -t psa_api - <psa-crypto-api/scripts/Dockerfile |
| 16 | sudo docker run -i -t -u \$(id -u):\$(id -g) -v \$PWD:/var/lib/builds psa_api make |
| 17 | cd .. |
| 18 | 3. Copy the rendered files. |
| 19 | $0 psa-crypto-api |
| 20 | 4. Commit the changes. |
Gilles Peskine | c2db5f0 | 2021-01-18 20:36:53 +0100 | [diff] [blame] | 21 | git add docs/html docs/PSA_Cryptography_API_Specification.pdf |
| 22 | git commit |
Gilles Peskine | 0f4df8f | 2021-01-18 20:31:07 +0100 | [diff] [blame] | 23 | EOF |
| 24 | } |
| 25 | |
| 26 | if [ $# -ne 1 ] || [ "$1" = "--help" ]; then |
| 27 | usage |
| 28 | exit $(($# != 1)) |
| 29 | fi |
| 30 | |
Gilles Peskine | 4519de7 | 2022-04-07 13:44:25 +0200 | [diff] [blame^] | 31 | version=$(sed -n 's/^\(Version[^0-9A-Za-z][^0-9A-Za-z]*\)//p; T; q' "$1/sphinx-build/html/index.html") |
| 32 | if [ -z "$version" ]; then |
| 33 | echo >&2 "Fatal error: unable to determine the version." |
| 34 | exit 1 |
| 35 | fi |
| 36 | if [ ! -d "docs/$version" ]; then |
| 37 | mkdir "docs/$version" |
| 38 | cat <<EOF |
| 39 | NOTE: Please update "Past versions" in docs/psa/index.md to add $version |
| 40 | then run make. |
| 41 | |
| 42 | NOTE: You may need to update the "latest" symbolic link. |
| 43 | ln -snf "$version" docs/latest |
| 44 | EOF |
| 45 | fi |
| 46 | |
| 47 | rsync -a --delete "$1/sphinx-build/html" "docs/$version/" |
| 48 | rsync -a "$1/sphinx-build/latex/psa_crypto_api.pdf" "docs/$version/PSA_Cryptography_API_Specification.pdf" |