diff --git a/gtoolkit/run.sh b/gtoolkit/run.sh index 76eaebdb..5bf195c0 100644 --- a/gtoolkit/run.sh +++ b/gtoolkit/run.sh @@ -111,7 +111,14 @@ gtoolkit::prepare_gt() { download_name="$(basename "${gtoolkit_image_url}")" target="${SMALLTALK_CI_CACHE}/${download_name}" - if ! is_file "${target}"; then + if "${config_update_image}" && is_dir "${target}"; then + print_info "Removing cached image resources for ${smalltalk_name} (update forced)" + rm -r "${target}" + fi + if ! is_dir "${target}"; then + mkdir "${target}" + fi + if ! is_file "${target}"/*.image; then fold_start download_image "Downloading ${smalltalk_name} image..." download_file "${gtoolkit_image_url}" "${target}" fold_end download_image diff --git a/pharo/run.sh b/pharo/run.sh index cab26ffe..bf34e524 100644 --- a/pharo/run.sh +++ b/pharo/run.sh @@ -278,14 +278,20 @@ pharo::prepare_image() { local target="${SMALLTALK_CI_CACHE}/${smalltalk_name}" local pharo_zeroconf="${target}/zeroconfig" + if "${config_update_image}" && is_dir "${target}"; then + print_info "Removing cached image resources for ${smalltalk_name} (update forced)" + rm -r "${target}" + fi if ! is_dir "${target}"; then mkdir "${target}" - pushd "${target}" > /dev/null + fi + if ! is_file "${target}"/*.image; then + pushd "${target}" >/dev/null fold_start download_image "Downloading ${smalltalk_name} image..." download_file "${pharo_image_url}" "${pharo_zeroconf}" retry 3 "bash ${pharo_zeroconf}" fold_end download_image - popd > /dev/null + popd >/dev/null fi print_info "Preparing Pharo image..." diff --git a/run.sh b/run.sh index 0da83a30..32062793 100755 --- a/run.sh +++ b/run.sh @@ -280,6 +280,21 @@ validate_configuration() { fi } +################################################################################ +# Set options that depend on the contex, i.e., the input values and selections +# performed so far. +################################################################################ +set_context_options() { + case "${config_smalltalk}" in + *-alpha | *-trunk) + print_info "Forcing image update for in-development version" + config_update_image="true" + ;; + *) + ;; + esac +} + ################################################################################ # Handle user-defined options. # Locals: @@ -287,6 +302,7 @@ validate_configuration() { # config_debug # config_headless # config_smalltalk +# config_update_image # config_verbose # Arguments: # All positional parameters @@ -344,6 +360,10 @@ parse_options() { fi shift 2 ;; + -u | --update-image) + config_update_image="true" + shift + ;; -v | --verbose) config_verbose="true" shift @@ -529,10 +549,11 @@ main() { local config_clean="false" local config_debug="false" local config_first_arg_or_empty="" - local config_headless="true" + export config_headless="true" local config_image="" local config_colorful="true" export config_tracking="true" + export config_update_image="false" local config_verbose="false" local config_vm="" local config_vm_dir @@ -544,6 +565,7 @@ main() { ensure_ston_config_exists "${config_first_arg_or_empty}" select_smalltalk validate_configuration + set_context_options config_vm_dir="${SMALLTALK_CI_VMS}/${config_smalltalk}" prepare_folders export_coveralls_data diff --git a/squeak/run.sh b/squeak/run.sh index 758eba42..4061150f 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -74,6 +74,10 @@ squeak::download_prepared_image() { local git_tag=$2 local target="${SMALLTALK_CI_CACHE}/${download_name}" + if "${config_update_image}" && is_file "${target}"; then + print_info "Removing cached image resources for ${smalltalk_name} (update forced)" + rm "${target}" + fi if ! is_file "${target}"; then fold_start download_image "Downloading '${download_name}' testing image..." download_file "${BASE_DOWNLOAD}/${git_tag}/${download_name}" "${target}"