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.
This commit is contained in:
Michael Marineau 2013-07-02 15:05:10 -04:00
parent da64347a48
commit 4147cfa1ba
2 changed files with 44 additions and 12 deletions

View File

@ -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}"

View File

@ -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" <<EOF
COREOS_RELEASE_BOARD=$FLAGS_board
COREOS_RELEASE_DESCRIPTION=$CHROMEOS_VERSION_DESCRIPTION
COREOS_RELEASE_NAME=$CHROMEOS_VERSION_NAME
COREOS_RELEASE_TRACK=$CHROMEOS_VERSION_TRACK
COREOS_RELEASE_VERSION=$CHROMEOS_VERSION_STRING
COREOS_AUSERVER=$CHROMEOS_VERSION_AUSERVER
COREOS_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER
CHROMEOS_RELEASE_BOARD=$FLAGS_board
CHROMEOS_RELEASE_DESCRIPTION=$CHROMEOS_VERSION_DESCRIPTION
CHROMEOS_RELEASE_NAME=$CHROMEOS_VERSION_NAME