From 4197e20a7da37a331854cec96c7e1cfbf6e0ee1c Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 16 Oct 2019 14:14:13 +0200 Subject: [PATCH] Remove imagebuild/common, it's not longer used by IPA-builder Change-Id: Ia21690955b25b233a7b2e861abb5ac02653099f6 Depends-On: https://review.opendev.org/688911 --- .../extract_upper_constraints_from_tox_ini.sh | 9 -- .../common/generate_upper_constraints.sh | 87 ------------------- 2 files changed, 96 deletions(-) delete mode 100755 imagebuild/common/extract_upper_constraints_from_tox_ini.sh delete mode 100755 imagebuild/common/generate_upper_constraints.sh diff --git a/imagebuild/common/extract_upper_constraints_from_tox_ini.sh b/imagebuild/common/extract_upper_constraints_from_tox_ini.sh deleted file mode 100755 index 86bd99733..000000000 --- a/imagebuild/common/extract_upper_constraints_from_tox_ini.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# NOTE(mmitchell): This extracts the URL defined as the default value for -# UPPER_CONSTRAINTS_FILE in tox.ini. This is used by image -# builders to avoid duplicating the default value in multiple -# scripts. This is specially done to leverage the release -# tools that automatically update the tox.ini when projects -# are released. -sed -n 's/^.*{env:UPPER_CONSTRAINTS_FILE\:\([^}]*\)}.*$/\1/p' $1 | head -n1 - diff --git a/imagebuild/common/generate_upper_constraints.sh b/imagebuild/common/generate_upper_constraints.sh deleted file mode 100755 index e1192d996..000000000 --- a/imagebuild/common/generate_upper_constraints.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -eu - -SCRIPT_NAME=$(basename $0) -COMMON_ROOT=$(dirname $0) -DESTINATION="$1" -TOX_INI_UPPER_CONSTRAINT_URL="$(${COMMON_ROOT}/extract_upper_constraints_from_tox_ini.sh ${COMMON_ROOT}/../../tox.ini)" - -copy() { - local src=$1 - local destination=$2 - - if test -z "${src}"; then - return 1 - fi - - if test -e "${src}"; then - log "File '${src}' exists. Using as upper-constraints." - cp "${src}" "${destination}" - else - log "File '${src}' not found. Skipping local file strategy." - return 1 - fi - return 0 -} - -download() { - local url=$1 - local destination=$2 - - if test -z "${url}"; then - return 1 - else - log "Downloading from '${url}'" - curl -L ${url} -o "${destination}" - fi - return 0 -} - -log() { - echo "${SCRIPT_NAME}: ${@}" -} - -fail() { - log ${@} - exit 1 -} - -upper_constraints_is_not_null() { - test "${UPPER_CONSTRAINTS_FILE:-""}" != "" -} - -copy_uc() { - copy "${UPPER_CONSTRAINTS_FILE:-""}" "${DESTINATION}" -} - -download_uc() { - download "${UPPER_CONSTRAINTS_FILE:-""}" "${DESTINATION}" -} - -copy_new_requirements_uc() { - if [ -e "/opt/stack/new/requirements" ]; then - copy "/opt/stack/new/requirements/upper-constraints.txt" "${DESTINATION}" - elif [ -e "/opt/stack/requirements" ]; then - copy "/opt/stack/requirements/upper-constraints.txt" "${DESTINATION}" - else - log "No local requirements repository, will download upper-constraints" - # Allow the caller to handle the failure - return 1 - fi -} - -download_from_tox_ini_url() { - log "tox.ini indicates '${TOX_INI_UPPER_CONSTRAINT_URL}' as fallback." - download "${TOX_INI_UPPER_CONSTRAINT_URL}" "${DESTINATION}" -} - -log "Generating local constraints file..." - -if upper_constraints_is_not_null; then - log "UPPER_CONSTRAINTS_FILE is defined as '${UPPER_CONSTRAINTS_FILE:-""}'" - copy_uc || download_uc || fail "Failed to copy or download file indicated in UPPER_CONSTRAINTS_FILE." -else - log "UPPER_CONSTRAINTS_FILE is not defined. Using fallback strategies." - - copy_new_requirements_uc || \ - download_from_tox_ini_url || fail "Failed to download upper-constraints.txt from '${TOX_INI_UPPER_CONSTRAINT_URL}'." -fi