1 | # Common functions for soil/
|
2 |
|
3 | # Include guard.
|
4 | test -n "${__SOIL_COMMON_SH:-}" && return
|
5 | readonly __SOIL_COMMON_SH=1
|
6 |
|
7 | log() {
|
8 | echo "$@" 1>&2
|
9 | }
|
10 |
|
11 | log-context() {
|
12 | local label=$1
|
13 |
|
14 | log ''
|
15 | log "$label: running as user '$(whoami)' on host '$(hostname)' in dir $PWD"
|
16 | log ''
|
17 | }
|
18 |
|
19 | dump-env() {
|
20 | env | grep -v '^encrypted_' | sort
|
21 | }
|
22 |
|
23 | readonly SOIL_USER='travis_admin'
|
24 | readonly SOIL_HOST='travis-ci.oilshell.org'
|
25 | readonly SOIL_USER_HOST="$SOIL_USER@$SOIL_HOST"
|
26 |
|
27 | html-head() {
|
28 | # TODO: Shebang line should chang ecahnge to
|
29 | PYTHONPATH=. python3 doctools/html_head.py "$@"
|
30 | }
|
31 |
|
32 | # NOTE: soil-html-head and table-sort-html-head are distinct, because they
|
33 | # collide with <td> styling and so forth
|
34 |
|
35 | soil-html-head() {
|
36 | local title="$1"
|
37 | local web_base_url=${2:-'/web'}
|
38 |
|
39 | html-head --title "$title" \
|
40 | "$web_base_url/base.css?cache=0" "$web_base_url/soil.css?cache=0"
|
41 | }
|
42 |
|
43 | table-sort-html-head() {
|
44 | local title="$1"
|
45 | local web_base_url=${2:-'/web'}
|
46 |
|
47 | html-head --title "$title" \
|
48 | "$web_base_url/base.css?cache=0" \
|
49 | "$web_base_url/ajax.js?cache=0" \
|
50 | "$web_base_url/table/table-sort.css?cache=0" "$web_base_url/table/table-sort.js?cache=0"
|
51 | }
|
52 |
|
53 | git-commit-dir() {
|
54 | local prefix=$1
|
55 |
|
56 | local commit_hash
|
57 | # written by save-metadata in soil/worker.sh
|
58 | commit_hash=$(cat _tmp/soil/commit-hash.txt)
|
59 |
|
60 | local git_commit_dir="travis-ci.oilshell.org/${prefix}jobs/git-$commit_hash"
|
61 |
|
62 | echo $git_commit_dir
|
63 | }
|