Compare commits
2 commits
2bc8d50230
...
8c890b97e8
Author | SHA1 | Date | |
---|---|---|---|
8c890b97e8 | |||
5bf6349a64 |
2 changed files with 76 additions and 43 deletions
|
@ -19,7 +19,7 @@ if [[ "$#" -ne 4 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo "TODO: check for $TMPDIR"
|
||||
echo "TODO: check for \$TMPDIR and execution bit in \$TMPDIR"
|
||||
|
||||
arg_repo=$1
|
||||
arg_tag=$2
|
||||
|
@ -29,7 +29,7 @@ arg_destination=$4
|
|||
log () {
|
||||
local msg=$1
|
||||
if [[ -n $_VERBOSITY ]]; then
|
||||
echo $msg
|
||||
echo "*** $msg"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -78,10 +78,10 @@ checkout_git () {
|
|||
local dir=$3
|
||||
local err
|
||||
|
||||
pushd $dir
|
||||
pushd $dir > /dev/null
|
||||
git clone --depth=1 --single-branch --branch=$tag -c feature.manyFiles=true $repo .
|
||||
err=$?
|
||||
popd
|
||||
popd > /dev/null
|
||||
|
||||
return $err
|
||||
}
|
||||
|
@ -94,6 +94,6 @@ if [[ -z $destination_dir ]]; then
|
|||
log "Covardly refusing to overwrite existing directory $arg_dir/$arg_destination."
|
||||
exit 1
|
||||
else
|
||||
log "Checking out Spack from $repo at tag $release_tag into directory $destination_dir"
|
||||
log "Checking out from $repo at tag $release_tag into directory $destination_dir"
|
||||
checkout_git $repo $release_tag $destination_dir
|
||||
fi
|
|
@ -31,23 +31,10 @@
|
|||
# └── ...
|
||||
#
|
||||
|
||||
_VERBOSITY=1
|
||||
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Syntax: $0 release_tag base_prefix"
|
||||
echo "Populates directory <base_prefix>/release/<release_tag> with the release tagged as <release_tag>."
|
||||
# TODO: exit with error code
|
||||
fi
|
||||
|
||||
echo "TODO: check for $TMPDIR"
|
||||
|
||||
arg_tag=$1
|
||||
arg_prefix=$2
|
||||
|
||||
log () {
|
||||
local msg=$1
|
||||
if [[ -n $_VERBOSITY ]]; then
|
||||
echo $msg
|
||||
echo "### $msg"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -73,42 +60,88 @@ create_dir () {
|
|||
}
|
||||
|
||||
|
||||
# process input arguments
|
||||
HLRS_SOFTWARE_STACK_RELEASE_VERSION__USER=$(canonize_tag $arg_tag)
|
||||
HLRS_OPT_PREFIX__USER=$(create_dir $arg_prefix)
|
||||
_VERBOSITY=1
|
||||
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "Syntax: $0 release_tag base_prefix"
|
||||
echo "Populates directory <base_prefix>/release/<release_tag> with the release tagged as <release_tag>."
|
||||
# TODO: exit with error code
|
||||
fi
|
||||
|
||||
echo "TODO: check for \$TMPDIR and execution bit in \$TMPDIR"
|
||||
|
||||
|
||||
# process script arguments
|
||||
arg_tag=$(canonize_tag $1)
|
||||
arg_prefix=$2
|
||||
|
||||
# Define various repo locations
|
||||
_HLRS_SPACK_REPO=file://$HOME/spack-test/dummy_repo/spack-v0.21.2.git
|
||||
_HLRS_SPACK_PLUMBING_REPO=file://$HOME/spack-test/dummy_repo/software-stack-plumbing.git
|
||||
_HLRS_SPACK_CONFIG_REPO=file://$HOME/spack-test/dummy_repo/software-stack-hlrs-spack.git
|
||||
_HLRS_SPACK_REPO=file://$HOME/spack-test/dummy_repo/spack.git
|
||||
_HLRS_SPACK_PLUMBING_REPO=file://$HOME/spack-test/dummy_repo/release_root.git
|
||||
_HLRS_SPACK_CONFIG_REPO=file://$HOME/spack-test/dummy_repo/hlrs-spack.git
|
||||
|
||||
# bootstrap environment variables
|
||||
# (using [bash process substitution](https://tldp.org/LDP/abs/html/process-sub.html))
|
||||
log "### bootstrap environment variables"
|
||||
source <(curl -L $_HLRS_SPACK_PLUMBING_REPO/hlrs-plumbing/envs/00_base_prefix.env)
|
||||
source <(curl -L $_HLRS_SPACK_PLUMBING_REPO/hlrs-plumbing/envs/01_release_root.env)
|
||||
source <(curl -L $_HLRS_SPACK_PLUMBING_REPO/hlrs-plumbing/envs/02_hlrs_spack_root.env)
|
||||
log "### ... done"
|
||||
|
||||
# setup plumbing directory
|
||||
log "### setup plumbing directory"
|
||||
# bootstrap staging area
|
||||
log "setup staging area at:"
|
||||
staging_dir=$(mktemp -d)/staging
|
||||
log " $staging_dir"
|
||||
|
||||
# bootstrap plumbing directory
|
||||
log "bootstrap plumbing directory ..."
|
||||
curl -L $_HLRS_SPACK_PLUMBING_REPO/hlrs-plumbing/scripts/xx_checkout_repo.sh | \
|
||||
bash -s -- $_HLRS_SPACK_PLUMBING_REPO \
|
||||
$arg_tag $staging_dir .
|
||||
plumbing_dir=$staging_dir/hlrs-plumbing
|
||||
log "... done"
|
||||
|
||||
|
||||
# set anchors for environment variables to staging area
|
||||
HLRS_SOFTWARE_STACK_RELEASE_VERSION__USER=$arg_tag
|
||||
HLRS_OPT_PREFIX__USER=$(create_dir $staging_dir/prefix)
|
||||
|
||||
# bootstrap environment variables
|
||||
log "bootstrap environment variables ..."
|
||||
source $plumbing_dir/envs/00_base_prefix.env
|
||||
source $plumbing_dir/envs/01_release_root.env
|
||||
source $plumbing_dir/envs/02_hlrs_spack_root.env
|
||||
log "... done"
|
||||
|
||||
# setup plumbing directory
|
||||
log "setup plumbing directory ..."
|
||||
$plumbing_dir/scripts/xx_checkout_repo.sh $_HLRS_SPACK_PLUMBING_REPO \
|
||||
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_RELEASE_ROOT .
|
||||
_HLRS_PLUMBING_DIR=$HLRS_SOFTWARE_STACK_RELEASE_ROOT/hlrs-plumbing
|
||||
log "### ... done"
|
||||
log "... done"
|
||||
|
||||
# setup hlrs-spack directory
|
||||
log "### setup hlrs-spack directory"
|
||||
$_HLRS_PLUMBING_DIR/scripts/xx_checkout_repo.sh $_HLRS_SPACK_CONFIG_REPO \
|
||||
log "setup hlrs-spack directory ..."
|
||||
$plumbing_dir/scripts/xx_checkout_repo.sh $_HLRS_SPACK_CONFIG_REPO \
|
||||
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_RELEASE_ROOT hlrs-spack
|
||||
log "### ... done"
|
||||
log "... done"
|
||||
|
||||
# setup $SPACK_ROOT directory
|
||||
log "### setup $SPACK_ROOT directory"
|
||||
$_HLRS_PLUMBING_DIR/scripts/xx_checkout_repo.sh $_HLRS_SPACK_REPO \
|
||||
log "setup $SPACK_ROOT directory ..."
|
||||
$plumbing_dir/scripts/xx_checkout_repo.sh $_HLRS_SPACK_REPO \
|
||||
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_HLRS_SPACK_ROOT spack
|
||||
log "### ... done"
|
||||
log "... done"
|
||||
|
||||
# setup opt-non-spack
|
||||
# TODO
|
||||
|
||||
# re-evaluate environment variables
|
||||
log "bootstrap final environment variables ..."
|
||||
staging_release_root=$HLRS_SOFTWARE_STACK_RELEASE_ROOT
|
||||
source $plumbing_dir/envs/xx_unload_env.env
|
||||
HLRS_OPT_PREFIX__USER=$(create_dir $arg_prefix)
|
||||
source $plumbing_dir/envs/00_base_prefix.env
|
||||
source $plumbing_dir/envs/01_release_root.env
|
||||
log "... done"
|
||||
|
||||
# move to final destination
|
||||
log "move release root to final destination at:"
|
||||
log " $HLRS_SOFTWARE_STACK_RELEASE_ROOT"
|
||||
final_release_root=$(create_dir $HLRS_SOFTWARE_STACK_RELEASE_ROOT)
|
||||
## TODO: check dir above; refuse to overwrite
|
||||
mv $staging_release_root/{*,.git} $final_release_root
|
||||
|
||||
|
||||
## TODO: remove staging dir
|
||||
|
|
Loading…
Reference in a new issue