Skip to content

Commit d7f1d4f

Browse files
authored
Merge pull request #259 from bedroge/ingest_mixed_tarball
Add fix for ingesting mixed tarballs
2 parents fd73ab5 + b03c328 commit d7f1d4f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/ingest-tarball.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,13 @@ fi
286286
tar_file_basename=$(basename "${tar_file}")
287287
version=$(echo "${tar_file_basename}" | cut -d- -f2)
288288
contents_type_dir=$(echo "${tar_file_basename}" | cut -d- -f3)
289-
tar_first_file=$(tar tf "${tar_file}" | head -n 1)
289+
# find the first file in the tarball that corresponds to $contents_type_dir,
290+
# e.g. the first file that actually belongs to the software layer for software tarballs
291+
# (and, hence, skip other files, like init scripts)
292+
tar_first_file=$(tar tf "${tar_file}" | grep -m 1 "/${contents_type_dir}/")
293+
if [ -z ${tar_first_file} ]; then
294+
tar_first_file=$(tar tf "${tar_file}" | head -n 1)
295+
fi
290296
tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1)
291297
# Handle longer prefix with project name in dev.eessi.io and
292298
# get the right basedir from the tarball name

0 commit comments

Comments
 (0)