Skip to content
Merged
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
2 changes: 1 addition & 1 deletion scripts/ingest-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ version=$(echo "${tar_file_basename}" | cut -d- -f2)
contents_type_dir=$(echo "${tar_file_basename}" | cut -d- -f3)
tar_first_file=$(tar tf "${tar_file}" | head -n 1)
tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1)
tar_contents_type_dir=$(echo "${tar_first_file}" | head -n 2 | tail -n 1 | cut -d/ -f2)
tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo ${tar_first_file} | head -n 2 doesn't make much sense, since ${tar_first_file} is guaranteed to only be a single line

For compat layer tarball, this happens to work:

$ tar tf eessi-2023.06-compat-linux-aarch64-1686750806.tar.gz | head -n 1
2023.06/compat/linux/aarch64/
$ tar tf eessi-2023.06-compat-linux-aarch64-1686750806.tar.gz | head -n 1 | head -n 2 | tail -n 1 | cut -d/ -f2
compat

Likewise for software tarballs:

$ tar tf eessi-2023.06-software-linux-aarch64-neoverse_n1-1687302831.tar.tar | head -n 1
2023.06/software/linux/aarch64/neoverse_n1/.lmod/lmodrc.lua
$ tar tf eessi-2023.06-software-linux-aarch64-neoverse_n1-1687302831.tar.tar | head -n 1 | head -n 2 | tail -n 1 | cut -d/ -f2
software

Doesn't work for init tarball created with create_directory_tarballs though:

$ tar tf eessi-2023.06-init-1687437311.tar.gz | head -n 1
2023.06/
[$ tar tf eessi-2023.06-init-1687437311.tar.gz | head -n 1 | head -n 2 | tail -n 1 | cut -d/ -f2

With the fix, it does work fine:

$ tar tf eessi-2023.06-init-1687437311.tar.gz | head -n 2 | tail -n 1 | cut -d/ -f2
init
$ tar tf eessi-2023.06-software-linux-aarch64-neoverse_n1-1687302831.tar.tar | head -n 2 | tail -n 1 | cut -d/ -f2
software
$ tar tf eessi-2023.06-compat-linux-aarch64-1686750806.tar.gz | head -n 2 | tail -n 1 | cut -d/ -f2
compat

Although avoiding the double use of tar tf makes sense, it doesn't matter too much, since it's a quick operation, even for large tarballs.


# Do some checks, and ingest the tarball
check_repo_vars
Expand Down