From c5c9ea0b9be23887cc56b951fef5b416d1ee2898 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Fri, 22 Nov 2013 16:11:43 -0800 Subject: [PATCH] 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 --- build_library/catalyst.sh | 3 +-- build_library/generate_au_zip.py | 11 +++++++---- common.sh | 7 ++++++- tag_release | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/build_library/catalyst.sh b/build_library/catalyst.sh index 8d53a23863..600a9eff26 100644 --- a/build_library/catalyst.sh +++ b/build_library/catalyst.sh @@ -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}" diff --git a/build_library/generate_au_zip.py b/build_library/generate_au_zip.py index 9dc24d1fb4..249cda43ff 100755 --- a/build_library/generate_au_zip.py +++ b/build_library/generate_au_zip.py @@ -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', diff --git a/common.sh b/common.sh index b1cba1c95f..0e6242a72a 100644 --- a/common.sh +++ b/common.sh @@ -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 diff --git a/tag_release b/tag_release index 8552704008..4fd5ec6b83 100755 --- a/tag_release +++ b/tag_release @@ -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.