X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fbash%2Ffunction%2Fartifacts.sh;h=fc9c886a3b0909697245e17891763acd6034cc96;hb=cac8f76ce1f9085e9eede19b250f4a4cb9b199e0;hp=04db2d00697b5200ecea4c06f5db12f3e2ffe7f3;hpb=fe7c90f5cc1cff7b4fedab81adb7ae77a920087f;p=csit.git diff --git a/resources/libraries/bash/function/artifacts.sh b/resources/libraries/bash/function/artifacts.sh index 04db2d0069..fc9c886a3b 100644 --- a/resources/libraries/bash/function/artifacts.sh +++ b/resources/libraries/bash/function/artifacts.sh @@ -65,28 +65,30 @@ function download_ubuntu_artifacts () { } # If version is set we will add suffix. artifacts=() - BOTH_QUOTES='"'"'" - MATCH="[^${BOTH_QUOTES}]*" - QMATCH="[${BOTH_QUOTES}]\?" - SED_COMMAND="s#.*apt_source_path=${QMATCH}\(${MATCH}\)${QMATCH}#\1#p" - APT_FDIO_REPO_FILE=$(curl -s "${REPO_URL}"/script.deb.sh | \ - sed -n ${SED_COMMAND}) || { + both_quotes='"'"'" + match="[^${both_quotes}]*" + qmatch="[${both_quotes}]\?" + sed_command="s#.*apt_source_path=${qmatch}\(${match}\)${qmatch}#\1#p" + apt_fdio_repo_file=$(curl -s "${REPO_URL}"/script.deb.sh | \ + sed -n ${sed_command}) || { die "Local fdio repo file path fetch failed." } - if [ ! -f ${APT_FDIO_REPO_FILE} ]; then - die "${APT_FDIO_REPO_FILE} not found, \ + if [ ! -f ${apt_fdio_repo_file} ]; then + die "${apt_fdio_repo_file} not found, \ repository installation was not successful." fi - packages=$(apt-cache -o Dir::Etc::SourceList=${APT_FDIO_REPO_FILE} \ - -o Dir::Etc::SourceParts=${APT_FDIO_REPO_FILE} dumpavail \ + packages=$(apt-cache -o Dir::Etc::SourceList=${apt_fdio_repo_file} \ + -o Dir::Etc::SourceParts=${apt_fdio_repo_file} dumpavail \ | grep Package: | cut -d " " -f 2) || { die "Retrieval of available VPP packages failed." } if [ -z "${VPP_VERSION-}" ]; then # If version is not specified, find out the most recent version - VPP_VERSION=$(apt-cache --no-all-versions show vpp | grep Version: | \ + VPP_VERSION=$(apt-cache -o Dir::Etc::SourceList=${apt_fdio_repo_file} \ + -o Dir::Etc::SourceParts=${apt_fdio_repo_file} \ + --no-all-versions show vpp | grep Version: | \ cut -d " " -f 2) || { die "Retrieval of most recent VPP version failed." } @@ -98,7 +100,7 @@ function download_ubuntu_artifacts () { pkg_info=$(apt-cache show ${package}) || { die "apt-cache show on ${package} failed." } - ver=$(echo ${pkg_info} | grep -o "Version: ${VPP_VERSION-}[^ ]*" \ + ver=$(echo ${pkg_info} | grep -o "Version: ${VPP_VERSION-}[^ ]*" | \ head -1) || true if [ -n "${ver-}" ]; then echo "Found '${VPP_VERSION-}' among '${package}' versions."