Skip to content

Commit d6440a6

Browse files
authored
Merge pull request #269 from GsDevKit/issue_265
merge work on #265 and #268
2 parents 6b867a7 + 8e7eacd commit d6440a6

File tree

7 files changed

+100
-11
lines changed

7 files changed

+100
-11
lines changed

alt_bin/examples/error.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../shared/repos/GsDevKit_launcher/rowan/tonel/gsdevkit_launcher-Scripts/GdkL_Error.class.st
1+
..//../shared/repos/GsDevKit_launcher/rowan/tonel/gsdevkit_launcher-Scripts/GdkL_Error.class.st

alt_bin/examples/hello.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../shared/repos/GsDevKit_launcher/rowan/tonel/gsdevkit_launcher-Scripts/GdkL_Hello.class.st
1+
..//../shared/repos/GsDevKit_launcher/rowan/tonel/gsdevkit_launcher-Scripts/GdkL_Hello.class.st

alt_bin/gsdevkit_launcher

+69-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ EXAMPLES
3232
3333
HELP
3434
}
35-
source "${GS_HOME}/bin/private/shFunctions"
3635
stashFile=`realpath $1`
3736
scriptName="$(basename -- $1)"
3837
shift
@@ -197,3 +196,72 @@ _canonicalize_file_path() {
197196
(cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file")
198197
}
199198

199+
# https://github.com/mkropat/sh-realpath/blob/master/realpath.sh
200+
realpath() {
201+
canonicalize_path "$(resolve_symlinks "$1")"
202+
}
203+
204+
resolve_symlinks() {
205+
_resolve_symlinks "$1"
206+
}
207+
208+
_resolve_symlinks() {
209+
_assert_no_path_cycles "$@" || return
210+
211+
local dir_context path
212+
path=$(readlink -- "$1")
213+
if [ $? -eq 0 ]; then
214+
dir_context=$(dirname -- "$1")
215+
_resolve_symlinks "$(_prepend_dir_context_if_necessary "$dir_context" "$path")" "$@"
216+
else
217+
printf '%s\n' "$1"
218+
fi
219+
}
220+
221+
_prepend_dir_context_if_necessary() {
222+
if [ "$1" = . ]; then
223+
printf '%s\n' "$2"
224+
else
225+
_prepend_path_if_relative "$1" "$2"
226+
fi
227+
}
228+
229+
_prepend_path_if_relative() {
230+
case "$2" in
231+
/* ) printf '%s\n' "$2" ;;
232+
* ) printf '%s\n' "$1/$2" ;;
233+
esac
234+
}
235+
236+
_assert_no_path_cycles() {
237+
local target path
238+
239+
target=$1
240+
shift
241+
242+
for path in "$@"; do
243+
if [ "$path" = "$target" ]; then
244+
return 1
245+
fi
246+
done
247+
}
248+
249+
canonicalize_path() {
250+
if [ -d "$1" ]; then
251+
_canonicalize_dir_path "$1"
252+
else
253+
_canonicalize_file_path "$1"
254+
fi
255+
}
256+
257+
_canonicalize_dir_path() {
258+
(cd "$1" 2>/dev/null && pwd -P)
259+
}
260+
261+
_canonicalize_file_path() {
262+
local dir file
263+
dir=$(dirname -- "$1")
264+
file=$(basename -- "$1")
265+
(cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file")
266+
}
267+

shared/repos/GsDevKit_launcher/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ updateGsDevKit -gdtcs # SKIP this if you have a fresh GsDevKit_home instal
4545
git checkout issue_260
4646
git pull origin issue_260 # make sure you have latest commit in your checkout
4747
48-
# bootstrap gsdevkit_launcher script support
49-
$GS_HOME/alt_bin/bootstrap_launcher
50-
5148
# add alt_bin and alt_bin/examples to your path
5249
. alt_bin/defHOME_PATH.env
5350
51+
# bootstrap gsdevkit_launcher script support
52+
$GS_HOME/alt_bin/bootstrap_launcher
53+
5454
# test out the example scripts
5555
hello.st
56+
hello.st --help
5657
error.st
5758
error.st -D --
59+
error.st -h
5860
```
5961
#### tODE development image
6062
The `bootstrap_launcher` script creates a tODE image, that is ready for developing gsdevkit scripts:

shared/repos/GsDevKit_launcher/bootstrapping/gemstone/gsdevkit_home/newBuild_SystemUser_gsdevkit_launcher

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ rm -rf *.log *.out
55

66
newExtent -t -s snapshots/extent0.tode.dbf $GEMSTONE_NAME
77

8-
$ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install.tpz $GEMSTONE_NAME -lq
8+
startTopaz $GEMSTONE_NAME -l << EOF
99

10+
input $ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install.tpz
11+
12+
EOF

shared/repos/GsDevKit_launcher/bootstrapping/gemstone/gsdevkit_home/newBuild_SystemUser_gsdevkit_launcher_deployer

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ else
1212
todeLoad $GEMSTONE_NAME
1313
fi
1414

15-
$ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_tode.tpz $GEMSTONE_NAME -lq
15+
startTopaz $GEMSTONE_NAME -l << EOF
16+
17+
input $ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_tode.tpz
18+
19+
EOF
1620

1721
# this script needs to be rewritten for gsdevkit_launcher
1822
rm -f snapshots/extent0.gsdevkit_launcher.dbf
@@ -28,7 +32,11 @@ pushd $GS_HOME/shared/gemstone/snapshots/
2832
popd
2933
startStone $GEMSTONE_NAME # in 3.5.1 snapshot up above
3034

31-
$ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_scripts.tpz $GEMSTONE_NAME -lq
35+
startTopaz $GEMSTONE_NAME -l << EOF
36+
37+
input $ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_scripts.tpz $GEMSTONE_NAME -lq
38+
39+
EOF
3240

3341
todeIt $GEMSTONE_NAME mount @/sys/stone/dirs/GsDevKit_launcher/shared/repos/GsDevKit_launcher/tode /home gsdevkit_launcher
3442

shared/repos/GsDevKit_launcher/bootstrapping/gemstone/gsdevkit_home/newBuild_SystemUser_gsdevkit_launcher_tode

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ rm -rf *.log *.out
77
newExtent $GEMSTONE_NAME
88
todeLoad $GEMSTONE_NAME
99

10-
$ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_tode.tpz $GEMSTONE_NAME -lq
11-
$ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_scripts.tpz $GEMSTONE_NAME -lq
10+
startTopaz $GEMSTONE_NAME -l << EOF
11+
12+
input $ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_tode.tpz
13+
EOF
14+
15+
startTopaz $GEMSTONE_NAME -l << EOF
16+
17+
input $ROWAN_PROJECTS_HOME/GsDevKit_launcher/bootstrapping/gemstone/bin/bootstrap_install_scripts.tpz
18+
19+
EOF
1220

1321
todeIt $GEMSTONE_NAME mount @/sys/stone/dirs/GsDevKit_launcher/shared/repos/GsDevKit_launcher/tode /home gsdevkit_launcher

0 commit comments

Comments
 (0)