blob: 38008f3e3b0a4c0337186b7b89e3b1870d52a72d [file] [log] [blame]
Gilles Peskine0f4df8f2021-01-18 20:31:07 +01001#!/bin/sh
2
3set -eu
4
5usage () {
6 cat <<EOF
7Usage: $0 PATH_TO_PSA_CRYPTO_API_TREE
8Update the rendered copy of the PSA Cryptography API specification.
9
101. 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>
132. 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 ..
183. Copy the rendered files.
19 $0 psa-crypto-api
204. Commit the changes.
Gilles Peskinec2db5f02021-01-18 20:36:53 +010021 git add docs/html docs/PSA_Cryptography_API_Specification.pdf
22 git commit
Gilles Peskine0f4df8f2021-01-18 20:31:07 +010023EOF
24}
25
26if [ $# -ne 1 ] || [ "$1" = "--help" ]; then
27 usage
28 exit $(($# != 1))
29fi
30
Gilles Peskine4519de72022-04-07 13:44:25 +020031version=$(sed -n 's/^\(Version[^0-9A-Za-z][^0-9A-Za-z]*\)//p; T; q' "$1/sphinx-build/html/index.html")
32if [ -z "$version" ]; then
33 echo >&2 "Fatal error: unable to determine the version."
34 exit 1
35fi
36if [ ! -d "docs/$version" ]; then
37 mkdir "docs/$version"
38 cat <<EOF
39NOTE: Please update "Past versions" in docs/psa/index.md to add $version
40 then run make.
41
42NOTE: You may need to update the "latest" symbolic link.
43 ln -snf "$version" docs/latest
44EOF
45fi
46
47rsync -a --delete "$1/sphinx-build/html" "docs/$version/"
48rsync -a "$1/sphinx-build/latex/psa_crypto_api.pdf" "docs/$version/PSA_Cryptography_API_Specification.pdf"