Skip to content

Commit

Permalink
update create_tarball.sh script to make it aware of installations in …
Browse files Browse the repository at this point in the history
…accel/ subdirectory
  • Loading branch information
boegel committed Sep 17, 2024
1 parent 8d0085c commit 025ff29
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
2 changes: 0 additions & 2 deletions EESSI-install-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ else
done
fi

### add packages here

echo ">> Creating/updating Lmod RC file..."
export LMOD_CONFIG_DIR="${EASYBUILD_INSTALLPATH}/.lmod"
lmod_rc_file="$LMOD_CONFIG_DIR/lmodrc.lua"
Expand Down
4 changes: 2 additions & 2 deletions bot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ export TGZ=$(printf "eessi-%s-software-%s-%s-%d.tar.gz" ${EESSI_VERSION} ${EESSI
TMP_IN_CONTAINER=/tmp
echo "Executing command to create tarball:"
echo "./eessi_container.sh ${COMMON_ARGS[@]} ${TARBALL_STEP_ARGS[@]}"
echo " -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}"
echo " -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} \"${EESSI_ACCELERATOR_TARGET}\" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}"
./eessi_container.sh "${COMMON_ARGS[@]}" "${TARBALL_STEP_ARGS[@]}" \
-- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}
-- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} "${EESSI_ACCELERATOR_TARGET}" /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}

exit 0
57 changes: 31 additions & 26 deletions create_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ set -e
base_dir=$(dirname $(realpath $0))

if [ $# -ne 4 ]; then
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <version (example: 2023.06)> <CPU arch subdir (example: x86_64/amd/zen2)> <path to tarball>" >&2
echo "ERROR: Usage: $0 <EESSI tmp dir (example: /tmp/$USER/EESSI)> <version (example: 2023.06)> <CPU arch subdir (example: x86_64/amd/zen2)> <accelerator subdir (example: nvidia/cc80)> <path to tarball>" >&2
exit 1
fi
eessi_tmpdir=$1
eessi_version=$2
cpu_arch_subdir=$3
target_tgz=$4
accel_subdir=$4
target_tgz=$5

tmpdir=`mktemp -d`
echo ">> tmpdir: $tmpdir"
Expand Down Expand Up @@ -57,30 +58,34 @@ if [ -d ${eessi_version}/init ]; then
find ${eessi_version}/init -type f | grep -v '/\.wh\.' >> ${files_list}
fi

if [ -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules ]; then
# module files
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list}
# module symlinks
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list}
# module files and symlinks
find ${eessi_version}/software/${os}/${cpu_arch_subdir}/modules/all -type f -o -type l \
| grep -v '/\.wh\.' | grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
>> ${module_files_list}
fi

if [ -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/software -a -r ${module_files_list} ]; then
# installation directories but only those for which module files were created
# Note, we assume that module names (as defined by 'PACKAGE_NAME/VERSION.lua'
# using EasyBuild's standard module naming scheme) match the name of the
# software installation directory (expected to be 'PACKAGE_NAME/VERSION/').
# If either side changes (module naming scheme or naming of software
# installation directories), the procedure will likely not work.
for package_version in $(cat ${module_files_list}); do
echo "handling ${package_version}"
ls -d ${eessi_version}/software/${os}/${cpu_arch_subdir}/software/${package_version} \
| grep -v '/\.wh\.' >> ${files_list}
done
fi
# consider both CPU-only and accelerator subdirectories
for subdir in ${cpu_arch_subdir} ${cpu_arch_subdir}/accel/${accel_subdir}; do

if [ -d ${eessi_version}/software/${os}/${subdir}/modules ]; then
# module files
find ${eessi_version}/software/${os}/${subdir}/modules -type f | grep -v '/\.wh\.' >> ${files_list}
# module symlinks
find ${eessi_version}/software/${os}/${subdir}/modules -type l | grep -v '/\.wh\.' >> ${files_list}
# module files and symlinks
find ${eessi_version}/software/${os}/${subdir}/modules/all -type f -o -type l \
| grep -v '/\.wh\.' | grep -v '/\.modulerc\.lua' | sed -e 's/.lua$//' | sed -e 's@.*/modules/all/@@g' | sort -u \
>> ${module_files_list}
fi

if [ -d ${eessi_version}/software/${os}/${subdir}/software -a -r ${module_files_list} ]; then
# installation directories but only those for which module files were created
# Note, we assume that module names (as defined by 'PACKAGE_NAME/VERSION.lua'
# using EasyBuild's standard module naming scheme) match the name of the
# software installation directory (expected to be 'PACKAGE_NAME/VERSION/').
# If either side changes (module naming scheme or naming of software
# installation directories), the procedure will likely not work.
for package_version in $(cat ${module_files_list}); do
echo "handling ${package_version}"
ls -d ${eessi_version}/software/${os}/${subdir}/software/${package_version} \
| grep -v '/\.wh\.' >> ${files_list}
done
fi
done

# add a bit debug output
echo "wrote file list to ${files_list}"
Expand Down

0 comments on commit 025ff29

Please sign in to comment.