From a563e34edcd1630f396dce3544c07a73accf8549 Mon Sep 17 00:00:00 2001 From: Dale Henrichs Date: Tue, 24 Oct 2023 11:48:20 -0700 Subject: [PATCH] add --ensure option to createStone.solo; create registryQuery,solo; test both --- bin/createStone.solo | 26 +++++++++-- bin/registryQuery.solo | 87 +++++++++++++++++++++++++++++++++++ tests/test_defaultRegistry.sh | 7 ++- 3 files changed, 114 insertions(+), 6 deletions(-) create mode 100755 bin/registryQuery.solo diff --git a/bin/createStone.solo b/bin/createStone.solo index 298d2a10..0e8788b1 100755 --- a/bin/createStone.solo +++ b/bin/createStone.solo @@ -1,6 +1,7 @@ #!/usr/bin/env superdoit_solo options { +SuperDoitOptionalOptionWithNoArg long: 'ensure' short: 'e'. SuperDoitOptionalOptionWithNoArg long: 'force' short: 'f'. SuperDoitOptionalOptionWithNoArg long: 'start'. SuperDoitOptionalOptionWithRequiredArg long: 'registry' short: 'r'. @@ -11,7 +12,11 @@ SuperDoitOptionalOptionWithNoArg long: 'verbose' short: 'v'. % Usage ----- -USAGE $basename [--help | -h] [--debug | -D] [--debugGem] [-f | --force] [-v | --verbose] \ +USAGE $basename [--help | -h] [--debug | -D] [--debugGem][-v | --verbose] \ + [ + [-f | --force] | + [-e | --ensure] + ] --root= [--registry= | -r ] \ --template= @@ -25,6 +30,7 @@ OPTIONS dump stack to stdout and wait for topaz to attach using topaz DEBUGGEM command. -f, --force Delete the stone directory if it exists. + -e, --ensure Ensure that the stone exists. Use it "as is". -v, --verbose Verbose logging enabled. --registry= | -r is the name of the registry. Default is hostname. @@ -35,6 +41,7 @@ EXAMPLES $basename --debugGem # extent0.dbf, SystemUser $basename --force --registry=gsdevkit --template=minimal gs_366 3.6.6 + $basename --ensure --registry=gsdevkit --template=minimal gs_366 3.6.6 # extent0.rowan.dbf, SystemUser $basename -f --registry=bosch --template=minimal_rowan rowan_366 3.6.6 # extent0.seaside.dbf, tODE installed, DataCurator @@ -115,6 +122,13 @@ loadTode: stoneSpec stdout: nil andInput: nil % +method +startTheStoneAndNetldi: stoneSpec + self start + ifTrue: [ + stoneSpec startStone: self withSuperDoitOptions: false. + stoneSpec startNetldi: self withSuperDoitOptions: true ]. +% doit | registryClass stonesRegistry gemstoneVersion stoneName rootDir stoneSpec stoneSpecClass | self preDoitSpecLoad: [:spec | @@ -154,6 +168,11 @@ doit ifTrue: [ self force ifFalse: [ + self ensure + ifTrue: [ + "stone already exists ... leave as is ... start stone if desired" + self startTheStoneAndNetldi: stoneSpec. + ^ stoneSpec ]. self error: 'A stone named ', stoneName, ' already exists. Use --force to clean up.', ' (', self basename, ')']. stonesRegistry destroyStoneStructureFor: stoneName ]. @@ -165,9 +184,6 @@ doit stoneSpec class symbolicLink: stoneSpec registryPath linkName: stoneSpec rootDir / '.GDKStoneSpec.ston'. - self start - ifTrue: [ - stoneSpec startStone: self withSuperDoitOptions: false. - stoneSpec startNetldi: self withSuperDoitOptions: true ]. + self startTheStoneAndNetldi: stoneSpec. ^ stoneSpec % diff --git a/bin/registryQuery.solo b/bin/registryQuery.solo new file mode 100755 index 00000000..205ba210 --- /dev/null +++ b/bin/registryQuery.solo @@ -0,0 +1,87 @@ +#!/usr/bin/env superdoit_solo +options +{ + SuperDoitOptionalOptionWithRequiredArg long: 'registry' short: 'r'. + SuperDoitOptionalOptionWithRequiredArg long: 'product'. + SuperDoitOptionalOptionWithNoArg long: 'stonesDirectory'. +} +% +usage +----- +USAGE $basename [--help | -h] [--debug | -D] [--debugGem] \ + [ \ + [ --registry= | -r ] \ + [ --product= ] \ + [ --stonesDirectory ] + ] + +DESCRIPTION + Writes the value of the given attribute on stdout, or an empty string, if the + attribute is not found. + +OPTIONS + -h, --help display usage message + -D, --debug bring up topaz debugger in the event of a script error + --debugGem If terminal is connected to stdout, bring up debugger. If not, + dump stack to stdout and wait for topaz to attach using topaz + DEBUGGEM command. + --registry= | -r + is the name of the registry. + --product= + write path to product directory to stdout or empty string, if + the is not registered + --stonesDirectory + write stones directory path to stdout or empty string, if not + registered + +EXAMPLES + $basename --help + $basename -D + $basename --debugGem + $basename + $basename --registry=bosch + $basename --registry=bosch --projectSet=dev + $basename --registry=bosch --template=minimal + $basename -r bosch --stone=bosch_370 +----- +% +specs +[ +RwLoadSpecificationV2 { + #projectName : 'GsDevKit_stones', + #projectSpecFile : 'rowan/project.ston', + #componentNames : [ + 'Core', + 'Solo' + ], + #platformProperties : { + 'gemstone' : { + 'allusers' : { + #defaultSymbolDictName : 'Globals' + } + } + }, + #comment : '' +} +] +% +method +registryName + ^ self registry + ifNil: [ (self globalNamed: 'System') hostname ] + ifNotNil: [:value | value ]. +% +doit + | registryClass stonesRegistry | + self preDoitSpecLoad: [:spec | + spec projectsHome: self dirname asFileReference parent parent]. + registryClass := (self globalNamed: 'GDKRegistry'). + stonesRegistry := registryClass stonesRegistryNamed: self registryName. + self stonesDirectory + ifTrue: [ + self stdout nextPutAll: (stonesRegistry stonesDirectory ifNil: [ '']); lf ]. + self product + ifNotNil: [ :productName | + self stdout nextPutAll: (stonesRegistry products at: productName ifAbsent: ['']); lf ]. + ^ self noResult +% diff --git a/tests/test_defaultRegistry.sh b/tests/test_defaultRegistry.sh index 626a2dcf..ca81eb40 100755 --- a/tests/test_defaultRegistry.sh +++ b/tests/test_defaultRegistry.sh @@ -2,6 +2,7 @@ # # test coverage for when --registry option is omitted (default registry name will be hostname): # registryReport.sol +# registryQuery.solo # createRegistry.solo # createProjectSet.solo # updateProjectSet.solo @@ -81,6 +82,8 @@ downloadGemStone.solo $GS_VERS $* # update product list from shared product directory when a download is done by shared registry registerProduct.solo --fromDirectory=$STONES_HOME/test_gemstone $* +productPath=`registryQuery.solo --product` +echo "product path for ${GS_VERS}: $productPath" # create and register default stones directory for rowanV3 if [ ! -d $STONES_HOME/test_stones ]; then mkdir $STONES_HOME/test_stones @@ -110,9 +113,11 @@ case "$GS_VERS" in esac # create a $GS_VERS Rowan stone and install GsDevKit_home export stoneName=gs_$GS_VERS -createStone.solo --template=$template $stoneName $GS_VERS $* +createStone.solo --ensure --template=$template $stoneName $GS_VERS $* +createStone.solo --ensure --template=$template $stoneName $GS_VERS $* echo $PLATFORM + set -x if [ "$CI" = "true" ]; then # possible native code generation issues on mac and github, disable native code