feat: keep the address of a file that left

files/?sha1= of a file the collection no longer holds answered that no
file the site knows has the hash. generate_db.py now records each sha1 a
rebuild drops in retired.json, with the day and the file in its place,
backfilled from the history since 0d586ef6b (4,139 files). The lookup
answers with it and leads to the successor's card.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 04:24:44 +01:00
1 parent 578050b8e5
commit 350cd6d600
12 files changed
+37779 -10

No files matched your search

+14
View File
@@ -34,6 +34,7 @@ from common import (
write_text_atomic,
yaml_load,
)
import retired_files
# Platform and profile aliases are read from YAML: without pyyaml the
# database lost every one of them and the run still exited 0.
@@ -484,6 +485,19 @@ def main() -> int:
"indexes": indexes,
}
# A sha1 the rebuild drops keeps its published address: the record
# beside the database says when it left and what holds its place.
output = Path(args.output)
if output.is_file():
previous = json.loads(output.read_text(encoding="utf-8"))
left = retired_files.update(
retired_files.retired_path(output), previous, database,
database["generated_at"][:10],
)
if left:
print(f" Left the collection: {left} files, recorded in "
f"{retired_files.retired_path(output)}")
new_content = json.dumps(database, indent=2)
written = write_if_changed(args.output, new_content)