fix: preserve camera permission intent and distinguish unknown reply expression
This commit is contained in:
@@ -13,7 +13,7 @@ def health():
|
||||
with opener.open('https://192.168.31.61:5011/health',timeout=3) as r:return json.load(r)
|
||||
def atomic(path,content,mode):
|
||||
path.parent.mkdir(parents=True,exist_ok=True)
|
||||
tmp=path.with_name(path.name+'.v050.tmp');tmp.write_bytes(content);tmp.chmod(mode);tmp.replace(path)
|
||||
tmp=path.with_name(path.name+'.v051.tmp');tmp.write_bytes(content);tmp.chmod(mode);tmp.replace(path)
|
||||
def live_hashes():return {name:digest(root/name) for name in deploy_files}
|
||||
original=live_hashes()
|
||||
if original!=expected:
|
||||
@@ -30,7 +30,7 @@ private_hashes={str(p):digest(p) for p in private_files}
|
||||
def relation_unchanged():
|
||||
return subprocess.check_output(['systemctl','--user','cat',unit])==unit_text and all(digest(Path(p))==h for p,h in private_hashes.items())
|
||||
if apply and health().get('busy'): raise RuntimeError('gateway_busy_no_restart')
|
||||
with tempfile.TemporaryDirectory(prefix='voice-v050-stage-') as folder:
|
||||
with tempfile.TemporaryDirectory(prefix='voice-v051-stage-') as folder:
|
||||
stage=Path(folder)
|
||||
for name,content in bundle.items():
|
||||
path=stage/name;path.parent.mkdir(parents=True,exist_ok=True);path.write_bytes(base64.b64decode(content))
|
||||
@@ -42,7 +42,7 @@ with tempfile.TemporaryDirectory(prefix='voice-v050-stage-') as folder:
|
||||
if live_hashes()!=original:raise RuntimeError('source_changed_during_tests')
|
||||
if not relation_unchanged():raise RuntimeError('environment_or_unit_changed_during_tests')
|
||||
if health().get('busy'):raise RuntimeError('gateway_busy_after_tests_no_restart')
|
||||
backup=root/'.runtime/backups'/time.strftime('voice-v050-%Y%m%d-%H%M%S');backup.mkdir(parents=True,mode=0o700)
|
||||
backup=root/'.runtime/backups'/time.strftime('voice-v051-%Y%m%d-%H%M%S');backup.mkdir(parents=True,mode=0o700)
|
||||
# Save all actual runtime Python sources/tests, modes, plus unit/env privately. No logs/history/audio copied.
|
||||
for path in list(root.glob('*.py'))+list((root/'tests').glob('*.py')):
|
||||
dst=backup/path.relative_to(root);dst.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(path,dst)
|
||||
@@ -84,7 +84,7 @@ def main():
|
||||
root=Path(__file__).resolve().parents[1]
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--apply',action='store_true');args=parser.parse_args()
|
||||
source=root/'gateway';manifest=json.loads((source/'SOURCE_MANIFEST.json').read_text())
|
||||
baseline=manifest['provider_baseline']['files']
|
||||
baseline=manifest.get('deployment_baseline',manifest['provider_baseline'])['files']
|
||||
files=sorted(set(baseline)|{p.relative_to(source).as_posix() for p in source.glob('*.py')}|{p.relative_to(source).as_posix() for p in (source/'tests').glob('*.py')})
|
||||
assert all(n.endswith('.py') and not Path(n).is_absolute() and '..' not in Path(n).parts for n in files)
|
||||
expected={name:baseline.get(name) for name in files}
|
||||
|
||||
Reference in New Issue
Block a user