Skip to content

Commit b72e65a

Browse files
authored
Merge pull request #203 from Neves-P/fix/dev.eessi.io-prefix
Handle longer `dev.eessi.io` prefix in ingestion
2 parents a5b099d + c267a52 commit b72e65a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/ingest-tarball.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function cvmfs_ingest_tarball() {
143143

144144
function check_os() {
145145
# Check if the operating system directory is correctly set for the contents of the tarball
146-
os=$(echo "${tar_first_file}" | cut -d / -f 3)
146+
os=$(echo "${tar_first_file}" | cut -d / -f $(( $tar_contents_start_level + 1 )))
147147
if [ -z "${os}" ]
148148
then
149149
error "no operating system directory found in the tarball!"
@@ -156,7 +156,7 @@ function check_os() {
156156

157157
function check_arch() {
158158
# Check if the architecture directory is correctly set for the contents of the tarball
159-
arch=$(echo "${tar_first_file}" | cut -d / -f 4)
159+
arch=$(echo "${tar_first_file}" | cut -d / -f $(( $tar_contents_start_level + 2 )))
160160
if [ -z "${arch}" ]
161161
then
162162
error "no architecture directory found in the tarball!"
@@ -258,7 +258,13 @@ version=$(echo "${tar_file_basename}" | cut -d- -f2)
258258
contents_type_dir=$(echo "${tar_file_basename}" | cut -d- -f3)
259259
tar_first_file=$(tar tf "${tar_file}" | head -n 1)
260260
tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1)
261-
tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2)
261+
# Handle longer prefix with project name in dev.eessi.io
262+
if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
263+
tar_contents_start_level=3
264+
else
265+
tar_contents_start_level=2
266+
fi
267+
tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f${tar_contents_start_level})
262268

263269
# Check if we are running as the CVMFS repo owner, otherwise run cvmfs_server with sudo
264270
is_repo_owner || cvmfs_server="sudo cvmfs_server"

0 commit comments

Comments
 (0)