From bd273c75644a82c7a2f66834498edf9079bdedd6 Mon Sep 17 00:00:00 2001 From: Jose Gracia Date: Tue, 12 Nov 2024 09:45:20 +0100 Subject: [PATCH] Make populate release script independent of any other --- .../scripts/xx_populate_release_directory.sh | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/hlrs-plumbing/scripts/xx_populate_release_directory.sh b/hlrs-plumbing/scripts/xx_populate_release_directory.sh index 1d5e0c0..49afb85 100755 --- a/hlrs-plumbing/scripts/xx_populate_release_directory.sh +++ b/hlrs-plumbing/scripts/xx_populate_release_directory.sh @@ -6,7 +6,10 @@ # - release_tag: tag/branch/commit in repo # - base_prefix: prefix to base directory for softweare installation; e.g. /opt/hlrs # -# Environment variables: $TMPDIR must be set +# Environment variables: +# - $TMPDIR must be set +# - $HLRS_REPO_LOCATION, if given, will override the location of various repositories. +# If not given, it defaults to "https://code.hlr.de/hlrs-software-stack" # # # Release directory structure: @@ -59,6 +62,20 @@ create_dir () { echo $rc } +checkout_repo_inplace () { + local repo=$1 + local tag=$2 + local dir=$3 + local err + + pushd $dir > /dev/null + git clone --depth=1 --single-branch --branch=$tag -c feature.manyFiles=true $repo . + err=$? + popd > /dev/null + + return $err +} + _VERBOSITY=1 @@ -76,22 +93,22 @@ arg_tag=$(canonize_tag $1) arg_prefix=$2 # Define various repo locations -_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 +HLRS_REPO_LOCATION=${HLRS_REPO_LOCATION:-https://code.hlrs.de/hlrs-software-stack} +_HLRS_SPACK_REPO=${HLRS_REPO_LOCATION}/spack +_HLRS_SPACK_PLUMBING_REPO=${HLRS_REPO_LOCATION}/release_root +_HLRS_SPACK_CONFIG_REPO=${HLRS_REPO_LOCATION}/hlrs-spack # bootstrap staging area log "setup staging area at:" tmp_dir=$(mktemp -d) -staging_dir=$tmp_dir/staging +staging_dir=$tmp_dir/staging +mkdir -p $staging_dir 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 . +checkout_repo_inplace $_HLRS_SPACK_PLUMBING_REPO $arg_tag $staging_dir plumbing_dir=$staging_dir/hlrs-plumbing log "... done"