From 3d0a607082545a2ce8c1c420ad19d09f24bd2167 Mon Sep 17 00:00:00 2001 From: Jondy Zhao Date: Fri, 19 Jul 2019 07:10:07 +0800 Subject: [PATCH] Auto update build time --- platforms/make-hash.py | 13 +++++++++++-- platforms/upload.sh | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/platforms/make-hash.py b/platforms/make-hash.py index 643e913..3fb6a3f 100644 --- a/platforms/make-hash.py +++ b/platforms/make-hash.py @@ -4,8 +4,11 @@ import json import os -TEMPLATE = r'''sed -i -e '/"path": "{name}"/,+6 s/"sha256":.*$/"sha256": "{vdata}",/g' {filename}''' +from datetime import datetime + +TEMPLATE = r'''sed -i -e '/"path": "{name}"/,+6 s/"sha256":.*$/"sha256": "{vdata}",/g' {filename}''' +UPDATE_TIME = r'''sed -i -e 's/"build_time": .*$/"build_time:": "{time}",/g' {filename}''' def make_hash256(filename): with open(filename) as f: @@ -26,4 +29,10 @@ def make_hash256(filename): if __name__ == '__main__': - make_hash256('index.json') + filename = 'index.json' + make_hash256(filename) + + cmd = UPDATE_TIME.format(time=datetime.today().strftime('%Y-%m-%d %H:%M:%S'), + filename=filename) + print(cmd) + os.system(cmd) diff --git a/platforms/upload.sh b/platforms/upload.sh index b35c046..765745a 100644 --- a/platforms/upload.sh +++ b/platforms/upload.sh @@ -21,7 +21,7 @@ done # scp -i ~/.ssh/aliyun_id_rsa README.html $prefix/platforms.html # Update hash of dynamic library -python make-hash.py +# python make-hash.py echo "Upload index.json to $prefix/" scp -i ~/.ssh/aliyun_id_rsa index.json $prefix/