mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 13:36:58 +02:00
Revert versioning to original (odd=trunk/dev, even=release) style.
Add handling for third type - continuous builds and (label) appropriately.
This commit is contained in:
parent
e90dbc8e59
commit
03aeb20079
@ -25,6 +25,8 @@ DEFINE_string to "$DEFAULT_TO" "Directory of build archive"
|
||||
DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)"
|
||||
DEFINE_string zipname "image.zip" "Name of zip file to create."
|
||||
DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds."
|
||||
DEFINE_string build_number "" \
|
||||
"The build-bot build number (when called by buildbot only)." "b"
|
||||
|
||||
# Parse command line
|
||||
FLAGS "$@" || exit 1
|
||||
@ -41,18 +43,14 @@ fi
|
||||
# Get version information
|
||||
. "${SCRIPTS_DIR}/chromeos_version.sh"
|
||||
|
||||
# Get subversion or git revision
|
||||
REVISION=$(svn info 2>&-| grep "Revision: " | awk '{print $2}')
|
||||
if [ -z "$REVISION" ]
|
||||
then
|
||||
# Use git:8 chars of sha1
|
||||
REVISION=$(git rev-parse HEAD)
|
||||
REVISION=${REVISION:8}
|
||||
fi
|
||||
# Get git hash
|
||||
# Use git:8 chars of sha1
|
||||
REVISION=$(git rev-parse HEAD)
|
||||
REVISION=${REVISION:0:8}
|
||||
|
||||
# Use the version number plus revision as the last change. (Need both, since
|
||||
# trunk builds multiple times with the same version string.)
|
||||
LAST_CHANGE="${CHROMEOS_VERSION_STRING}-r${REVISION}"
|
||||
LAST_CHANGE="${CHROMEOS_VERSION_STRING}-r${REVISION}-b${FLAGS_build_number}"
|
||||
|
||||
# The Chromium buildbot scripts only create a clickable link to the archive
|
||||
# if an output line of the form "last change: XXX" exists
|
||||
|
@ -216,7 +216,7 @@ SERVER2="$MIRROR2_INSIDE"
|
||||
SUITE2="$FLAGS_suite2"
|
||||
EOF
|
||||
# ...and all CHROMEOS_ vars
|
||||
set | grep "^CHROMEOS_" >> $CUST_OPTS
|
||||
set | egrep "^CHROMEOS_|^BUILDBOT_" >> $CUST_OPTS
|
||||
|
||||
# Run the package install script
|
||||
sudo chroot "$ROOT_FS_DIR" \
|
||||
|
@ -12,65 +12,45 @@
|
||||
# Version numbering scheme is much like Chrome's, with the addition of
|
||||
# double-incrementing branch number so trunk is always odd.
|
||||
|
||||
# Sets up a version number for release builds.
|
||||
export_release_version() {
|
||||
# Major/minor versions.
|
||||
# Primarily for product marketing.
|
||||
export CHROMEOS_VERSION_MAJOR=0
|
||||
export CHROMEOS_VERSION_MINOR=5
|
||||
HOSTNAME=$(hostname)
|
||||
#############################################################################
|
||||
# SET VERSION NUMBERS
|
||||
#############################################################################
|
||||
# Major/minor versions.
|
||||
# Primarily for product marketing.
|
||||
export CHROMEOS_VERSION_MAJOR=0
|
||||
export CHROMEOS_VERSION_MINOR=5
|
||||
|
||||
# Branch number.
|
||||
# Increment by 1 in a new release branch.
|
||||
# Increment by 2 in trunk after making a release branch.
|
||||
# Does not reset on a major/minor change (always increases).
|
||||
# (Trunk is always odd; branches are always even).
|
||||
export CHROMEOS_VERSION_BRANCH=23
|
||||
# Major/minor versions.
|
||||
# Primarily for product marketing.
|
||||
export CHROMEOS_VERSION_MAJOR=0
|
||||
export CHROMEOS_VERSION_MINOR=5
|
||||
|
||||
# Patch number.
|
||||
# Increment by 1 each release on a branch.
|
||||
# Reset to 0 when increasing branch number.
|
||||
export CHROMEOS_VERSION_PATCH=0
|
||||
# Branch number.
|
||||
# Increment by 1 in a new release branch.
|
||||
# Increment by 2 in trunk after making a release branch.
|
||||
# Does not reset on a major/minor change (always increases).
|
||||
# (Trunk is always odd; branches are always even).
|
||||
export CHROMEOS_VERSION_BRANCH=23
|
||||
|
||||
# Codename of this version.
|
||||
export CHROMEOS_VERSION_CODENAME=""
|
||||
}
|
||||
# Patch number.
|
||||
# Increment by 1 each release on a branch.
|
||||
# Reset to 0 when increasing branch number.
|
||||
export CHROMEOS_VERSION_PATCH=0
|
||||
|
||||
# Sets up a version for developer builds.
|
||||
export_developer_version() {
|
||||
# Use an arbitrarily high number to indicate that this is a dev build.
|
||||
export CHROMEOS_VERSION_MAJOR=999
|
||||
|
||||
# Use the SVN revision number of the tree here.
|
||||
# TODO(rtc): Figure out how to do this.
|
||||
export CHROMEOS_VERSION_MINOR=999
|
||||
|
||||
# Use the day of year and two digit year.
|
||||
export CHROMEOS_VERSION_BRANCH=$(date +"%j%y")
|
||||
|
||||
export CHROMEOS_VERSION_PATCH=$(date +"%H%M%S")
|
||||
|
||||
# Sets the codename to the user who built the image. This
|
||||
# will help us figure out who did the build if a different
|
||||
# person is debugging the system.
|
||||
export CHROMEOS_VERSION_CODENAME="$USER"
|
||||
}
|
||||
|
||||
export_version_string() {
|
||||
# Version string. Not indentied to appease bash.
|
||||
export CHROMEOS_VERSION_STRING=\
|
||||
"${CHROMEOS_VERSION_MAJOR}.${CHROMEOS_VERSION_MINOR}"\
|
||||
".${CHROMEOS_VERSION_BRANCH}.${CHROMEOS_VERSION_PATCH}"
|
||||
}
|
||||
# Codename of this version.
|
||||
export CHROMEOS_VERSION_CODENAME=""
|
||||
|
||||
|
||||
#############################################################################
|
||||
# SET VERSION STRINGS
|
||||
#############################################################################
|
||||
# Official builds must set
|
||||
# CHROMEOS_OFFICIAL=1
|
||||
# CHROMEOS_REVISION=(the subversion revision being built).
|
||||
# Note that ${FOO:-0} means default-to-0-if-unset; ${FOO:?} means die-if-unset.
|
||||
if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ]
|
||||
then
|
||||
# Official builds (i.e., buildbot)
|
||||
export_release_version
|
||||
export_version_string
|
||||
export CHROMEOS_VERSION_NAME="Chrome OS"
|
||||
export CHROMEOS_VERSION_TRACK="dev-channel"
|
||||
export CHROMEOS_VERSION_AUSERVER="https://tools.google.com/service/update2"
|
||||
@ -78,24 +58,33 @@ then
|
||||
elif [ "$USER" = "chrome-bot" ]
|
||||
then
|
||||
# Continuous builder
|
||||
export_release_version
|
||||
export_version_string
|
||||
# Sets the codename to the user who built the image. This
|
||||
# will help us figure out who did the build if a different
|
||||
# person is debugging the system.
|
||||
export CHROMEOS_VERSION_CODENAME="$USER"
|
||||
|
||||
export CHROMEOS_VERSION_NAME="Chromium OS"
|
||||
export CHROMEOS_VERSION_TRACK="buildbot-build"
|
||||
HOSTNAME=$(hostname)
|
||||
export CHROMEOS_VERSION_AUSERVER="http://$HOSTNAME:8080/update"
|
||||
export CHROMEOS_VERSION_DEVSERVER="http://$HOSTNAME:8080"
|
||||
else
|
||||
# Developer hand-builds
|
||||
export_developer_version
|
||||
export_version_string
|
||||
# Sets the codename to the user who built the image. This
|
||||
# will help us figure out who did the build if a different
|
||||
# person is debugging the system.
|
||||
export CHROMEOS_VERSION_CODENAME="$USER"
|
||||
|
||||
export CHROMEOS_VERSION_NAME="Chromium OS"
|
||||
export CHROMEOS_VERSION_TRACK="developer-build"
|
||||
HOSTNAME=$(hostname)
|
||||
export CHROMEOS_VERSION_AUSERVER="http://$HOSTNAME:8080/update"
|
||||
export CHROMEOS_VERSION_DEVSERVER="http://$HOSTNAME:8080"
|
||||
fi
|
||||
|
||||
# Version string. Not indentied to appease bash.
|
||||
export CHROMEOS_VERSION_STRING=\
|
||||
"${CHROMEOS_VERSION_MAJOR}.${CHROMEOS_VERSION_MINOR}"\
|
||||
".${CHROMEOS_VERSION_BRANCH}.${CHROMEOS_VERSION_PATCH}"
|
||||
|
||||
# Print version info.
|
||||
echo "ChromeOS version information:"
|
||||
env | grep "^CHROMEOS_VERSION" | sed 's/^/ /'
|
||||
env | egrep "^CHROMEOS_VERSION" | sed 's/^/ /'
|
||||
|
@ -44,8 +44,12 @@ fi
|
||||
# where CHROMEOS_REVISION is set
|
||||
if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then
|
||||
export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Official Build ${CHROMEOS_REVISION:?})"
|
||||
elif [ "$USER" = "chrome-bot" ]
|
||||
then
|
||||
export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Continuous Build ${CHROMEOS_REVISION:?} - Builder: ${BUILDBOT_BUILD:-"N/A"})"
|
||||
else
|
||||
export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Developer Build - $(date)-$USER)"
|
||||
# Use the $USER passthru via $CHROMEOS_RELEASE_CODENAME
|
||||
export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Developer Build ${CHROMEOS_REVISION:?} - $(date) - $CHROMEOS_RELEASE_CODENAME)"
|
||||
fi
|
||||
|
||||
# Set google-specific version numbers:
|
||||
|
@ -20,10 +20,11 @@ DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \
|
||||
"The destination dir for the chroot environment." "d"
|
||||
DEFINE_string trunk "$GCLIENT_ROOT" \
|
||||
"The source trunk to bind mount within the chroot." "s"
|
||||
DEFINE_string build_number "" \
|
||||
"The build-bot build number (when called by buildbot only)." "b"
|
||||
|
||||
DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts."
|
||||
DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts."
|
||||
DEFINE_boolean revision $FLAGS_FALSE "Pass subversion revision into chroot."
|
||||
|
||||
# More useful help
|
||||
FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- \"command\"]
|
||||
@ -101,29 +102,29 @@ fi
|
||||
trap teardown_env EXIT
|
||||
setup_env
|
||||
|
||||
if [ $FLAGS_revision -eq $FLAGS_TRUE ]
|
||||
# Get the git revision to pass into the chroot.
|
||||
#
|
||||
# This must be determined outside the chroot because (1) there is no
|
||||
# git inside the chroot, and (2) if there were it would likely be
|
||||
# the wrong version, which would mess up the .git directories.
|
||||
#
|
||||
# Note that this fixes $CHROMEOS_REVISION at the time the chroot is
|
||||
# entered. That's ok for the main use case of automated builds,
|
||||
# which pass each command line into a separate call to enter_chroot
|
||||
# so always have up-to-date info. For developer builds, there isn't
|
||||
# really a single revision anyway, since the developer may have
|
||||
# hand-sync'd some subdirs and edited files in others.
|
||||
# Use git:8 chars of sha1
|
||||
REVISION=$(git rev-parse HEAD)
|
||||
ORIGIN_REVISION=$(git rev-parse origin/HEAD)
|
||||
if [ "$REVISION" != "$ORIGIN_REVISION" ]
|
||||
then
|
||||
# Get the subversion revision to pass into the chroot.
|
||||
#
|
||||
# This must be determined outside the chroot because (1) there is no
|
||||
# svn/git inside the chroot, and (2) if there were it would likely be
|
||||
# the wrong version, which would mess up the .svn/.git directories.
|
||||
#
|
||||
# Note that this fixes $CHROMEOS_REVISION at the time the chroot is
|
||||
# entered. That's ok for the main use case of automated builds,
|
||||
# which pass each command line into a separate call to enter_chroot
|
||||
# so always have up-to-date info. For developer builds, there isn't
|
||||
# really a single revision anyway, since the developer may have
|
||||
# hand-sync'd some subdirs and edited files in others.
|
||||
REVISION="$(svn info 2>&- | grep "Revision: " | awk '{print $2}')"
|
||||
if [ -z "$REVISION" ]
|
||||
then
|
||||
# Use git:8 chars of sha1
|
||||
REVISION=$(git rev-parse HEAD)
|
||||
REVISION="${REVISION:8}"
|
||||
fi
|
||||
REVISION="CHROMEOS_REVISION=$REVISION"
|
||||
# Mark dirty tree with "**"
|
||||
REVISION="${REVISION:0:8}**"
|
||||
else
|
||||
REVISION="${REVISION:0:8}"
|
||||
fi
|
||||
REVISION="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number"
|
||||
|
||||
# Run command or interactive shell. Also include the non-chrooted path to
|
||||
# the source trunk for scripts that may need to print it (e.g.
|
||||
|
Loading…
Reference in New Issue
Block a user