Check-in [f8c7c20a57]
Overview
Comment:More better API
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f8c7c20a57b88a7617195509539dfe936db79f57
User & Date: rkeene on 2019-02-28 10:19:39
Other Links: manifest | tags
Context
2019-02-28
10:29
Better error handling check-in: f2566d10e2 user: rkeene tags: trunk
10:19
More better API check-in: f8c7c20a57 user: rkeene tags: trunk
09:48
More options for the API client check-in: 3bc708ba71 user: rkeene tags: trunk
Changes

Modified build/utils/download-api-client from [172cc868bc] to [8826872ee9].

     1      1   #! /usr/bin/env bash
     2      2   
     3      3   # Define endpoint
     4      4   endpoint_url="https://kitcreator.rkeene.org/kitcreator"
            5  +
            6  +# Help
            7  +function print_help() {
            8  +	echo 'download-api-client [--platform <platform>] [--tcl-version <version>]'
            9  +	echo '                    [--kitcreator-version <version>] [--kitdll]'
           10  +	echo '                    [--threaded] [--debug] [--dynamictk]'
           11  +	echo '                    [--staticpkgs]'
           12  +	echo 'download-api-client {--help|--platforms|--tcl-versions|'
           13  +	echo '                     --kitcreator-versions|--packages}'
           14  +}
     5     15   
     6     16   # Set arguments
     7     17   declare -A jsonArgs
     8     18   jsonArgs["platform"]="$(uname -s)-$(uname -m)"
     9     19   
    10     20   nextArg=''
    11     21   kit_filename=''
................................................................................
    18     28   	fi
    19     29   
    20     30   	case "${arg}" in
    21     31   		--platform|--tcl-version|--kitcreator-version)
    22     32   			nextArg="${arg:2}"
    23     33   			nextArg="${nextArg//-/_}"
    24     34   			;;
    25         -		--kitdll|--threaded)
           35  +		--kitdll|--threaded|--debug|--dynamictk|--staticpkgs)
    26     36   			options+=("${arg:2}")
    27     37   			;;
           38  +		--platforms|--tcl-versions|--kitcreator-versions|--packages|--options)
           39  +			action="${arg:2}"
           40  +			action="${action//-/_}"
           41  +
           42  +			formatString='%-20s | %s\n'
           43  +			printf "${formatString}" Name Description
           44  +			printf '%s+%s\n' --------------------- ---------------------
           45  +			curl -sSL -d "json={\"action\":\"${action}\"}" "${endpoint_url}" | jq -crM 'keys[] as $k | "\($k) \(.[$k])"' | while read -r platform description; do
           46  +				printf "${formatString}" "${platform}" "${description}"
           47  +			done
           48  +			exit 0
           49  +			;;
           50  +		--help)
           51  +			print_help
           52  +			exit 0
           53  +			;;
           54  +		*)
           55  +			echo "Invalid option \"${arg}\"" >&2
           56  +			print_help >&2
           57  +			exit 1
    28     58   	esac
    29     59   done
    30     60   
    31     61   if [ -n "${options[*]}" ]; then
    32     62   	jsonArgs["options"]="${options[@]}"
    33     63   fi
    34     64   
................................................................................
    72    102   	fi
    73    103   
    74    104   	sleep 30
    75    105   
    76    106   	echo -n '.'
    77    107   done
    78    108   status="$(jq -crM .status <<<"${info}")"
          109  +build_log_url="$(jq -crM .build_log_url <<<"${info}")"
    79    110   
    80    111   if [ -n "${buildStatusWroteHeader}" ]; then
    81    112   	echo " ${status}"
    82    113   fi
    83    114   
    84    115   if [ "${status}" != "complete" ]; then
    85    116   	echo "failed: ${status}" >&2
          117  +	curl -sSL "${build_log_url}" >&2
    86    118   
    87    119   	exit 1
    88    120   fi
    89    121   
    90    122   kit_url="$(jq -crM .kit_url <<<"${info}")"
    91    123   if [ -z "${kit_filename}" ]; then
    92    124   	kit_filename="${kit_url//*\//}"

Modified build/web/building.cgi from [5e55e39bde] to [536bf400ea].

   140    140   	set resultsDict [dict create \
   141    141   		status [string tolower $status] \
   142    142   		terminal $terminalBoolean \
   143    143   	]
   144    144   	if {[string tolower $status] eq "complete"} {
   145    145   		dict set resultsDict kit_url $url
   146    146   	}
   147         -	if {[string tolower $status] in {complete building}} {
          147  +	if {[string tolower $status] in {complete building failed}} {
   148    148   		dict set resultsDict build_log_url $build_log_url
   149    149   		catch {
   150    150   			dict set resultsDict tcl_version $buildinfo(tcl_version)
   151    151   		}
   152    152   		catch {
   153    153   			dict set resultsDict kitcreator_version $buildinfo(kitcreator_version)
   154    154   		}