authoravatarclover caruso<git@paperclover.net>2026-10-17 13:58:42-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-21 02:52:29-07:00
logf9a735415809605df2b6e59546a5ac81ab9f496c
tree7be968677be408cdc79569d9f5d54b76c80135fd
parentca3474dac5b86aeb1a15454d8c839235c9d53849
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Restore the original Zig mirror signature footer

Use Clover’s exact footer for future signed-build pages and replace only the previously generated footer in preserved Markdown tables. Verified all 24 mirror tests and the rendered staged Copyparty page, including custom notes and unchanged timestamps. Assisted-by: gpt-6.1-sol

2 files changed, 11 insertions(+), 5 deletions(-)

service/zig-mirror/build/mirror.py+5-2
......@@ -31,6 +31,7 @@ VERSION = re.compile(r'\d+\.\d+\.\d+(?:-dev\.\d+\+[0-9a-f]+)?\Z')
3131PUBLIC_KEY = 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'
3232OFFICIAL = 'https://ziglang.org'
3333NEKTRO = 'http://mirrors.nektro.net/zig/'
34SIGNATURE_NOTE = '<span style="font-style:italic;color:orange">Don\'t forget to verify your build signatures!</span> <span style="opacity:0.7">&nbsp;(the 🔐 is a link to the minisig)'
3435MAX_ARTIFACT = 2 * 1024**3
3536_index_cache = (float('-inf'), {})
3637_index_lock = threading.Lock()
......@@ -196,7 +197,7 @@ def version_readme(version, artifacts, development=False):
196197 lines.append('| ' + architecture + ' | ' + ' | '.join(' '.join(targets[architecture].get(system, [])) or '—' for system in columns) + ' |')
197198 lines += ['', '</div>']
198199 if any(Path(str(artifact) + '.minisig').is_file() for artifact in artifacts):
199 lines += ['', '<span style="font-style:italic;color:orange">Verify your build signatures.</span> <span style="opacity:0.7">The &#128272; links open the Minisign signatures.</span>', '']
200 lines += ['', SIGNATURE_NOTE, '']
200201 else:
201202 lines += ['', 'This historical release has no Minisign signatures. Verify its [official SHA-256](https://ziglang.org/download/index.json).', '']
202203 return '\n'.join(lines).encode()
......@@ -416,7 +417,9 @@ class Mirror:
416417 if '-dev.' not in directory.name:
417418 preserved = preserved.replace(f'\n[Development builds](/mirrors/zig/{directory.name}/dev/)\n'.encode(), b'')
418419 if artifacts and linked == required and preserved.startswith(introduction) and b'https://file.paperclover.net' not in preserved:
419 content = preserved
420 content = preserved.replace(
421 b'\n<span style="font-style:italic;color:orange">Verify your build signatures.</span> <span style="opacity:0.7">The &#128272; links open the Minisign signatures.</span>\n',
422 b'\n' + SIGNATURE_NOTE.encode() + b'\n', 1)
420423 if previous == content:
421424 return None
422425 return {'path': str(path.relative_to(self.root)), 'before': before,
tools/zig-mirror-test.py+6-3
......@@ -394,9 +394,11 @@ class MirrorTests(unittest.TestCase):
394394 artifact = self.cache.path('zig-x86_64-linux-0.17.0.tar.xz')
395395 artifact.parent.mkdir()
396396 artifact.write_bytes(b'already verified archive')
397 signature = Path(str(artifact) + '.minisig')
398 signature.write_bytes(b'already verified signature')
397399 (artifact.parent / 'dev').mkdir()
398400 stamp = mirror.stable_time('0.17.0')
399 for path in [artifact, artifact.parent, self.cache.root]:
401 for path in [artifact, signature, artifact.parent, self.cache.root]:
400402 mirror.set_mtime(path, stamp)
401403 release = {'date': '2026-10-01', 'docs': 'https://ziglang.org/documentation/0.17.0/',
402404 'src': {'tarball': mirror.upstream(artifact.name), 'shasum': 'unused-cached-hash'}}
......@@ -405,11 +407,12 @@ class MirrorTests(unittest.TestCase):
405407 mirror.set_mtime(artifact.parent, stamp)
406408 readme = artifact.parent / 'preadme.md'
407409 custom = readme.read_text().replace('| Architecture |', '| Target |') + '\nCustom table notes.\n'
408 readme.write_text(custom.replace('<div ', '[Development builds](/mirrors/zig/0.17.0/dev/)\n\n<div ', 1))
410 stale = custom.replace(mirror.SIGNATURE_NOTE, '<span style="font-style:italic;color:orange">Verify your build signatures.</span> <span style="opacity:0.7">The &#128272; links open the Minisign signatures.</span>')
411 readme.write_text(stale.replace('<div ', '[Development builds](/mirrors/zig/0.17.0/dev/)\n\n<div ', 1))
409412 with patch.object(mirror, 'index', return_value={'0.17.0': release}):
410413 change = self.cache.directory_readme(artifact.parent)
411414 self.assertEqual(mirror.base64.b64decode(change['previous']), readme.read_bytes())
412 original = {path: path.stat().st_mtime_ns for path in [artifact, artifact.parent, self.cache.root, readme]}
415 original = {path: path.stat().st_mtime_ns for path in [artifact, signature, artifact.parent, self.cache.root, readme]}
413416 with patch.object(mirror, 'index', return_value={'0.17.0': release, 'master': {}}) as metadata, patch.object(mirror, 'fetch', side_effect=AssertionError('cached refresh must not redownload')):
414417 self.cache.refresh()
415418 self.assertNotIn('[Development builds]', readme.read_text())