Commit eb6c72b
committed
fix(index): replace the stanza for a re-published version instead of appending
A re-cut release reuses its version number, but the publish path is
append-only: it downloads the channel's current Packages index, appends the
stanza for the .deb it just fetched, and re-signs. For a re-cut that leaves TWO
stanzas for the same name-version, both pointing at the same pool path:
Package: wheels
Version: 4.1.0
Filename: pool/stable/w/wheels/wheels_4.1.0_all.deb
Size: 114764828
SHA256: 6bc9d8f8...
Package: wheels
Version: 4.1.0
Filename: pool/stable/w/wheels/wheels_4.1.0_all.deb
Size: 114770228
SHA256: 6ddb239e...
The pool object was overwritten by the re-cut build, so only the second stanza
describes the file actually served. apt binds to the stale one and refuses the
download. Verified against the live repo with a real client:
E: Failed to fetch https://apt.wheels.dev/pool/stable/w/wheels/wheels_4.1.0_all.deb
File has unexpected size (114770228 != 114764828). Mirror sync in progress?
so `apt install wheels` fails outright on the stable channel until the index is
wrong-then-right by luck of ordering.
Changes:
* scripts/replace-package-stanza.py - rewrites a Packages index so exactly one
stanza exists per name-version. Stanzas for other versions are preserved
byte-for-byte, including field order.
* regenerate-apt-metadata.sh - emit the new stanza to a scratch file and
replace rather than append, so a re-cut supersedes the previous record. The
name/version used for matching come from the .deb's own control file, so
they agree with what apt-ftparchive emits.
Verified on the live stable index (2 x 4.1.0 stanzas -> 1, other 6 versions
untouched, remaining stanza matches the served .deb's size and sha256).
Signed-off-by: Peter Amiri <peter@alurium.com>1 parent c60fc49 commit eb6c72b
3 files changed
Lines changed: 134 additions & 4 deletions
File tree
- scripts
- __pycache__
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
60 | 75 | | |
61 | 76 | | |
62 | 77 | | |
| |||
65 | 80 | | |
66 | 81 | | |
67 | 82 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
72 | 98 | | |
73 | 99 | | |
74 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments