From 9557b5ca946c1daeb8d62d1244ec850a0fc552e9 Mon Sep 17 00:00:00 2001 From: Scott Little Date: Thu, 3 Aug 2023 10:40:06 -0400 Subject: [PATCH] Fix download of lower layer rpms A recent change to centralize the conversion of URL to CENGN mirror URL was converting some URL's incorrectly. It should not convert a URL that is already a CENGN url. Closes-bug: 2029499 Signed-off-by: Scott Little Change-Id: I0ff68c366646a912ed330c8bf1733db020ef517b --- centos-mirror-tools/url_utils.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/centos-mirror-tools/url_utils.sh b/centos-mirror-tools/url_utils.sh index 3122d033..fe6b1520 100755 --- a/centos-mirror-tools/url_utils.sh +++ b/centos-mirror-tools/url_utils.sh @@ -239,6 +239,12 @@ CENGN_HOST="mirror.starlingx.cengn.ca" CENGN_PORT="80" CENGN_URL_ROOT="mirror" +to_regex () { + # Currently only care about one case + # convert '.' to '[.]' + echo $1 | sed 's#[.]#[.]#g' +} + url_to_stx_mirror_url () { local URL="$1" local DISTRO="$2" @@ -250,6 +256,11 @@ url_to_stx_mirror_url () { return 1 fi + if [[ ${URL} =~ $(to_regex ${CENGN_HOST}) ]]; then + echo "${URL}" + return 0 + fi + FS_PATH="$(repo_url_to_sub_path "$URL")" if [ $? -ne 0 ]; then >&2 echo "Error: $FUNCNAME (${LINENO}): repo_url_to_sub_path '$URL'"