From 4fb0c6eacbfcee14b36d09d3f89f665bd2c70f36 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 6 Apr 2017 09:52:49 +0200 Subject: Cosmetic changes --- buildos | 66 ++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'buildos') diff --git a/buildos b/buildos index 0547c97..893ccc6 100755 --- a/buildos +++ b/buildos @@ -100,7 +100,7 @@ function restart () # Return the value of one of the toolchain_* variables for this toolchain. # -function tc_value () # +function toolchain_value () # { local n="${1}${2}" echo "${!n}" @@ -109,7 +109,7 @@ function tc_value () # toolchain_names=() for tn in "${!toolchains[@]}"; do tp="${toolchains["$tn"]}" - tu="$(tc_value "$tp" toolchain_url)" + tu="$(toolchain_value "$tp" toolchain_url)" if [ -z "$tu" ]; then continue @@ -132,7 +132,7 @@ for tn in "${!toolchains[@]}"; do # If buildos.toolchain_trust was not specified, set it to "no" so that # we don't prompt if the repository happens to be signed. # - if [ -z "$(tc_value "$tp" toolchain_trust)" ]; then + if [ -z "$(toolchain_value "$tp" toolchain_trust)" ]; then declare "${tp}toolchain_trust=no" fi done @@ -173,8 +173,8 @@ function print () for tn in "${toolchain_names[@]}"; do tp="${toolchains["$tn"]}" - tu="$(tc_value "$tp" toolchain_url)" - tt="$(tc_value "$tp" toolchain_trust)" + tu="$(toolchain_value "$tp" toolchain_url)" + tt="$(toolchain_value "$tp" toolchain_trust)" echo "$tn.toolchain_url: $tu" echo "$tn.toolchain_trust: $tt" @@ -410,22 +410,22 @@ fi # Calculate the file checksum using the shaNNNsum utility. # -function tc_checksum () # +function toolchain_checksum () # { - "$(tc_value "$1" toolchain_csum)sum" -b "$2" | \ + "$(toolchain_value "$1" toolchain_csum)sum" -b "$2" | \ sed -n -re 's/^([^ ]+) .+$/\1/p' } # Fetch a file from the sums file into $toolchain_root, verify its checksum, # and make a predictable name (without version) symlink. # -function tc_fetch () # +function toolchain_fetch () # { local s p f u l tp tu tr tv tp="$1" - tu="$(tc_value "$tp" toolchain_url)" - tr="$(tc_value "$tp" toolchain_root)" + tu="$(toolchain_value "$tp" toolchain_url)" + tr="$(toolchain_value "$tp" toolchain_root)" s="$(sed -n -re 's/^([^ ]+) .+$/\1/p' <<<"$2")" # Checksum. p="$(sed -n -re 's/^[^ ]+ \*([^ ]+)$/\1/p' <<<"$2")" # File path (relative). @@ -439,7 +439,7 @@ function tc_fetch () # # Extract the version. # - tv="$(tc_value "$tp" toolchain_ver)" + tv="$(toolchain_value "$tp" toolchain_ver)" if [ -z "$tv" ]; then tv="$(sed -n -re 's/build2-toolchain-(.+)\.tar.*/\1/p' <<<"$f")" @@ -478,7 +478,7 @@ function tc_fetch () # info "verifying checksum for $f" local cs - cs="$(tc_checksum "$tp" "$tr/$f")" + cs="$(toolchain_checksum "$tp" "$tr/$f")" if [ "$cs" != "$s" ]; then info "checksum mismatch for $u" @@ -494,12 +494,12 @@ function tc_fetch () # # Bootstrap the toolchain. # -function tc_bootstrap () # +function toolchain_bootstrap () # { local tn="$1" local tp="${toolchains["$tn"]}" - local tr="$(tc_value "$tp" toolchain_root)" - local tf="$(tc_value "$tp" toolchain_file)" + local tr="$(toolchain_value "$tp" toolchain_root)" + local tf="$(toolchain_value "$tp" toolchain_file)" # Fetch files according to the sums file. Skip empty lines and those that # start with '#'. @@ -509,13 +509,13 @@ function tc_bootstrap () # readarray -t ls < <(sed -e '/^\s*#/d;/^\s*$/d' "$tr/$tf") for l in "${ls[@]}"; do - if ! tc_fetch "$tp" "$l"; then + if ! toolchain_fetch "$tp" "$l"; then return 1 # Diagnostics has already been issued. fi done - local tv="$(tc_value "$tp" toolchain_ver)" # Should be set by tc_fetch(). - local tt="$(tc_value "$tp" toolchain_trust)" + local tv="$(toolchain_value "$tp" toolchain_ver)" # Should be set by fetch(). + local tt="$(toolchain_value "$tp" toolchain_trust)" # Bootstrap in /tmp/toolchain/$tn/, install to /build/toolchain/$tn/. # @@ -561,7 +561,7 @@ function tc_bootstrap () # # Check if we need to build/start or rebuild/restart the bbot agent. Return # 0 if nothing to do, 1 for upgrades, 2 for first build, and 3 for failure. # -function bb_check () # +function bbot_check () # { local tn="$1" @@ -608,9 +608,9 @@ function bb_check () # } # Build and start bbot agent using the bpkg configuration created by -# tc_bootstrap(). +# toolchain_bootstrap(). # -function bb_start () # +function bbot_start () # { local tn="$1" @@ -731,10 +731,10 @@ while true; do # for tn in "${toolchain_names[@]}"; do tp="${toolchains["$tn"]}" - tu="$(tc_value "$tp" toolchain_url)" + tu="$(toolchain_value "$tp" toolchain_url)" - tr="$(tc_value "$tp" toolchain_root)" - tf="$(tc_value "$tp" toolchain_file)" + tr="$(toolchain_value "$tp" toolchain_root)" + tf="$(toolchain_value "$tp" toolchain_file)" p="$tr/$tf" mkdir -p "$tr" @@ -754,8 +754,8 @@ while true; do # if [ "$f" != "$p" ]; then - ts="$(tc_value "$tp" toolchain_file_csum)" - cs="$(tc_checksum "$tp" "$f")" + ts="$(toolchain_value "$tp" toolchain_file_csum)" + cs="$(toolchain_checksum "$tp" "$f")" if [ "$ts" != "$cs" ]; then email "rebooting because of new $tn toolchain" <&1 | tee "$tr/bootstrap-$count.log" 1>&2 + toolchain_bootstrap "$tn" 2>&1 | tee "$tr/bootstrap-$count.log" 1>&2 if [ "${PIPESTATUS[0]}" -eq 0 ]; then v="$(cat $tr/version)" @@ -817,7 +817,7 @@ EOF fi s= - bb_check "$tn" 2>&1 | tee "$tr/bbot-$count.log" 1>&2 + bbot_check "$tn" 2>&1 | tee "$tr/bbot-$count.log" 1>&2 case "${PIPESTATUS[0]}" in 0) @@ -832,7 +832,7 @@ EOF # Note: appending to the same log. # - bb_start "$tn" 2>&1 | tee -a "$tr/bbot-$count.log" 1>&2 + bbot_start "$tn" 2>&1 | tee -a "$tr/bbot-$count.log" 1>&2 if [ "${PIPESTATUS[0]}" -eq 0 ]; then s="${s}started bbot-agent@$tn" -- cgit v1.1