From 5289d0b2e10de6c69f137e6631186c6ae2bce980 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 17:47:51 +0000 Subject: [PATCH 01/11] WIP: feat/specific-trunk --- helpers.sh | 20 ++++++++++++++++++++ squeak/prepare.st | 36 ++++++++++++++++++++++++------------ squeak/run.sh | 8 ++++++-- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/helpers.sh b/helpers.sh index 1e728674..7143098b 100644 --- a/helpers.sh +++ b/helpers.sh @@ -193,7 +193,27 @@ is_sudo_enabled() { $(sudo -n true > /dev/null 2>&1) } +is_tagged_build() { + if [[ ([[:digit:]]+) =~ "${config_smalltalk}" ]]; then + export SCIII_SMALLTALK_VERSION="${BASH_REMATCH[1]}" + return 0 + fi + return 1 +} + is_trunk_build() { + if is_tagged_build; then + case "${config_smalltalk}" in + Squeak*) + SQ_LATEST_RELEASE="19431" + if [ "${SCIII_SMALLTALK_VERSION}" -ge "${SQ_LATEST_RELEASE}" ]; then + return 0 + fi + ;; + esac + return 1 + fi + case "${config_smalltalk}" in *"trunk"|*"Trunk"|*"latest"|*"Latest") return 0 diff --git a/squeak/prepare.st b/squeak/prepare.st index 9447864e..20d4dce8 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -1,4 +1,4 @@ -| monitor | +| monitor trunk_version | FileStream startUp: true. monitor := [ [ FileStream stdout nextPutAll: '.'. @@ -37,19 +37,31 @@ Installer gemsource "==============================================================================" "Update Squeak image" -Smalltalk at: #MCMcmUpdater ifPresent: [ :updater | - [[ (updater respondsTo: #doUpdate) - ifTrue: [ updater doUpdate ] - ifFalse: [ - (updater respondsTo: #updateFromDefaultRepository) - ifTrue: [ updater updateFromDefaultRepository ] - ifFalse: [ ((updater respondsTo: #default) and: [ - updater default respondsTo: #doUpdate: ]) - ifTrue: [ updater default doUpdate: false ] ] ] ] - on: Warning do: [ :ex | ex resume: true ]] +(SmalltalkCI getEnv: 'TRUNK_VERSION') ifNotNil: [ :version | + trunk_version = version asNumber]. +Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | + [ [ trunk_version + ifNotNil: [ + updater defaultUpdateURL: MCHttpRepository trunkUrlString. + updater default doUpdate: false upTo: trunk_version ] + ifNil: [ (updater respondsTo: #doUpdate) + ifTrue: [ updater doUpdate ] + ifFalse: [ + (updater respondsTo: #updateFromDefaultRepository) + ifTrue: [ updater updateFromDefaultRepository ] + ifFalse: [ ((updater respondsTo: #default) and: [ + updater default respondsTo: #doUpdate: ]) + ifTrue: [ updater default doUpdate: false ] ] ] ] ] ] + on: Warning do: [ :ex | ex resume: true ] on: Error do: [ :ex | FileStream stdout nextPutAll: ex asString. - Smalltalk snapshot: true andQuit: true ]]. + Smalltalk snapshot: true andQuit: true ] ]. +trunk_version ifNotNil: [ + self + assert: SystemVersion current highestUpdate = trunk_version + descriptionBlock: [ 'Should be Trunk version <1p> now but is <2p>' + expandMacrosWith: SystemVersion current highestUpdate + with: trunk_version ] ]. monitor terminate. monitor := nil. diff --git a/squeak/run.sh b/squeak/run.sh index 43e7b700..37227e00 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -122,9 +122,13 @@ squeak::prepare_image() { fold_start prepare_image "Preparing ${config_smalltalk} image for CI..." cp "${SMALLTALK_CI_HOME}/squeak/prepare.st" \ "${SMALLTALK_CI_BUILD}/prepare.st" + if is_tagged_build; then + [[:alpha:]]+-([[:digit:]]+) =~ "${config_smalltalk}" + export TRUNK_VERSION="${BASH_REMATCH[1]}" + fi squeak::run_script "prepare.st" || status=$? fold_end prepare_image - + if is_nonzero "${status}"; then print_error_and_exit "Failed to prepare image for CI." "${status}" fi @@ -360,7 +364,7 @@ run_build() { if ! vm_is_user_provided; then squeak::prepare_vm fi - if is_trunk_build || image_is_user_provided; then + if is_tagged_build || is_trunk_build || image_is_user_provided; then squeak::prepare_image fi if ston_includes_loading; then From c02d375520c98e031d6a7f90fc5723e19b345ab2 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 17:56:23 +0000 Subject: [PATCH 02/11] Add exact squeak version number example to GH CI self-tests --- .github/workflows/main.yml | 1 + squeak/run.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f35bf4c..a40c65e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,7 @@ jobs: - Squeak64-5.2 - Squeak64-5.1 - Squeak64-trunk + - Squeak64-19442 - Pharo64-stable - Pharo64-alpha - Pharo64-9.0 diff --git a/squeak/run.sh b/squeak/run.sh index 37227e00..55a7fe29 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -128,7 +128,7 @@ squeak::prepare_image() { fi squeak::run_script "prepare.st" || status=$? fold_end prepare_image - + if is_nonzero "${status}"; then print_error_and_exit "Failed to prepare image for CI." "${status}" fi From 23a579da1f8cd657d65239d41c59d0f0acdf4bc9 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 18:01:33 +0000 Subject: [PATCH 03/11] Fix syntax slip (1) --- helpers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.sh b/helpers.sh index 7143098b..334aeeb3 100644 --- a/helpers.sh +++ b/helpers.sh @@ -194,7 +194,7 @@ is_sudo_enabled() { } is_tagged_build() { - if [[ ([[:digit:]]+) =~ "${config_smalltalk}" ]]; then + if [[ "${config_smalltalk}" =~ ([[:digit:]]+) ]]; then export SCIII_SMALLTALK_VERSION="${BASH_REMATCH[1]}" return 0 fi From c532ee5f3e696eac1fffea8d06a94b59aa055501 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 18:04:31 +0000 Subject: [PATCH 04/11] Reuse SCIII_SMALLTALK_VERSION --- squeak/prepare.st | 2 +- squeak/run.sh | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/squeak/prepare.st b/squeak/prepare.st index 20d4dce8..7c273367 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -37,7 +37,7 @@ Installer gemsource "==============================================================================" "Update Squeak image" -(SmalltalkCI getEnv: 'TRUNK_VERSION') ifNotNil: [ :version | +(SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | trunk_version = version asNumber]. Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | [ [ trunk_version diff --git a/squeak/run.sh b/squeak/run.sh index 55a7fe29..b8f55798 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -122,10 +122,7 @@ squeak::prepare_image() { fold_start prepare_image "Preparing ${config_smalltalk} image for CI..." cp "${SMALLTALK_CI_HOME}/squeak/prepare.st" \ "${SMALLTALK_CI_BUILD}/prepare.st" - if is_tagged_build; then - [[:alpha:]]+-([[:digit:]]+) =~ "${config_smalltalk}" - export TRUNK_VERSION="${BASH_REMATCH[1]}" - fi + is_tagged_build # parse SCIII_SMALLTALK_VERSION squeak::run_script "prepare.st" || status=$? fold_end prepare_image From f8324a62efc6b1aed749ca5570e3d5f85b8ab6a9 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 19:01:41 +0000 Subject: [PATCH 05/11] Fix version checks --- .github/workflows/main.yml | 2 +- helpers.sh | 13 ++++++++----- squeak/run.sh | 5 +++-- squeak/version_tags.sh | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 squeak/version_tags.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a40c65e5..c2a2ee58 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: - Squeak64-5.2 - Squeak64-5.1 - Squeak64-trunk - - Squeak64-19442 + - Squeak64-18242 - Pharo64-stable - Pharo64-alpha - Pharo64-9.0 diff --git a/helpers.sh b/helpers.sh index 334aeeb3..4ba20771 100644 --- a/helpers.sh +++ b/helpers.sh @@ -194,8 +194,10 @@ is_sudo_enabled() { } is_tagged_build() { - if [[ "${config_smalltalk}" =~ ([[:digit:]]+) ]]; then - export SCIII_SMALLTALK_VERSION="${BASH_REMATCH[1]}" + if [[ "${config_smalltalk}" =~ ^(Squeak(32|64))?-([[:digit:]]+)$ ]]; then + source "${SMALLTALK_CI_HOME}/squeak/version_tags.sh" + export SCIII_SMALLTALK_VERSION="${BASH_REMATCH[-1]}" + export SCIII_LATEST_RELEASE="${BASH_REMATCH[1]}-$(squeak::latest_release_before ${SCIII_SMALLTALK_VERSION})" return 0 fi return 1 @@ -205,11 +207,12 @@ is_trunk_build() { if is_tagged_build; then case "${config_smalltalk}" in Squeak*) - SQ_LATEST_RELEASE="19431" - if [ "${SCIII_SMALLTALK_VERSION}" -ge "${SQ_LATEST_RELEASE}" ]; then + if config_smalltalk="${SCIII_LATEST_RELEASE}" is_trunk_build; then return 0 + else + return 1 fi - ;; + ;; esac return 1 fi diff --git a/squeak/run.sh b/squeak/run.sh index b8f55798..3ce27940 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -352,10 +352,11 @@ EOL ################################################################################ run_build() { if ! image_is_user_provided; then + download_version="${SCIII_LATEST_RELEASE:-${config_smalltalk}}" if is_trunk_build; then - squeak::download_trunk_image + config_smalltalk=${download_version} squeak::download_trunk_image else - squeak::download_image "${config_smalltalk}" + squeak::download_image ${download_version} fi fi if ! vm_is_user_provided; then diff --git a/squeak/version_tags.sh b/squeak/version_tags.sh new file mode 100755 index 00000000..68b76630 --- /dev/null +++ b/squeak/version_tags.sh @@ -0,0 +1,20 @@ +squeak::latest_release_before() { + if [ "$1" -ge "19438" ]; then + echo "Trunk" + elif [ "$1" -ge "19438" ]; then + echo "5.3" + elif [ "$1" -ge "18236" ]; then + echo "5.2" + elif [ "$1" -ge "16555" ]; then + echo "5.1" + elif [ "$1" -ge "15113" ]; then + echo "5.0" + elif [ "$1" -ge "15102" ]; then + echo "4.6" + elif [ "$1" -ge "13680" ]; then + echo "4.5" + else + echo "" + return 1 + fi +} From 1b33bee3b3ccead570ff7b93921c283c82d93d81 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 19:04:36 +0000 Subject: [PATCH 06/11] Make sure to parse SCIII_LATEST_RELEASE --- squeak/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/squeak/run.sh b/squeak/run.sh index 3ce27940..d3484fd8 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -352,6 +352,7 @@ EOL ################################################################################ run_build() { if ! image_is_user_provided; then + is_tagged_build # parse $SCIII_LATEST_RELEASE download_version="${SCIII_LATEST_RELEASE:-${config_smalltalk}}" if is_trunk_build; then config_smalltalk=${download_version} squeak::download_trunk_image From b7858437941da4dbeee1c1df63005fd854c5ee8c Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 25 Mar 2021 19:07:53 +0000 Subject: [PATCH 07/11] Ignore exit code This works indeed: https://stackoverflow.com/a/29784820/13994294 --- squeak/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squeak/run.sh b/squeak/run.sh index d3484fd8..38174393 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -352,7 +352,7 @@ EOL ################################################################################ run_build() { if ! image_is_user_provided; then - is_tagged_build # parse $SCIII_LATEST_RELEASE + ! is_tagged_build # try to parse $SCIII_LATEST_RELEASE download_version="${SCIII_LATEST_RELEASE:-${config_smalltalk}}" if is_trunk_build; then config_smalltalk=${download_version} squeak::download_trunk_image From 083a80fa2f8bf85ed7dbbdbc8e9c0254961903e0 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 8 Apr 2021 20:43:42 +0000 Subject: [PATCH 08/11] Use MonticelloConfigurations-ct.166 (inbox) for trunk versions --- squeak/prepare.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/squeak/prepare.st b/squeak/prepare.st index 7c273367..efb51507 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -38,12 +38,13 @@ Installer gemsource "Update Squeak image" (SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | + Installer new primMerge: 'MonticelloConfigurations-ct.166.mcz' from: MCRepository inbox; flag: #todo "ct: preview". trunk_version = version asNumber]. Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | [ [ trunk_version ifNotNil: [ updater defaultUpdateURL: MCHttpRepository trunkUrlString. - updater default doUpdate: false upTo: trunk_version ] + updater default doUpdate: false upToUpdate: trunk_version ] ifNil: [ (updater respondsTo: #doUpdate) ifTrue: [ updater doUpdate ] ifFalse: [ From ef4d234439bca12560ebeefc874ee65ff8fd93a0 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 8 Apr 2021 20:58:40 +0000 Subject: [PATCH 09/11] Robustize error handling in prepare.st --- squeak/prepare.st | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/squeak/prepare.st b/squeak/prepare.st index efb51507..ccff1a51 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -37,11 +37,11 @@ Installer gemsource "==============================================================================" "Update Squeak image" -(SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | +[ [ (SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | Installer new primMerge: 'MonticelloConfigurations-ct.166.mcz' from: MCRepository inbox; flag: #todo "ct: preview". trunk_version = version asNumber]. Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | - [ [ trunk_version + trunk_version ifNotNil: [ updater defaultUpdateURL: MCHttpRepository trunkUrlString. updater default doUpdate: false upToUpdate: trunk_version ] @@ -52,17 +52,17 @@ Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | ifTrue: [ updater updateFromDefaultRepository ] ifFalse: [ ((updater respondsTo: #default) and: [ updater default respondsTo: #doUpdate: ]) - ifTrue: [ updater default doUpdate: false ] ] ] ] ] ] - on: Warning do: [ :ex | ex resume: true ] - on: Error do: [ :ex | - FileStream stdout nextPutAll: ex asString. - Smalltalk snapshot: true andQuit: true ] ]. + ifTrue: [ updater default doUpdate: false ] ] ] ] ]. trunk_version ifNotNil: [ self - assert: SystemVersion current highestUpdate = trunk_version - descriptionBlock: [ 'Should be Trunk version <1p> now but is <2p>' + assert: SystemVersion current highestUpdate >= trunk_version + descriptionBlock: [ 'Should be Trunk version <1p> or higher now but is <2p>' expandMacrosWith: SystemVersion current highestUpdate - with: trunk_version ] ]. + with: trunk_version ] ] ] + on: Warning do: [ :ex | ex resume: true ] ] + on: Error do: [ :ex | + FileStream stdout nextPutAll: ex asString. + Smalltalk snapshot: true andQuit: true ]. monitor terminate. monitor := nil. From 15be384f9c89a80cd2eb4255e5147251bb2a2d64 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 8 Apr 2021 21:00:53 +0000 Subject: [PATCH 10/11] MCMcmUpdater>>#doUpdate:upToUpdate:: Bump inbox dependency to MonticelloConfigurations-ct.167 --- squeak/prepare.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squeak/prepare.st b/squeak/prepare.st index ccff1a51..40db2407 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -38,7 +38,7 @@ Installer gemsource "Update Squeak image" [ [ (SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | - Installer new primMerge: 'MonticelloConfigurations-ct.166.mcz' from: MCRepository inbox; flag: #todo "ct: preview". + Installer new primMerge: 'MonticelloConfigurations-ct.167.mcz' from: MCRepository inbox; flag: #todo "ct: preview". trunk_version = version asNumber]. Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | trunk_version From a64f8a9c2601e59d4f294e02bf5f52ede6cfbead Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 8 Apr 2021 21:17:06 +0000 Subject: [PATCH 11/11] Fix issues with compatibility and load order --- squeak/prepare.st | 6 +++--- squeak/run.sh | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/squeak/prepare.st b/squeak/prepare.st index 40db2407..cc110213 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -38,9 +38,9 @@ Installer gemsource "Update Squeak image" [ [ (SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | - Installer new primMerge: 'MonticelloConfigurations-ct.167.mcz' from: MCRepository inbox; flag: #todo "ct: preview". - trunk_version = version asNumber]. -Smalltalk classNamed: #MCMcmUpdater ifPresent: [ :updater | + trunk_version = version asNumber. + Installer new primMerge: 'MonticelloConfigurations-ct.167.mcz' from: MCRepository inbox; flag: #todo "ct: preview"]. +(Smalltalk classNamed: #MCMcmUpdater) ifNotNil: [ :updater | trunk_version ifNotNil: [ updater defaultUpdateURL: MCHttpRepository trunkUrlString. diff --git a/squeak/run.sh b/squeak/run.sh index 38174393..094dc2b0 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -120,9 +120,8 @@ squeak::prepare_image() { local status=0 fold_start prepare_image "Preparing ${config_smalltalk} image for CI..." - cp "${SMALLTALK_CI_HOME}/squeak/prepare.st" \ - "${SMALLTALK_CI_BUILD}/prepare.st" is_tagged_build # parse SCIII_SMALLTALK_VERSION + sed "s/(SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION')/${SCIII_SMALLTALK_VERSION:-nil}/" "${SMALLTALK_CI_HOME}/squeak/prepare.st" > "${SMALLTALK_CI_BUILD}/prepare.st" # SmalltalkCI will be installed later into the image squeak::run_script "prepare.st" || status=$? fold_end prepare_image