fix(common.sh): New variables for .cache and .repo/manfests

A number of places refer to these paths and that number is going to
grow. Since the standard pattern is to use environment variables for
commonly used paths it is time to add ones for these:
REPO_CACHE_DIR
REPO_MANIFESTS_DIR
This commit is contained in:
Michael Marineau 2013-11-22 16:11:43 -08:00
parent bd07dceb60
commit c5c9ea0b9b
4 changed files with 15 additions and 8 deletions

View File

@ -226,8 +226,7 @@ search_for_sdk_seed() {
for check_path in \
"${CATALYST_ROOT}/builds/coreos-sdk/${SDK_TARBALL}" \
"${CATALYST_ROOT}/builds/seeds/${SDK_TARBALL}" \
"/var/cache/chromeos-cache/sdks/${SDK_TARBALL}" \
"/mnt/host/source/.cache/sdks/${SDK_TARBALL}"
"${REPO_CACHE_DIR}/sdks/${SDK_TARBALL}" \
do
if [[ -f "${check_path}" ]]; then
info "Using SDK for seed: ${check_path}"

View File

@ -16,13 +16,16 @@ import subprocess
import sys
import tempfile
REPO_MANIFESTS_DIR = os.environ['REPO_MANIFESTS_DIR']
SCRIPTS_DIR = os.environ['SCRIPTS_DIR']
# GLOBALS
STATIC_FILES = ['/usr/bin/old_bins/cgpt',
'/usr/bin/cros_generate_update_payload',
'~/trunk/.repo/manifests/version.txt',
'~/trunk/src/scripts/chromeos-common.sh',
'~/trunk/src/scripts/common.sh',
'~/trunk/src/scripts/core_upload_update',
'%s/version.txt' % REPO_MANIFESTS_DIR,
'%s/chromeos-common.sh' % SCRIPTS_DIR,
'%s/common.sh' % SCRIPTS_DIR,
'%s/core_upload_update' % SCRIPTS_DIR,
]
DYNAMIC_EXECUTABLES = ['/usr/bin/delta_generator',

View File

@ -292,15 +292,20 @@ get_gclient_root
# Note that 'realpath' is equivalent to 'readlink -f'.
SCRIPT_LOCATION=$(readlink -f "${SCRIPT_LOCATION}")
GCLIENT_ROOT=$(readlink -f "${GCLIENT_ROOT}")
# TODO(marineam): I'm tempted to deprecate GCLIENT_ROOT, this isn't Google
# and even if it was the source is managed by 'repo', not 'gclient'
REPO_ROOT="${GCLIENT_ROOT}"
# Other directories should always be pathed down from GCLIENT_ROOT.
SRC_ROOT="${GCLIENT_ROOT}/src"
SRC_INTERNAL="${GCLIENT_ROOT}/src-internal"
SCRIPTS_DIR="${SRC_ROOT}/scripts"
BUILD_LIBRARY_DIR="${SCRIPTS_DIR}/build_library"
REPO_CACHE_DIR="${REPO_ROOT}/.cache"
REPO_MANIFESTS_DIR="${REPO_ROOT}/.repo/manifests"
# Source COREOS_* from manifest for version information.
COREOS_VERSION_FILE="${GCLIENT_ROOT}/.repo/manifests/version.txt"
COREOS_VERSION_FILE="${REPO_MANIFESTS_DIR}/version.txt"
if [[ ! -f "${COREOS_VERSION_FILE}" ]]; then
COREOS_VERSION_FILE="${SCRIPT_LOCATION}/version.txt"
fi

View File

@ -27,7 +27,7 @@ switch_to_strict_mode
BRANCH_NAME="build-${FLAGS_build}"
TAG_NAME="v${FLAGS_build}.${FLAGS_branch}.${FLAGS_patch}"
cd "${GCLIENT_ROOT}/.repo/manifests"
cd "${REPO_MANIFESTS_DIR}"
# Clean up existing branch manifest(s) excluding:
# - the current branch if the file already exists.