|
|
|
@ -5,7 +5,7 @@ import sys |
|
|
|
from hashlib import md5 |
|
|
|
from wget import download |
|
|
|
import ssl |
|
|
|
|
|
|
|
import hashlib |
|
|
|
def file_write(file_name,text_content): |
|
|
|
# charset() |
|
|
|
file = open(file_name , "w") |
|
|
|
@ -174,6 +174,16 @@ def build_for_windowsApp(): |
|
|
|
os.system('du -sh Sources/Setup.exe') |
|
|
|
|
|
|
|
|
|
|
|
def calculate_md5(file_path): |
|
|
|
md5 = hashlib.md5() |
|
|
|
with open(file_path, 'rb') as f: |
|
|
|
while True: |
|
|
|
data = f.read(4096) |
|
|
|
if not data: |
|
|
|
break |
|
|
|
md5.update(data) |
|
|
|
return md5.hexdigest() |
|
|
|
|
|
|
|
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) |
|
|
|
@ -184,10 +194,10 @@ def build_the_current_windowsApp(name): |
|
|
|
platformAppAdd('/drone/src/Sources/Setup.exe', '.exe') |
|
|
|
else: |
|
|
|
print ("比对新老版本zip文件") |
|
|
|
with open(the_last_windowsAppZIP) as f: content1 = f.read() |
|
|
|
with open(the_current_windowsAppZIP) as f: content2 = f.read() |
|
|
|
content1 = calculate_md5(the_last_windowsAppZIP) |
|
|
|
content2 = calculate_md5(the_current_windowsAppZIP) |
|
|
|
|
|
|
|
if md5(content1).hexdigest() != md5(content2).hexdigest(): |
|
|
|
if content1 != content2: |
|
|
|
print ("比对结果:程序版本已更新") |
|
|
|
os.system('mkdir -p /tmp/a/ /tmp/b/ /tmp/IOTContainer/') |
|
|
|
os.system('unzip ' + the_last_windowsAppZIP + ' -d /tmp/a/') |
|
|
|
|