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:
David McMahon 2009-12-08 12:47:08 -08:00
parent e90dbc8e59
commit 03aeb20079
5 changed files with 80 additions and 88 deletions

View File

@ -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_integer keep_max 0 "Maximum builds to keep in archive (0=all)"
DEFINE_string zipname "image.zip" "Name of zip file to create." 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_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 # Parse command line
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1
@ -41,18 +43,14 @@ fi
# Get version information # Get version information
. "${SCRIPTS_DIR}/chromeos_version.sh" . "${SCRIPTS_DIR}/chromeos_version.sh"
# Get subversion or git revision # Get git hash
REVISION=$(svn info 2>&-| grep "Revision: " | awk '{print $2}') # Use git:8 chars of sha1
if [ -z "$REVISION" ] REVISION=$(git rev-parse HEAD)
then REVISION=${REVISION:0:8}
# Use git:8 chars of sha1
REVISION=$(git rev-parse HEAD)
REVISION=${REVISION:8}
fi
# Use the version number plus revision as the last change. (Need both, since # Use the version number plus revision as the last change. (Need both, since
# trunk builds multiple times with the same version string.) # 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 # The Chromium buildbot scripts only create a clickable link to the archive
# if an output line of the form "last change: XXX" exists # if an output line of the form "last change: XXX" exists

View File

@ -216,7 +216,7 @@ SERVER2="$MIRROR2_INSIDE"
SUITE2="$FLAGS_suite2" SUITE2="$FLAGS_suite2"
EOF EOF
# ...and all CHROMEOS_ vars # ...and all CHROMEOS_ vars
set | grep "^CHROMEOS_" >> $CUST_OPTS set | egrep "^CHROMEOS_|^BUILDBOT_" >> $CUST_OPTS
# Run the package install script # Run the package install script
sudo chroot "$ROOT_FS_DIR" \ sudo chroot "$ROOT_FS_DIR" \

View File

@ -12,65 +12,45 @@
# Version numbering scheme is much like Chrome's, with the addition of # Version numbering scheme is much like Chrome's, with the addition of
# double-incrementing branch number so trunk is always odd. # double-incrementing branch number so trunk is always odd.
# Sets up a version number for release builds. HOSTNAME=$(hostname)
export_release_version() { #############################################################################
# Major/minor versions. # SET VERSION NUMBERS
# Primarily for product marketing. #############################################################################
export CHROMEOS_VERSION_MAJOR=0 # Major/minor versions.
export CHROMEOS_VERSION_MINOR=5 # Primarily for product marketing.
export CHROMEOS_VERSION_MAJOR=0
export CHROMEOS_VERSION_MINOR=5
# Branch number. # Major/minor versions.
# Increment by 1 in a new release branch. # Primarily for product marketing.
# Increment by 2 in trunk after making a release branch. export CHROMEOS_VERSION_MAJOR=0
# Does not reset on a major/minor change (always increases). export CHROMEOS_VERSION_MINOR=5
# (Trunk is always odd; branches are always even).
export CHROMEOS_VERSION_BRANCH=23
# Patch number. # Branch number.
# Increment by 1 each release on a branch. # Increment by 1 in a new release branch.
# Reset to 0 when increasing branch number. # Increment by 2 in trunk after making a release branch.
export CHROMEOS_VERSION_PATCH=0 # 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. # Patch number.
export CHROMEOS_VERSION_CODENAME="" # 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. # Codename of this version.
export_developer_version() { export CHROMEOS_VERSION_CODENAME=""
# 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}"
}
#############################################################################
# SET VERSION STRINGS
#############################################################################
# Official builds must set # Official builds must set
# CHROMEOS_OFFICIAL=1 # 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. # Note that ${FOO:-0} means default-to-0-if-unset; ${FOO:?} means die-if-unset.
if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ] if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ]
then then
# Official builds (i.e., buildbot) # Official builds (i.e., buildbot)
export_release_version
export_version_string
export CHROMEOS_VERSION_NAME="Chrome OS" export CHROMEOS_VERSION_NAME="Chrome OS"
export CHROMEOS_VERSION_TRACK="dev-channel" export CHROMEOS_VERSION_TRACK="dev-channel"
export CHROMEOS_VERSION_AUSERVER="https://tools.google.com/service/update2" export CHROMEOS_VERSION_AUSERVER="https://tools.google.com/service/update2"
@ -78,24 +58,33 @@ then
elif [ "$USER" = "chrome-bot" ] elif [ "$USER" = "chrome-bot" ]
then then
# Continuous builder # Continuous builder
export_release_version # Sets the codename to the user who built the image. This
export_version_string # 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_NAME="Chromium OS"
export CHROMEOS_VERSION_TRACK="buildbot-build" export CHROMEOS_VERSION_TRACK="buildbot-build"
HOSTNAME=$(hostname)
export CHROMEOS_VERSION_AUSERVER="http://$HOSTNAME:8080/update" export CHROMEOS_VERSION_AUSERVER="http://$HOSTNAME:8080/update"
export CHROMEOS_VERSION_DEVSERVER="http://$HOSTNAME:8080" export CHROMEOS_VERSION_DEVSERVER="http://$HOSTNAME:8080"
else else
# Developer hand-builds # Developer hand-builds
export_developer_version # Sets the codename to the user who built the image. This
export_version_string # 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_NAME="Chromium OS"
export CHROMEOS_VERSION_TRACK="developer-build" export CHROMEOS_VERSION_TRACK="developer-build"
HOSTNAME=$(hostname)
export CHROMEOS_VERSION_AUSERVER="http://$HOSTNAME:8080/update" export CHROMEOS_VERSION_AUSERVER="http://$HOSTNAME:8080/update"
export CHROMEOS_VERSION_DEVSERVER="http://$HOSTNAME:8080" export CHROMEOS_VERSION_DEVSERVER="http://$HOSTNAME:8080"
fi 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. # Print version info.
echo "ChromeOS version information:" echo "ChromeOS version information:"
env | grep "^CHROMEOS_VERSION" | sed 's/^/ /' env | egrep "^CHROMEOS_VERSION" | sed 's/^/ /'

View File

@ -44,8 +44,12 @@ fi
# where CHROMEOS_REVISION is set # where CHROMEOS_REVISION is set
if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then
export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Official Build ${CHROMEOS_REVISION:?})" 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 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 fi
# Set google-specific version numbers: # Set google-specific version numbers:

View File

@ -20,10 +20,11 @@ DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \
"The destination dir for the chroot environment." "d" "The destination dir for the chroot environment." "d"
DEFINE_string trunk "$GCLIENT_ROOT" \ DEFINE_string trunk "$GCLIENT_ROOT" \
"The source trunk to bind mount within the chroot." "s" "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 mount $FLAGS_FALSE "Only set up mounts."
DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts." DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts."
DEFINE_boolean revision $FLAGS_FALSE "Pass subversion revision into chroot."
# More useful help # More useful help
FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- \"command\"] FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- \"command\"]
@ -101,29 +102,29 @@ fi
trap teardown_env EXIT trap teardown_env EXIT
setup_env 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 then
# Get the subversion revision to pass into the chroot. # Mark dirty tree with "**"
# REVISION="${REVISION:0:8}**"
# This must be determined outside the chroot because (1) there is no else
# svn/git inside the chroot, and (2) if there were it would likely be REVISION="${REVISION:0:8}"
# 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"
fi fi
REVISION="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number"
# Run command or interactive shell. Also include the non-chrooted path to # 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. # the source trunk for scripts that may need to print it (e.g.