Populate staging area and relocate to release root
This commit is contained in:
parent
5bf6349a64
commit
8c890b97e8
1 changed files with 71 additions and 38 deletions
|
@ -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 () {
|
log () {
|
||||||
local msg=$1
|
local msg=$1
|
||||||
if [[ -n $_VERBOSITY ]]; then
|
if [[ -n $_VERBOSITY ]]; then
|
||||||
echo $msg
|
echo "### $msg"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,42 +60,88 @@ create_dir () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# process input arguments
|
_VERBOSITY=1
|
||||||
HLRS_SOFTWARE_STACK_RELEASE_VERSION__USER=$(canonize_tag $arg_tag)
|
|
||||||
HLRS_OPT_PREFIX__USER=$(create_dir $arg_prefix)
|
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
|
# Define various repo locations
|
||||||
_HLRS_SPACK_REPO=file://$HOME/spack-test/dummy_repo/spack-v0.21.2.git
|
_HLRS_SPACK_REPO=file://$HOME/spack-test/dummy_repo/spack.git
|
||||||
_HLRS_SPACK_PLUMBING_REPO=file://$HOME/spack-test/dummy_repo/software-stack-plumbing.git
|
_HLRS_SPACK_PLUMBING_REPO=file://$HOME/spack-test/dummy_repo/release_root.git
|
||||||
_HLRS_SPACK_CONFIG_REPO=file://$HOME/spack-test/dummy_repo/software-stack-hlrs-spack.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
|
# bootstrap staging area
|
||||||
log "### setup plumbing directory"
|
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 | \
|
curl -L $_HLRS_SPACK_PLUMBING_REPO/hlrs-plumbing/scripts/xx_checkout_repo.sh | \
|
||||||
bash -s -- $_HLRS_SPACK_PLUMBING_REPO \
|
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_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
|
# setup hlrs-spack directory
|
||||||
log "### setup hlrs-spack directory"
|
log "setup hlrs-spack directory ..."
|
||||||
$_HLRS_PLUMBING_DIR/scripts/xx_checkout_repo.sh $_HLRS_SPACK_CONFIG_REPO \
|
$plumbing_dir/scripts/xx_checkout_repo.sh $_HLRS_SPACK_CONFIG_REPO \
|
||||||
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_RELEASE_ROOT hlrs-spack
|
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_RELEASE_ROOT hlrs-spack
|
||||||
log "### ... done"
|
log "... done"
|
||||||
|
|
||||||
# setup $SPACK_ROOT directory
|
# setup $SPACK_ROOT directory
|
||||||
log "### setup $SPACK_ROOT directory"
|
log "setup $SPACK_ROOT directory ..."
|
||||||
$_HLRS_PLUMBING_DIR/scripts/xx_checkout_repo.sh $_HLRS_SPACK_REPO \
|
$plumbing_dir/scripts/xx_checkout_repo.sh $_HLRS_SPACK_REPO \
|
||||||
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_HLRS_SPACK_ROOT spack
|
$HLRS_SOFTWARE_STACK_RELEASE_VERSION $HLRS_SOFTWARE_STACK_HLRS_SPACK_ROOT spack
|
||||||
log "### ... done"
|
log "... done"
|
||||||
|
|
||||||
# setup opt-non-spack
|
# setup opt-non-spack
|
||||||
# TODO
|
# 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