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')...@@ -31,6 +31,7 @@ VERSION = re.compile(r'\d+\.\d+\.\d+(?:-dev\.\d+\+[0-9a-f]+)?\Z')
31PUBLIC_KEY = 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'31PUBLIC_KEY = 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'
32OFFICIAL = 'https://ziglang.org'32OFFICIAL = 'https://ziglang.org'
33NEKTRO = 'http://mirrors.nektro.net/zig/'33NEKTRO = '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)'
34MAX_ARTIFACT = 2 * 1024**335MAX_ARTIFACT = 2 * 1024**3
35_index_cache = (float('-inf'), {})36_index_cache = (float('-inf'), {})
36_index_lock = threading.Lock()37_index_lock = threading.Lock()
...@@ -196,7 +197,7 @@ def version_readme(version, artifacts, development=False):...@@ -196,7 +197,7 @@ def version_readme(version, artifacts, development=False):
196 lines.append('| ' + architecture + ' | ' + ' | '.join(' '.join(targets[architecture].get(system, [])) or '—' for system in columns) + ' |')197 lines.append('| ' + architecture + ' | ' + ' | '.join(' '.join(targets[architecture].get(system, [])) or '—' for system in columns) + ' |')
197 lines += ['', '</div>']198 lines += ['', '</div>']
198 if any(Path(str(artifact) + '.minisig').is_file() for artifact in artifacts):199 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, '']
200 else:201 else:
201 lines += ['', 'This historical release has no Minisign signatures. Verify its [official SHA-256](https://ziglang.org/download/index.json).', '']202 lines += ['', 'This historical release has no Minisign signatures. Verify its [official SHA-256](https://ziglang.org/download/index.json).', '']
202 return '\n'.join(lines).encode()203 return '\n'.join(lines).encode()
...@@ -416,7 +417,9 @@ class Mirror:...@@ -416,7 +417,9 @@ class Mirror:
416 if '-dev.' not in directory.name:417 if '-dev.' not in directory.name:
417 preserved = preserved.replace(f'\n[Development builds](/mirrors/zig/{directory.name}/dev/)\n'.encode(), b'')418 preserved = preserved.replace(f'\n[Development builds](/mirrors/zig/{directory.name}/dev/)\n'.encode(), b'')
418 if artifacts and linked == required and preserved.startswith(introduction) and b'https://file.paperclover.net' not in preserved:419 if artifacts and linked == required and preserved.startswith(introduction) and b'https://file.paperclover.net' not in preserved:
419 content = preserved420 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)
420 if previous == content:423 if previous == content:
421 return None424 return None
422 return {'path': str(path.relative_to(self.root)), 'before': before,425 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):...@@ -394,9 +394,11 @@ class MirrorTests(unittest.TestCase):
394 artifact = self.cache.path('zig-x86_64-linux-0.17.0.tar.xz')394 artifact = self.cache.path('zig-x86_64-linux-0.17.0.tar.xz')
395 artifact.parent.mkdir()395 artifact.parent.mkdir()
396 artifact.write_bytes(b'already verified archive')396 artifact.write_bytes(b'already verified archive')
397 signature = Path(str(artifact) + '.minisig')
398 signature.write_bytes(b'already verified signature')
397 (artifact.parent / 'dev').mkdir()399 (artifact.parent / 'dev').mkdir()
398 stamp = mirror.stable_time('0.17.0')400 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]:
400 mirror.set_mtime(path, stamp)402 mirror.set_mtime(path, stamp)
401 release = {'date': '2026-10-01', 'docs': 'https://ziglang.org/documentation/0.17.0/',403 release = {'date': '2026-10-01', 'docs': 'https://ziglang.org/documentation/0.17.0/',
402 'src': {'tarball': mirror.upstream(artifact.name), 'shasum': 'unused-cached-hash'}}404 'src': {'tarball': mirror.upstream(artifact.name), 'shasum': 'unused-cached-hash'}}
...@@ -405,11 +407,12 @@ class MirrorTests(unittest.TestCase):...@@ -405,11 +407,12 @@ class MirrorTests(unittest.TestCase):
405 mirror.set_mtime(artifact.parent, stamp)407 mirror.set_mtime(artifact.parent, stamp)
406 readme = artifact.parent / 'preadme.md'408 readme = artifact.parent / 'preadme.md'
407 custom = readme.read_text().replace('| Architecture |', '| Target |') + '\nCustom table notes.\n'409 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))
409 with patch.object(mirror, 'index', return_value={'0.17.0': release}):412 with patch.object(mirror, 'index', return_value={'0.17.0': release}):
410 change = self.cache.directory_readme(artifact.parent)413 change = self.cache.directory_readme(artifact.parent)
411 self.assertEqual(mirror.base64.b64decode(change['previous']), readme.read_bytes())414 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]}
413 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')):416 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')):
414 self.cache.refresh()417 self.cache.refresh()
415 self.assertNotIn('[Development builds]', readme.read_text())418 self.assertNotIn('[Development builds]', readme.read_text())