Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 6 additions & 3 deletions scripts/ingest-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ function check_version() {
error "${version} is not a valid EESSI version."
fi

# Check if the version encoded in the filename matches the top-level dir inside the tarball
if [ "${version}" != "${tar_top_level_dir}" ]
# Cut off any suffix from the top-level directory name (which should correspond to the version)
unsuffixed_tar_top_level_dir=$(echo ${tar_top_level_dir} | sed -E 's/-[0-9A-Za-z._-]+//')

# Check if the version encoded in the filename matches the unsuffixed top-level dir inside the tarball
if [ "${version}" != "${unsuffixed_tar_top_level_dir}" ]
then
error "the version in the filename (${version}) does not match the top-level directory in the tarball (${tar_top_level_dir})."
error "the version in the filename (${version}) does not match the (unsuffixed) top-level directory in the tarball (${unsuffixed_tar_top_level_dir})."
fi
}

Expand Down
5 changes: 5 additions & 0 deletions scripts/test-ingest-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ tarballs_success=(
"$tstdir/eessi-2000.01-scripts-123456.tar.gz 2000.01 scripts"
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01 software/linux/x86_64/intel/haswell"
"$tstdir/eessi-2000.01-software-123456.tar.zst 2000.01 software/linux/x86_64/intel/haswell"
# Version suffixes inside the tarball are allowed if they match: -[0-9A-Za-z._-]+
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01-001 software/linux/x86_64/intel/haswell"
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01-20250101-001-abc software/linux/x86_64/intel/haswell"
)

# Test that should return an error
Expand Down Expand Up @@ -92,6 +95,8 @@ tarballs_fail=(
# Invalid compression / file extension
"$tstdir/eessi-2000.01-software-123456.tar 2000.01 software/linux/x86_64/intel/haswell"
"$tstdir/eessi-2000.01-software-123456.tar.xz 2000.01 software/linux/x86_64/intel/haswell"
# Invalid version suffix in the tarball
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01#001 software/linux/x86_64/intel/haswell"
)

# update_lmod_caches.sh script requires that directory exists,
Expand Down
Loading