@cryptotaxi247 / netdata-1 / commits / 32b031c55

Fix detection of Coverity archive path in scan script. (#18112)

Austin S. Hemmelgarn committed Jul 15, 2024 at 06:56 UTC 32b031c555924917eeaa7ff3f40d479421b39565
1 file changed +8 -21
packaging/utils/coverity-scan.sh
+8 -21
@@ -27,9 +27,6 @@
27 # this includes the token, so the default is not to print it.
28 # COVERITY_SUBMIT_DEBUG=1
29 #
30 -# Override the standard coverity build version we know is supported
31 -# COVERITY_BUILD_VERSION="cov-analysis-linux64-2019.03"
32 -#
30 # All these variables can also be exported before running this script.
31 #
32 # If the first parameter of this script is "install",
@@ -160,30 +157,21 @@ scanit() {
157 }
158
159 installit() {
163 - ORIGINAL_DIR="${PWD}"
160 TMP_DIR="$(mktemp -d /tmp/netdata-coverity-scan-XXXXX)"
161 progress "Downloading coverity in ${TMP_DIR}..."
166 - cd "${TMP_DIR}"
162 + (cd "${TMP_DIR}" && debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64)
163
168 - debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64
164 + COVERITY_ARCHIVE="$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -name 'cov-analysis-linux64-*.tar.gz')"
165
170 - if [ -z "${COVERITY_BUILD_VERSION}" ]; then
171 - COVERITY_ARCHIVE="$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -name 'cov-analysis-linux64-*.tar.gz' | cut -f 2 -d '/' | head -n 1)"
172 - else
173 - COVERITY_ARCHIVE="${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz"
174 - fi
175 -
176 - if [ -f "${COVERITY_ARCHIVE}" ]; then
166 + if [ -n "${COVERITY_ARCHIVE}" ] && [ -f "${COVERITY_ARCHIVE}" ]; then
167 progress "Installing coverity..."
178 - cd "${INSTALL_DIR}"
179 -
180 - run sudo tar -z -x -f "${COVERITY_ARCHIVE}" || exit 1
168 + run sudo tar -z -x -f "${COVERITY_ARCHIVE}" -C "${INSTALL_DIR}"
169 rm -f "${COVERITY_ARCHIVE}"
170 COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*')
183 - export PATH=${PATH}:${COVERITY_PATH}/bin/
184 - elif find . -name "*.tar.gz" > /dev/null 2>&1; then
185 - ls ./*.tar.gz
186 - fatal "Downloaded coverity tool tarball does not appear to be the version we were expecting, exiting."
171 + export PATH="${PATH}:${COVERITY_PATH}/bin/"
172 + elif find "${TMP_DIR}" -name "*.tar.gz" > /dev/null 2>&1; then
173 + ls "${TMP_DIR}"/*.tar.gz
174 + fatal "Downloaded coverity tool tarball does not appear to be the file-name we were expecting, exiting."
175 else
176 fatal "Failed to download coverity tool tarball!"
177 fi
@@ -195,7 +183,6 @@ installit() {
183 fi
184
185 progress "Coverity scan tools are installed."
198 - cd "$ORIGINAL_DIR"
186
187 # Clean temp directory
188 [ -n "${TMP_DIR}" ] && rm -rf "${TMP_DIR}"