Browse Source

fix: ci

test v1.0.1-beta.17
Your Name 1 year ago
parent
commit
e92860188f
  1. 14
      iot_upload.py
  2. 5
      zip_diff.sh

14
iot_upload.py

@ -189,6 +189,15 @@ def calculate_md5(file_path):
def build_the_current_windowsApp(name):
the_current_windowsAppZIP="/drone/src/IOTContainer/" + os.getenv('DRONE_REPO_NAME') + '.' + os.getenv('version') + '.zip'
the_last_windowsAppZIP = get_the_last_windowsAppZIP(name)
os.system('mkdir -p /tmp/a/ /tmp/b/ /tmp/IOTContainer/')
os.system('unzip -q ' + the_last_windowsAppZIP + ' -d /tmp/a/')
os.system('cd /tmp/a/ && tar -zcf diff.tgz ./')
os.system('unzip -q ' + the_current_windowsAppZIP + ' -d /tmp/b/')
os.system('cd /tmp/b/ && tar -zcf diff.tgz ./')
the_current_windowsAppTar='/tmp/a/diff.tgz'
the_last_windowsAppTar='/tmp/b/diff.tgz'
if the_last_windowsAppZIP == None:
print("初次上传,不比对zip,直接打包上传")
platformAppAdd(the_current_windowsAppZIP, '.zip')
@ -197,13 +206,10 @@ def build_the_current_windowsApp(name):
else:
print ("比对新老版本zip文件")
if calculate_md5(the_last_windowsAppZIP) == calculate_md5(the_current_windowsAppZIP):
if calculate_md5(the_current_windowsAppTar) == calculate_md5(the_last_windowsAppTar):
print ("\033[34m比对结果: 程序版本无更新,流程终止\033[0m")
else:
print ("比对结果:程序版本已更新")
os.system('mkdir -p /tmp/a/ /tmp/b/ /tmp/IOTContainer/')
os.system('unzip ' + the_last_windowsAppZIP + ' -d /tmp/a/')
os.system('unzip ' + the_current_windowsAppZIP + ' -d /tmp/b/')
os.system('/bin/sh -c /drone/src/zip_diff.sh')
diff_zip='/tmp/IOTContainer/' + os.getenv('DRONE_REPO_NAME') + '.' + os.getenv('version') + '.zip'
platformAppAdd(diff_zip, '.zip')

5
zip_diff.sh

@ -1,4 +1,4 @@
rm -rf /tmp/a/diff.tgz /tmp/b/diff.tgz
for i in $(diff -rq /tmp/a/ /tmp/b/ | grep Only | awk '{print $NF}')
do
mv /tmp/b/$i /tmp/IOTContainer/
@ -12,5 +12,4 @@ ls -la
zip_name=$DRONE_REPO_NAME.$(cat /drone/src/.tags).zip
zip -q -r $zip_name ./
cd -
cd /drone/src/
Loading…
Cancel
Save