diff --git a/iot_upload.py b/iot_upload.py index ecbb8e7..a7fd1a5 100644 --- a/iot_upload.py +++ b/iot_upload.py @@ -183,6 +183,7 @@ def calculate_md5(file_path): if not data: break md5.update(data) + print( file_path + 'MD5值为' + md5.hexdigest()) return md5.hexdigest() def build_the_current_windowsApp(name): @@ -195,10 +196,10 @@ def build_the_current_windowsApp(name): platformAppAdd('/drone/src/Sources/Setup.exe', '.exe') else: print ("比对新老版本zip文件") - content1 = calculate_md5(the_last_windowsAppZIP) - content2 = calculate_md5(the_current_windowsAppZIP) - if content1 != content2: + if calculate_md5(the_last_windowsAppZIP) == calculate_md5(the_current_windowsAppZIP): + 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/') @@ -208,8 +209,6 @@ def build_the_current_windowsApp(name): platformAppAdd(diff_zip, '.zip') build_for_windowsApp() platformAppAdd('/drone/src/Sources/Setup.exe', '.exe') - else: - print ("\033[34m比对结果: 程序版本无更新,流程终止\033[0m")