Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squeak: Specify exact Trunk image version #506

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- Squeak64-5.2
- Squeak64-5.1
- Squeak64-trunk
- Squeak64-18242
- Pharo64-stable
- Pharo64-alpha
- Pharo64-9.0
Expand Down
23 changes: 23 additions & 0 deletions helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,30 @@ is_sudo_enabled() {
$(sudo -n true > /dev/null 2>&1)
}

is_tagged_build() {
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
}

is_trunk_build() {
if is_tagged_build; then
case "${config_smalltalk}" in
Squeak*)
if config_smalltalk="${SCIII_LATEST_RELEASE}" is_trunk_build; then
return 0
else
return 1
fi
;;
esac
return 1
fi

case "${config_smalltalk}" in
*"trunk"|*"Trunk"|*"latest"|*"Latest")
return 0
Expand Down
41 changes: 27 additions & 14 deletions squeak/prepare.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| monitor |
| monitor trunk_version |
FileStream startUp: true.
monitor := [ [
FileStream stdout nextPutAll: '.'.
Expand Down Expand Up @@ -37,19 +37,32 @@ 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 ]]
on: Error do: [ :ex |
FileStream stdout nextPutAll: ex asString.
Smalltalk snapshot: true andQuit: true ]].
[ [ (SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version |
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.
updater default doUpdate: false upToUpdate: 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 ] ] ] ] ].
trunk_version ifNotNil: [
self
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 ] ] ]
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.
Expand Down
12 changes: 7 additions & 5 deletions squeak/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +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

Expand Down Expand Up @@ -351,16 +351,18 @@ EOL
################################################################################
run_build() {
if ! image_is_user_provided; then
! is_tagged_build # try to parse $SCIII_LATEST_RELEASE
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
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
Expand Down
20 changes: 20 additions & 0 deletions squeak/version_tags.sh
Original file line number Diff line number Diff line change
@@ -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 "<historic>"
return 1
fi
}