Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Improved installer #370

Merged
merged 44 commits into from
Mar 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
cbd533c
separate valiation and setup steps from install process
mpapis Dec 12, 2012
3aa475c
proof of concept: allow configuring destination and used paths, clean…
mpapis Dec 12, 2012
2979c68
remove root check from setup.sh, it's allowed this time
mpapis Dec 13, 2012
8effb8f
forward install.sh parameters to update.sh
mpapis Dec 13, 2012
86c98b8
formating + improve the platform check
mpapis Dec 13, 2012
b2a8e4b
allow running stwrappers, restore rake, move copy to the optimal loca…
mpapis Dec 13, 2012
c926531
cleaning and formating setup.sh
mpapis Dec 13, 2012
53d92c6
translate rake tasks to shell
mpapis Dec 14, 2012
64eb87e
make sure important steps are executed, fail otherwise
mpapis Jan 11, 2013
d96c560
fix Gemstone VM name for download
mpapis Jan 11, 2013
90f68bb
fix Gemstone VM name for download
mpapis Jan 11, 2013
4a3283f
make sure all helpers are loaded
mpapis Jan 11, 2013
d2d6292
changes from @timfel
mpapis Jan 13, 2013
6b0461b
improve error reporting for build_maglev
mpapis Jan 13, 2013
8225d05
allow specifying stonename and make sure it persist for update
mpapis Jan 13, 2013
2c2f820
improved error reporting for command run in stone
mpapis Jan 13, 2013
2332b7e
just reordering functions
mpapis Jan 13, 2013
c00b17c
improve the process, add --help
mpapis Jan 13, 2013
f097685
show last 10 lines of the log on error
mpapis Jan 13, 2013
d96f208
fix build_maglev_in_stone finalizing and return status
mpapis Jan 14, 2013
871150f
increase log output to 50 lines in case of errors
mpapis Jan 16, 2013
374509b
improve logging and outputs for build_maglev_in_stone
mpapis Jan 16, 2013
1cb63e8
Fix merge conflicts in update.sh
johnnyt Dec 7, 2014
f977d7c
Uses gemtalksystems.com for GSS download
johnnyt Dec 7, 2014
7f813d0
Fixes merge conflicts
johnnyt Jan 16, 2015
cefdc42
Changes GemStone versions directory
johnnyt Jan 17, 2015
8331152
Changes gss_file to filename only; cd into versions directory before …
johnnyt Jan 17, 2015
c816bc7
:no_entry_sign: Ignores versions directory
johnnyt Jan 17, 2015
c8ca1ca
:no_entry_sign: Ignores RubyGems directory
johnnyt Jan 17, 2015
4c8235b
Runs topaz as a linked session
johnnyt Jan 17, 2015
43adcc7
Changes mkdir_p to mkdir -p
johnnyt Jan 17, 2015
27c21ca
Removes config file args - they are set as ENV vars
johnnyt Jan 17, 2015
4d03378
Changes STONE_NAME to STONENAME
johnnyt Jan 17, 2015
b222de9
Fixes outfile assignment
johnnyt Jan 17, 2015
259ab93
:no_entry_sign: Ignores .stonename
johnnyt Jan 17, 2015
db5f43f
Fixes MAGLEV_HOME var in loadfiletree.gs
johnnyt Jan 18, 2015
a4f43d4
Uses loadfiletree.gs instead of inlining
johnnyt Jan 18, 2015
66df8d5
Updates missing rake warning message
johnnyt Feb 17, 2015
8fda9da
Changes INFO to Info
johnnyt Feb 17, 2015
20c4fd2
Fixes merge conflicts
johnnyt Feb 17, 2015
bb64665
Fixes indentation in TravisCI config
johnnyt Feb 17, 2015
7b98855
Quotes gss_file
johnnyt Feb 20, 2015
1ff4375
Adds space for redirection
johnnyt Feb 20, 2015
a305067
Errors and exits if unable to build new ruby extent
johnnyt Feb 20, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.stonename
._*
.svn
*~
Expand Down Expand Up @@ -48,3 +49,4 @@ lib/ruby/1.9/openssl/ext/openssl.so
lib/ruby/1.9/openssl/ext/openssl.dylib
lib/ruby/1.9/openssl/ext/openssl.bundle
lib/maglev/gems/1.9
versions
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ env:
# - CI_TESTS=sinatra
# - CI_TESTS=examples
notifications:
email: false
irc: "irc.freenode.org#maglev-ruby"
webhooks:
urls:
- https://webhooks.gitter.im/e/40b9abc1ab238ef1ebb2
on_success: change
on_failure: always
on_start: false
email: false
irc: "irc.freenode.org#maglev-ruby"
webhooks:
urls:
- https://webhooks.gitter.im/e/40b9abc1ab238ef1ebb2
on_success: change
on_failure: always
on_start: false

208 changes: 208 additions & 0 deletions build_functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
function gs_sh()
{
typeset _command
_command="$1"
shift
"$GEMSTONE/bin/${_command}" "$@" || return $?
}

function run_topaz()
{
typeset IFS
IFS=$'\n'
printf "$*\n" | gs_sh topaz -l -I "${MAGLEV_HOME}/etc/.topazini" || return $?
}

function run_on_stone()
{
typeset _username _password
_username="DataCurator"
_password="swordfish"

typeset -a _commands
_commands=(
"output append ${MAGLEV_HOME}/log/maglev/topaz.log"
"set u ${username} p ${password} gemstone ${STONENAME}"
"login"
"limit oops 100"
"limit bytes 1000"
"display oops"
"iferr 1 stack"
"iferr 2 exit 3"
"$@" # inject given commands
"output pop"
"exit"
)
run_topaz "$@"
}

# Given the name of a ERB template, copy it to the destination dir,
# running it through erb.
function cp_template()
{
erb_file="$1"
dest_file="$2"
shift 2
[[ -f "$erb_file" ]] || {
echo "template $erb_file missing"
exit 1
}
sed \
-e "s#<%= extent_filename %>#$GEMSTONE_DATADIR/extent/extent0.dbf#g" \
-e "s#<%= scratch_directory %>#$GEMSTONE_DATADIR/scratch.#g" \
-e "s#<%= tranlog_directories.join(\",\") %>#$GEMSTONE_DATADIR/tranlog,$GEMSTONE_DATADIR/tranlog#g" \
-e "s#<%= FILEIN_DIR %>#$FILEIN_DIR#g" \
-e "s#<%= KEYFILE %>#$MAGLEV_HOME/etc/maglev.demo.key#g" \
< "$erb_file" > "$dest_file"
}

function build_maglev_stone_create()
{
echo "[Info] Creating new default '${STONENAME}' repository"
mkdir -p "${MAGLEV_HOME}/etc/conf.d/"
mkdir -p "${MAGLEV_HOME}/backups"
cp_template "${MAGLEV_HOME}/rakelib/contrib/ottobehrens/stone.conf.template" "${MAGLEV_HOME}/etc/conf.d/${STONENAME}.conf"
mkdir -p "${GEMSTONE_DATADIR}/extent"
mkdir -p "${MAGLEV_HOME}/log/${STONENAME}"
mkdir -p "${GEMSTONE_DATADIR}/tranlog"
cp -f "${MAGLEV_HOME}/bin/extent0.ruby.dbf" "${GEMSTONE_DATADIR}/extent0.ruby.dbf"
chmod 0660 "${GEMSTONE_DATADIR}/extent0.ruby.dbf"
}

function build_maglev_filein_env_setup()
{
# upgradeDir is also needed by the filein topaz scripts. When a
# customers does a 'upgrade' it will be set to $GEMSTONE/upgrade. For
# a filein it will be set to the imageDir.
#
# The non-traditional camel case env variable names come from the
# Smalltalk build. We do not change them because we want to remain as
# compatible as possible with the original SVN source.
export FILEIN_DIR="$MAGLEV_HOME/fileintmp"
export BUILD_DIR="$MAGLEV_HOME/build"
export upgradeDir="$GEMSTONE/upgrade"
export imageDir="$MAGLEV_HOME/src/smalltalk"
export dbfDir="$FILEIN_DIR"
export imageRubyDir="$MAGLEV_HOME/src/smalltalk/ruby"
export GS_DEBUG_COMPILE_TRACE=1
export STONENAME="fileinrubystone"
export GEMSTONE_SYS_CONF="$FILEIN_DIR/filein.ruby.conf"
export GEMSTONE_EXE_CONF="$FILEIN_DIR/fileingem.ruby.conf"
\mkdir -p "${FILEIN_DIR}"
\cd "${FILEIN_DIR}"
}

function build_maglev_new_extent()
(
# ( = subprocess for new env variables scope
build_maglev_filein_env_setup
cp -f "$GEMSTONE/bin/extent0.dbf" "$FILEIN_DIR/extent0.ruby.dbf"
chmod 0770 "$FILEIN_DIR/extent0.ruby.dbf"
cp_template "${BUILD_DIR}/filein.ruby.conf.erb" "$GEMSTONE_SYS_CONF"
cp -f "${BUILD_DIR}/fileingem.ruby.conf" "$GEMSTONE_EXE_CONF"
)

function build_maglev_in_stone()
{
typeset __return __max_log
__max_log=50
{
gs_sh startstone ${STONENAME} -l "$FILEIN_DIR/stone.log" &&
gs_sh waitstone ${STONENAME}
} > "$FILEIN_DIR/startstone_$1.log" 2>&1 ||
{
typeset _return=$?
echo "[ERROR] failed starting gemstone, last ${__max_log} lines of '$FILEIN_DIR/startstone_$1.log':"
tail -n ${__max_log} "$FILEIN_DIR/startstone_$1.log"
return ${_return}
}
{
"$@"
} > "$FILEIN_DIR/runstone_$1.log" 2>&1 ||
{
__return=$?
echo "[ERROR] failed running '$*', last ${__max_log} lines of '$FILEIN_DIR/runstone_$1.log':"
tail -n ${__max_log} "$FILEIN_DIR/runstone_$1.log"
echo "return_status=${_return}" >> "$FILEIN_DIR/runstone_$1.log"
}
gs_sh stopstone ${STONENAME} DataCurator swordfish > "$FILEIN_DIR/stopstone_$1.log" 2>&1 ||
{
typeset _return=$?
[[ -n "__return" ]] || __return=${_return}
echo "[ERROR] failed stopping gemstone, last ${__max_log} lines of '$FILEIN_DIR/stopstone_$1.log':"
tail -n ${__max_log} "$FILEIN_DIR/stopstone_$1.log"
}
return ${__return:-0}
}

function build_maglev_fileinruby()
{
typeset -a _commands
typeset outfile
outfile="${FILEIN_DIR}/fileinruby.out"
_commands=(
"output push ${outfile} only"
"set gemstone ${STONENAME}"
"input $imageDir/fileinruby.topaz"
"output pop"
"exit"
)
run_topaz "${_commands[@]}"
}

function build_maglev_filein()
(
# ( = subprocess for new env variables scope
build_maglev_filein_env_setup
build_maglev_in_stone build_maglev_fileinruby
)

function build_maglev_load_file_tree_dir()
{
typeset -a _commands
typeset outfile
outfile="${FILEIN_DIR}/loadfiletree.out"
_commands=(
"output push ${outfile} only"
"set gemstone ${STONENAME}"
"input $imageDir/loadfiletree.gs"
"output pop"
"exit"
)
run_topaz "${_commands[@]}"
}

function build_maglev_packages()
(
# ( = subprocess for new env variables scope
build_maglev_filein_env_setup
build_maglev_in_stone build_maglev_load_file_tree_dir
)

function build_maglev_install_extent()
{
echo "[Info] Build Succeeded"
if [[ -f "${MAGLEV_HOME}/bin/extent0.ruby.dbf" ]]
then
echo "[Info] Saving previous extent as ${MAGLEV_HOME}/bin/extent0.ruby.dbf.save"
mv "${MAGLEV_HOME}/bin/extent0.ruby.dbf" "${MAGLEV_HOME}/bin/extent0.ruby.dbf.save"
fi

echo "[Info] Copying new extent to ${MAGLEV_HOME}/bin/extent0.ruby.dbf"
cp -f "${MAGLEV_HOME}/fileintmp/extent0.ruby.dbf" "${MAGLEV_HOME}/bin/extent0.ruby.dbf"
chmod 0444 "${MAGLEV_HOME}/bin/extent0.ruby.dbf"
}

function build_maglev()
{
typeset _type _return
for _type in new_extent filein packages install_extent stone_create
do
echo "[Info] maglev build ${_type//_/ }"
build_maglev_${_type} || {
_return=$?
echo "[Error] Build failed for build_maglev_${_type} with return code ${_return}."
return ${_return}
}
done
}
Loading