From 772b3f0547136d44a18fd4a4d1e1f5b10996dc22 Mon Sep 17 00:00:00 2001
From: Neves-P
Date: Sun, 1 Dec 2024 10:30:18 +0100
Subject: [PATCH 1/6] Handle longer dev.eessi.io prefix in ingestion
---
scripts/ingest-tarball.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh
index e6f1321..e4f3e0a 100755
--- a/scripts/ingest-tarball.sh
+++ b/scripts/ingest-tarball.sh
@@ -258,7 +258,12 @@ 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=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2)
+# Handle longer prefix with project name in dev.eessi.io
+if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
+ tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f3)
+else
+ tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2)
+fi
# Check if we are running as the CVMFS repo owner, otherwise run cvmfs_server with sudo
is_repo_owner || cvmfs_server="sudo cvmfs_server"
From 857a339dcfb5d85c4584376015ecf56b4ec3bf7a Mon Sep 17 00:00:00 2001
From: Neves-P
Date: Mon, 2 Dec 2024 09:29:57 +0100
Subject: [PATCH 2/6] Also handle longer prefix in OS and arch checks
---
scripts/ingest-tarball.sh | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh
index e4f3e0a..7d1cacc 100755
--- a/scripts/ingest-tarball.sh
+++ b/scripts/ingest-tarball.sh
@@ -143,7 +143,13 @@ function cvmfs_ingest_tarball() {
function check_os() {
# Check if the operating system directory is correctly set for the contents of the tarball
- os=$(echo "${tar_first_file}" | cut -d / -f 3)
+ # Handle longer prefix in dev.eessi.io
+ if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
+ os=$(echo "${tar_first_file}" | cut -d / -f 4)
+ else
+ os=$(echo "${tar_first_file}" | cut -d / -f 3)
+ fi
+
if [ -z "${os}" ]
then
error "no operating system directory found in the tarball!"
@@ -156,7 +162,13 @@ function check_os() {
function check_arch() {
# Check if the architecture directory is correctly set for the contents of the tarball
- arch=$(echo "${tar_first_file}" | cut -d / -f 4)
+ # Handle longer prefix in dev.eessi.io
+ if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
+ arch=$(echo "${tar_first_file}" | cut -d / -f 5)
+ else
+ arch=$(echo "${tar_first_file}" | cut -d / -f 4)
+ fi
+
if [ -z "${arch}" ]
then
error "no architecture directory found in the tarball!"
@@ -239,7 +251,7 @@ if [ "$#" -ne 2 ]; then
error "usage: $0 "
fi
-cvmfs_repo="$1"
+export cvmfs_repo="$1"
tar_file="$2"
# Check if the CVMFS repository exists
From 13f5479c0a2e68848f4702c0bde8cb45e5f98fe3 Mon Sep 17 00:00:00 2001
From: Neves-P
Date: Mon, 2 Dec 2024 09:39:04 +0100
Subject: [PATCH 3/6] Revert changes in favour of @bedroge's suggestions
---
scripts/ingest-tarball.sh | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh
index 7d1cacc..559954f 100755
--- a/scripts/ingest-tarball.sh
+++ b/scripts/ingest-tarball.sh
@@ -143,13 +143,6 @@ function cvmfs_ingest_tarball() {
function check_os() {
# Check if the operating system directory is correctly set for the contents of the tarball
- # Handle longer prefix in dev.eessi.io
- if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
- os=$(echo "${tar_first_file}" | cut -d / -f 4)
- else
- os=$(echo "${tar_first_file}" | cut -d / -f 3)
- fi
-
if [ -z "${os}" ]
then
error "no operating system directory found in the tarball!"
@@ -162,13 +155,6 @@ function check_os() {
function check_arch() {
# Check if the architecture directory is correctly set for the contents of the tarball
- # Handle longer prefix in dev.eessi.io
- if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
- arch=$(echo "${tar_first_file}" | cut -d / -f 5)
- else
- arch=$(echo "${tar_first_file}" | cut -d / -f 4)
- fi
-
if [ -z "${arch}" ]
then
error "no architecture directory found in the tarball!"
@@ -251,7 +237,7 @@ if [ "$#" -ne 2 ]; then
error "usage: $0 "
fi
-export cvmfs_repo="$1"
+cvmfs_repo="$1"
tar_file="$2"
# Check if the CVMFS repository exists
From 85e520f1435cd3cc96a792c4394aae3482cc37fe Mon Sep 17 00:00:00 2001
From: Pedro Santos Neves <10762799+Neves-P@users.noreply.github.com>
Date: Mon, 2 Dec 2024 09:40:27 +0100
Subject: [PATCH 4/6] Handle different length install paths in checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Bob Dröge
---
scripts/ingest-tarball.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh
index 559954f..f470c54 100755
--- a/scripts/ingest-tarball.sh
+++ b/scripts/ingest-tarball.sh
@@ -258,10 +258,11 @@ tar_first_file=$(tar tf "${tar_file}" | head -n 1)
tar_top_level_dir=$(echo "${tar_first_file}" | cut -d/ -f1)
# Handle longer prefix with project name in dev.eessi.io
if [ "${cvmfs_repo}" = "dev.eessi.io" ]; then
- tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f3)
+ tar_contents_start_level=3
else
- tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f2)
+ tar_contents_start_level=2
fi
+tar_contents_type_dir=$(tar tf "${tar_file}" | head -n 2 | tail -n 1 | cut -d/ -f${tar_contents_start_level})
# Check if we are running as the CVMFS repo owner, otherwise run cvmfs_server with sudo
is_repo_owner || cvmfs_server="sudo cvmfs_server"
From d75e9d93d4776b4465c943acb22218df22e1d595 Mon Sep 17 00:00:00 2001
From: Neves-P
Date: Mon, 2 Dec 2024 09:51:54 +0100
Subject: [PATCH 5/6] Define variable `$os` correctly to check
---
scripts/ingest-tarball.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh
index 559954f..fad2ddd 100755
--- a/scripts/ingest-tarball.sh
+++ b/scripts/ingest-tarball.sh
@@ -143,6 +143,7 @@ function cvmfs_ingest_tarball() {
function check_os() {
# Check if the operating system directory is correctly set for the contents of the tarball
+ os=$(echo "${tar_first_file}" | cut -d / -f $(( $tar_contents_start_level + 1 )))
if [ -z "${os}" ]
then
error "no operating system directory found in the tarball!"
From c267a52d4b37f403d5bde9cc855fd4b09c490fc2 Mon Sep 17 00:00:00 2001
From: Neves-P
Date: Mon, 2 Dec 2024 09:57:09 +0100
Subject: [PATCH 6/6] Define variable `$arch` correctly to check
---
scripts/ingest-tarball.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh
index 91c5ef7..a720840 100755
--- a/scripts/ingest-tarball.sh
+++ b/scripts/ingest-tarball.sh
@@ -156,6 +156,7 @@ function check_os() {
function check_arch() {
# Check if the architecture directory is correctly set for the contents of the tarball
+ arch=$(echo "${tar_first_file}" | cut -d / -f $(( $tar_contents_start_level + 2 )))
if [ -z "${arch}" ]
then
error "no architecture directory found in the tarball!"