Skip to content

Commit b017c81

Browse files
authored
Merge pull request #261 from bedroge/tarball_accept_versionsuffix
Accept version suffix in top-level directory name inside tarballs
2 parents a87c847 + fefe69e commit b017c81

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/ingest-tarball.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ function check_version() {
8080
error "${version} is not a valid EESSI version."
8181
fi
8282

83-
# Check if the version encoded in the filename matches the top-level dir inside the tarball
84-
if [ "${version}" != "${tar_top_level_dir}" ]
83+
# Cut off any suffix from the top-level directory name (which should correspond to the version)
84+
unsuffixed_tar_top_level_dir=$(echo ${tar_top_level_dir} | sed -E 's/-[0-9A-Za-z._-]+$//')
85+
86+
# Check if the version encoded in the filename matches the unsuffixed top-level dir inside the tarball
87+
if [ "${version}" != "${unsuffixed_tar_top_level_dir}" ]
8588
then
86-
error "the version in the filename (${version}) does not match the top-level directory in the tarball (${tar_top_level_dir})."
89+
error "the version in the filename (${version}) does not match the (unsuffixed) top-level directory in the tarball (${unsuffixed_tar_top_level_dir})."
8790
fi
8891
}
8992

scripts/test-ingest-tarball.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ tarballs_success=(
5757
"$tstdir/eessi-2000.01-scripts-123456.tar.gz 2000.01 scripts"
5858
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01 software/linux/x86_64/intel/haswell"
5959
"$tstdir/eessi-2000.01-software-123456.tar.zst 2000.01 software/linux/x86_64/intel/haswell"
60+
# Version suffixes inside the tarball are allowed if they match: -[0-9A-Za-z._-]+
61+
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01-001 software/linux/x86_64/intel/haswell"
62+
"$tstdir/eessi-2000.01-software-123456.tar.gz 2000.01-20250101-001-abc software/linux/x86_64/intel/haswell"
6063
)
6164

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

97102
# update_lmod_caches.sh script requires that directory exists,

0 commit comments

Comments
 (0)