Add ABI_VERSION to the version file and a script to upload dills to CPID

Bug: https://github.com/dart-lang/sdk/issues/36047
Change-Id: I19d825eb2addaa32680d18a21d237ca172cd4b73
Reviewed-on: https://dart-review.googlesource.com/c/94442
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Liam Appelbe 2019-03-01 23:00:41 +00:00 committed by commit-bot@chromium.org
parent 0491d5cde7
commit 2f158b9997
3 changed files with 87 additions and 3 deletions

View file

@ -23,9 +23,17 @@
# * Making cherry-picks to stable channel
# - increase PATCH by 1
#
# * Making a change to the ABI:
# - increase ABI_VERSION by 1
#
# * Deprecating an old ABI version:
# - increase OLDEST_SUPPORTED_ABI_VERSION to the version that is supported.
#
CHANNEL be
MAJOR 2
MINOR 2
PATCH 1
PRERELEASE 0
PRERELEASE_PATCH 0
ABI_VERSION 0
OLDEST_SUPPORTED_ABI_VERSION 0

59
tools/upload_abi_dills.sh Executable file
View file

@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Uploads the following dill files to CIPD, indexed by the current ABI version:
# $build_dir/vm_platform_strong.dill
# $build_dir/gen/kernel_service.dill
# $build_dir/gen_kernel_bytecode.dill
# This script is a no-op unless $BUILDBOT_BUILDERNAME is "dart-sdk-linux". It's
# also a no-op if dill files were already uploaded today.
set -e
set -x
if [ -z "$2" ]; then
echo "Usage: upload_abi_dills.sh version_file build_dir"
exit 1
fi
if [ "$BUILDBOT_BUILDERNAME" != "dart-sdk-linux" ]; then
echo "This script only works on the dart-sdk-linux buildbot"
exit 0
fi
abi_version=$(sed -n "s/^ABI_VERSION \([0-9]*\)$/\1/p" "$1")
git_revision=$(git rev-parse HEAD)
current_date=$(date +%F)
search_results=$(cipd search \
"dart/abiversions/$abi_version" \
-tag "date:$current_date" | grep "Instances:" || echo "")
if [ ! -z "$search_results" ]; then
exit 0
fi
tmpdir=$(mktemp -d)
cleanup() {
rm -rf "$tmpdir"
}
trap cleanup EXIT HUP INT QUIT TERM PIPE
pushd "$tmpdir"
mkdir abiversions
cp "$2/vm_platform_strong.dill" "abiversions/vm_platform_strong.dill"
cp "$2/gen/kernel_service.dill" "abiversions/kernel_service.dill"
cp "$2/gen_kernel_bytecode.dill" "abiversions/gen_kernel_bytecode.dill"
cipd create \
-name dart/abiversions/$abi_version \
-in abiversions \
-install-mode copy \
-tag version:$abi_version \
-tag date:$current_date \
-tag git_revision:$git_revision \
-ref latest \
-ref version:$abi_version
popd

View file

@ -43,13 +43,15 @@ def GetMinidumpUtils():
class Version(object):
def __init__(self, channel, major, minor, patch, prerelease,
prerelease_patch):
prerelease_patch, abi_version, oldest_supported_abi_version):
self.channel = channel
self.major = major
self.minor = minor
self.patch = patch
self.prerelease = prerelease
self.prerelease_patch = prerelease_patch
self.abi_version = abi_version
self.oldest_supported_abi_version = oldest_supported_abi_version
# Try to guess the host operating system.
@ -385,6 +387,16 @@ def GetUserName():
return os.environ.get(key, '')
def GetAbiVersion():
version = ReadVersionFile()
return version.abi_version
def GetOldestSupportedAbiVersion():
version = ReadVersionFile()
return version.oldest_supported_abi_version
def ReadVersionFile():
def match_against(pattern, file_content):
match = re.search(pattern, file_content, flags=re.MULTILINE)
@ -406,10 +418,15 @@ def ReadVersionFile():
patch = match_against('^PATCH (\d+)$', content)
prerelease = match_against('^PRERELEASE (\d+)$', content)
prerelease_patch = match_against('^PRERELEASE_PATCH (\d+)$', content)
abi_version = match_against('^ABI_VERSION (\d+)$', content)
oldest_supported_abi_version = match_against(
'^OLDEST_SUPPORTED_ABI_VERSION (\d+)$', content)
if channel and major and minor and prerelease and prerelease_patch:
if channel and major and minor and prerelease and prerelease_patch and \
abi_version and oldest_supported_abi_version:
return Version(
channel, major, minor, patch, prerelease, prerelease_patch)
channel, major, minor, patch, prerelease, prerelease_patch, abi_version,
oldest_supported_abi_version)
else:
print "Warning: VERSION file (%s) has wrong format" % VERSION_FILE
return None