| author | |
| committer | |
| log | f9a735415809605df2b6e59546a5ac81ab9f496c |
| tree | 7be968677be408cdc79569d9f5d54b76c80135fd |
| parent | ca3474dac5b86aeb1a15454d8c839235c9d53849 |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU |
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-sol2 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 | 31 | PUBLIC_KEY = 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U' |
| 32 | 32 | OFFICIAL = 'https://ziglang.org' |
| 33 | 33 | NEKTRO = 'http://mirrors.nektro.net/zig/' |
| 34 | SIGNATURE_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)' | |
| 34 | 35 | MAX_ARTIFACT = 2 * 1024**3 |
| 35 | 36 | _index_cache = (float('-inf'), {}) |
| 36 | 37 | _index_lock = threading.Lock() |
| ... | ... | @@ -196,7 +197,7 @@ def version_readme(version, artifacts, development=False): |
| 196 | 197 | lines.append('| ' + architecture + ' | ' + ' | '.join(' '.join(targets[architecture].get(system, [])) or '—' for system in columns) + ' |') |
| 197 | 198 | lines += ['', '</div>'] |
| 198 | 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 | 201 | else: |
| 201 | 202 | lines += ['', 'This historical release has no Minisign signatures. Verify its [official SHA-256](https://ziglang.org/download/index.json).', ''] |
| 202 | 203 | return '\n'.join(lines).encode() |
| ... | ... | @@ -416,7 +417,9 @@ class Mirror: |
| 416 | 417 | if '-dev.' not in directory.name: |
| 417 | 418 | preserved = preserved.replace(f'\n[Development builds](/mirrors/zig/{directory.name}/dev/)\n'.encode(), b'') |
| 418 | 419 | 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) | |
| 420 | 423 | if previous == content: |
| 421 | 424 | return None |
| 422 | 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 | 394 | artifact = self.cache.path('zig-x86_64-linux-0.17.0.tar.xz') |
| 395 | 395 | artifact.parent.mkdir() |
| 396 | 396 | artifact.write_bytes(b'already verified archive') |
| 397 | signature = Path(str(artifact) + '.minisig') | |
| 398 | signature.write_bytes(b'already verified signature') | |
| 397 | 399 | (artifact.parent / 'dev').mkdir() |
| 398 | 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 | 402 | mirror.set_mtime(path, stamp) |
| 401 | 403 | release = {'date': '2026-10-01', 'docs': 'https://ziglang.org/documentation/0.17.0/', |
| 402 | 404 | 'src': {'tarball': mirror.upstream(artifact.name), 'shasum': 'unused-cached-hash'}} |
| ... | ... | @@ -405,11 +407,12 @@ class MirrorTests(unittest.TestCase): |
| 405 | 407 | mirror.set_mtime(artifact.parent, stamp) |
| 406 | 408 | readme = artifact.parent / 'preadme.md' |
| 407 | 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 | 412 | with patch.object(mirror, 'index', return_value={'0.17.0': release}): |
| 410 | 413 | change = self.cache.directory_readme(artifact.parent) |
| 411 | 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 | 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 | 417 | self.cache.refresh() |
| 415 | 418 | self.assertNotIn('[Development builds]', readme.read_text()) |