Release Vulpes OS 2.7-preview.24
This commit is contained in:
parent
49572b6b45
commit
97ef99f827
135 changed files with 7717 additions and 2524 deletions
|
|
@ -36,11 +36,34 @@ def main():
|
|||
spec=importlib.util.spec_from_file_location('package_gaia',ROOT/'tundra/tools/package-beatles-gaia.py')
|
||||
package=importlib.util.module_from_spec(spec);spec.loader.exec_module(package)
|
||||
files=package.shared_files()
|
||||
current={str(p.relative_to(ROOT)):hashlib.sha256(p.read_bytes()).hexdigest() for p in files}
|
||||
out=ROOT/'tundra/out/beatles/gecko-156.0.1'
|
||||
cache_path=out/'.gaia-sync-hash-cache.json'
|
||||
try:
|
||||
cache=json.loads(cache_path.read_text()).get('files',{})
|
||||
except (OSError,ValueError,AttributeError):
|
||||
cache={}
|
||||
current={}
|
||||
next_cache={}
|
||||
reused=0
|
||||
for path in files:
|
||||
name=str(path.relative_to(ROOT))
|
||||
stat=path.stat()
|
||||
fingerprint={'device':stat.st_dev,'inode':stat.st_ino,'size':stat.st_size,
|
||||
'mtime_ns':stat.st_mtime_ns,'ctime_ns':stat.st_ctime_ns}
|
||||
previous=cache.get(name,{})
|
||||
digest=previous.get('sha256') if all(previous.get(k)==v for k,v in fingerprint.items()) else None
|
||||
if not digest:
|
||||
digest=hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
else:
|
||||
reused+=1
|
||||
current[name]=digest
|
||||
next_cache[name]={**fingerprint,'sha256':digest}
|
||||
temporary=cache_path.with_suffix('.tmp')
|
||||
temporary.write_text(json.dumps({'files':next_cache},separators=(',',':'))+'\n')
|
||||
temporary.replace(cache_path)
|
||||
raw=shell('cat '+REMOTE+'/work/gaia-sync.json 2>/dev/null || true')
|
||||
previous=json.loads(raw).get('files',{}) if raw else {}
|
||||
changed,removed=changes(current,previous)
|
||||
out=ROOT/'tundra/out/beatles/gecko-156.0.1'
|
||||
manifest=out/'gaia-sync.json'
|
||||
manifest.write_text(json.dumps({'files':current},indent=2)+'\n')
|
||||
if changed or removed:
|
||||
|
|
@ -57,6 +80,6 @@ def main():
|
|||
shell('rm -f '+' '.join(shlex.quote(REMOTE+'/opt/vulpes/'+p) for p in removed[start:start+100]))
|
||||
subprocess.run(adb+['push',str(manifest),REMOTE+'/work/gaia-sync.json.new'],check=True,capture_output=True)
|
||||
shell('mv '+REMOTE+'/work/gaia-sync.json.new '+REMOTE+'/work/gaia-sync.json')
|
||||
print(json.dumps({'files':len(current),'updated':len(changed),'removed':len(removed),'profilePreserved':True}))
|
||||
print(json.dumps({'files':len(current),'hashesReused':reused,'updated':len(changed),'removed':len(removed),'profilePreserved':True}))
|
||||
|
||||
if __name__=='__main__':main()
|
||||
|
|
|
|||
Loading…
Reference in a new issue