Codebase list texinfo / d6a0477
make texinfo indices reproducible (Closes: #790065) (thanks to Chris Lamb) Norbert Preining 8 years ago
3 changed file(s) with 55 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 texinfo (6.0.0.dfsg.1-2) unstable; urgency=medium
1
2 * make texinfo indices reproducible (Closes: #790065) (thanks to Chris Lamb)
3
4 -- Norbert Preining <preining@debian.org> Sat, 27 Jun 2015 23:15:25 +0900
5
06 texinfo (6.0.0.dfsg.1-1) unstable; urgency=medium
17
28 * Imported Upstream version 6.0.0.dfsg.1
33 dont_build_info
44 info-manpage-mentiones-nonfree
55 do-not-require-automake-1.15
6 texinfo-make-index-deterministic
0 Make texino indices reproducible by genrating deterministic order
1 From Debian #790065
2 While working on the "reproducible builds" effort [1], we have noticed
3 that texinfo generates indices in a non-deterministic order.
4
5 This appears to happen because the index sort is not stable with respect
6 to the line number, resulting in output non-determinstically changing
7 from:
8
9 * Entry (line 1)
10 * Entry (line 2)
11
12 and
13
14 * Entry (line 2)
15 * Entry (line 1)
16
17 .. when the entry is the same string.
18
19 The attached patch adds the line number to the sort comparator. Once
20 applied, (some) packages using texinfo can be built reproducibly in
21 our reproducible toolchain.
22
23 Patch by Chris Lamb
24 ---
25 tp/Texinfo/Structuring.pm | 4 ++++
26 1 file changed, 4 insertions(+)
27
28 --- texinfo.orig/tp/Texinfo/Structuring.pm
29 +++ texinfo/tp/Texinfo/Structuring.pm
30 @@ -1984,6 +1984,9 @@
31 if ($res == 0) {
32 $res = ($key1->{'number'} <=> $key2->{'number'});
33 }
34 + if ($res == 0) {
35 + $res = ($key1->{'line_nr'} <=> $key2->{'line_nr'});
36 + }
37 return $res;
38 }
39
40 @@ -2016,6 +2019,7 @@
41 foreach my $index_name (keys(%$index_entries)) {
42 foreach my $entry (@{$index_entries->{$index_name}}) {
43 $entry->{'in_code'} = $index_names->{$entry->{'index_name'}}->{'in_code'};
44 + $entry->{'line_nr'} = $entry->{'command'}->{'line_nr'}->{'line_nr'};
45 $options->{'code'} = $entry->{'in_code'};
46 $entry->{'key'} = Texinfo::Convert::Text::convert(
47 {'contents' => $entry->{'content'}}, $options);