]> git.lizzy.rs Git - rust.git/commitdiff
Do not push a commit if the toolstate is unchanged.
authorkennytm <kennytm@gmail.com>
Sat, 9 Jun 2018 14:49:02 +0000 (22:49 +0800)
committerkennytm <kennytm@gmail.com>
Sat, 9 Jun 2018 20:31:49 +0000 (04:31 +0800)
This should greatly reduce the commits on the rust-toolstate repository.

`publish_toolstate.py` defaults to keep the old status if a new one is not
found, so nothing needs to be changed to that file.

src/ci/docker/x86_64-gnu-tools/checkregression.py
src/ci/docker/x86_64-gnu-tools/checktools.sh

index df791d12645fdea798b18f5df759de51019a5501..208aab434ce1fa84f289b5e0c044a4bda3afd0fc 100755 (executable)
@@ -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
 
index d71d5daf8113bf4abb59d51101467e85985fc250..d26be93861c0fa29f8b697ac988bddd053e4c7c3 100755 (executable)
@@ -91,19 +91,26 @@ status_check() {
 
 status_check "submodule_changed"
 
-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" \
+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"
-    # 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
+}
+
+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" change_toolstate
     rm -f "$MESSAGE_FILE"
     exit 0
 fi