From 4147cfa1baec81aa36fb4ad29f527f0992e0d219 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 2 Jul 2013 15:05:10 -0400 Subject: [PATCH] fix(coreos): Get version from manifest, export COREOS_ names The version will now be tracked in the manifest so the old coreos_version.sh needs to source it from there. Also export variables with a COREOS_ prefix in addition to CHROMEOS_ since the latter name isn't really correct. This is particularly true for the data published via lsb_release. --- .../coreos/config/coreos_version.sh | 49 ++++++++++++++----- .../coreos/scripts/cros_set_lsb_release | 7 +++ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/config/coreos_version.sh b/sdk_container/src/third_party/coreos-overlay/coreos/config/coreos_version.sh index caaba1ce47..e5a7b785c8 100755 --- a/sdk_container/src/third_party/coreos-overlay/coreos/config/coreos_version.sh +++ b/sdk_container/src/third_party/coreos-overlay/coreos/config/coreos_version.sh @@ -4,7 +4,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# ChromeOS version information +# CoreOS version information # # This file is usually sourced by other build scripts, but can be run # directly to see what it would do. @@ -14,39 +14,64 @@ ############################################################################# # Release Build number. # Increment by 1 for every release build. -export CHROMEOS_BUILD=3659 +# COREOS_BUILD=0000 # Release Branch number. # Increment by 1 for every release build on a branch. # Reset to 0 when increasing release build number. -export CHROMEOS_BRANCH=0 +# COREOS_BRANCH=0 # Patch number. # Increment by 1 in case a non-scheduled branch release build is necessary. # Reset to 0 when increasing branch number. -export CHROMEOS_PATCH=0 +# COREOS_PATCH=0 + +# Source COREOS_* from manifest +VERSION_FILE="${GCLIENT_ROOT:-/mnt/host/source}/.repo/manifests/version.txt" +if [ ! -f "$VERSION_FILE" ]; then + echo "$VERSION_FILE does not exist!" >&2 + exit 1 +fi + +source "$VERSION_FILE" +if [ -z "$COREOS_BUILD" ] || \ + [ -z "$COREOS_BRANCH" ] || \ + [ -z "$COREOS_PATCH" ] +then + echo "$VERSION_FILE is invalid!" >&2 + exit 1 +fi + +export COREOS_BUILD COREOS_BRANCH COREOS_PATCH +export CHROMEOS_BUILD=${COREOS_BUILD} +export CHROMEOS_BRANCH=${COREOS_BRANCH} +export CHROMEOS_PATCH=${COREOS_PATCH} # Major version for Chrome. +# TODO(marineam): expunge this one... export CHROME_BRANCH=26 -# Official builds must set CHROMEOS_OFFICIAL=1. -if [ ${CHROMEOS_OFFICIAL:-0} -ne 1 ] && [ "${USER}" != "chrome-bot" ]; then +# Official builds must set COREOS_OFFICIAL=1 or CHROMEOS_OFFICIAL=1. +: ${COREOS_OFFICIAL:=${CHROMEOS_OFFICIAL}} +if [ ${COREOS_OFFICIAL:-0} -ne 1 ]; then # For developer builds, overwrite CHROMEOS_VERSION_PATCH with a date string # for use by auto-updater. - export CHROMEOS_PATCH=$(date +%Y_%m_%d_%H%M) + export COREOS_PATCH=$(date +%Y_%m_%d_%H%M) + export CHROMEOS_PATCH=${COREOS_PATCH} fi # Version string. Not indentied to appease bash. -export CHROMEOS_VERSION_STRING=\ -"${CHROMEOS_BUILD}.${CHROMEOS_BRANCH}"\ -".${CHROMEOS_PATCH}" +export COREOS_VERSION_STRING=\ +"${COREOS_BUILD}.${COREOS_BRANCH}"\ +".${COREOS_PATCH}" +export CHROMEOS_VERSION_STRING="${COREOS_VERSION_STRING}" # Set CHROME values (Used for releases) to pass to chromeos-chrome-bin ebuild # URL to chrome archive +# TODO(marineam): expunge these too... export CHROME_BASE= # export CHROME_VERSION from incoming value or NULL and let ebuild default export CHROME_VERSION="$CHROME_VERSION" # Print (and remember) version info. -echo "ChromeOS version information:" -env | egrep '^CHROMEOS_VERSION|CHROME_' | sed 's/^/ /' +echo "CoreOS version: ${COREOS_VERSION_STRING}" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/scripts/cros_set_lsb_release b/sdk_container/src/third_party/coreos-overlay/coreos/scripts/cros_set_lsb_release index 6f57be16b9..00c12466a0 100755 --- a/sdk_container/src/third_party/coreos-overlay/coreos/scripts/cros_set_lsb_release +++ b/sdk_container/src/third_party/coreos-overlay/coreos/scripts/cros_set_lsb_release @@ -67,6 +67,13 @@ fi # TODO(skrul): Remove GOOGLE_RELEASE once Chromium is updated to look at # CHROMEOS_RELEASE_VERSION for UserAgent data. sudo_append "${ROOT_FS_DIR}/etc/lsb-release" <