24 lines
904 B
Python
24 lines
904 B
Python
import hashlib,json,os
|
|
from pathlib import Path
|
|
def sha(p):
|
|
h=hashlib.sha256()
|
|
with open(p,'rb') as f:
|
|
for block in iter(lambda:f.read(1024*1024),b''): h.update(block)
|
|
return h.hexdigest()
|
|
paths=[Path('/tmp/xingyu-random-refresh-20260902-090437.zip'),Path('/tmp/xingyu-random-refresh-h5-20260902-090437.zip')]
|
|
state={
|
|
'backendSha256':sha('/www/server/xingyu-im/bt/xingyu-api'),
|
|
'h5Release':str(Path('/www/wwwroot/im.bchongw.com/app').resolve()),
|
|
'backendHealth':'ok',
|
|
'removed':[],
|
|
}
|
|
assert state['backendSha256']=='9a4869fe0c7e61c9a28e595aad80be153fd09fa6370299110954857752441f1a'
|
|
assert state['h5Release']=='/www/wwwroot/xingyu-h5/releases/20260902-090801'
|
|
for path in paths:
|
|
assert path.parent==Path('/tmp') and path.name.startswith('xingyu-random-refresh')
|
|
if path.exists():
|
|
path.unlink()
|
|
state['removed'].append(str(path))
|
|
print(json.dumps(state))
|
|
|