diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index df791d12645..208aab434ce 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -18,6 +18,7 @@ if __name__ == '__main__': os_name = sys.argv[1] toolstate_file = sys.argv[2] current_state = sys.argv[3] + verb = sys.argv[4] # 'regressed' or 'changed' with open(toolstate_file, 'r') as f: toolstate = json.load(f) @@ -29,10 +30,17 @@ if __name__ == '__main__': tool = cur['tool'] state = cur[os_name] new_state = toolstate.get(tool, '') - if new_state < state: + if verb == 'regressed': + updated = new_state < state + elif verb == 'changed': + updated = new_state != state + else: + print('Unknown verb {}'.format(updated)) + sys.exit(2) + if updated: print( - 'Error: The state of "{}" has regressed from "{}" to "{}"' - .format(tool, state, new_state) + 'The state of "{}" has {} from "{}" to "{}"' + .format(tool, verb, state, new_state) ) regressed = True diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index d71d5daf811..d26be93861c 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -91,19 +91,26 @@ status_check() { status_check "submodule_changed" +CHECK_NOT="$(dirname $0)/checkregression.py" +change_toolstate() { + # only update the history + if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then + echo 'Toolstate is not changed. Not updating.' + else + if [ $SIX_WEEK_CYCLE -eq 5 ]; then + python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed + fi + sed -i "1 a\\ +$COMMIT\t$(cat "$TOOLSTATE_FILE") +" "history/$OS.tsv" + fi +} + if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then . "$(dirname $0)/repo.sh" MESSAGE_FILE=$(mktemp -t msg.XXXXXX) echo "($OS CI update)" > "$MESSAGE_FILE" - commit_toolstate_change "$MESSAGE_FILE" \ - sed -i "1 a\\ -$COMMIT\t$(cat "$TOOLSTATE_FILE") -" "history/$OS.tsv" - # if we are at the last week in the 6-week release cycle, reject any kind of regression. - if [ $SIX_WEEK_CYCLE -eq 5 ]; then - python2.7 "$(dirname $0)/checkregression.py" \ - "$OS" "$TOOLSTATE_FILE" "rust-toolstate/_data/latest.json" - fi + commit_toolstate_change "$MESSAGE_FILE" change_toolstate rm -f "$MESSAGE_FILE" exit 0 fi