File: reproducible-build.patch

package info (click to toggle)
rust-i18n-embed-fl 0.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 188 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download
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
From 5352ed9a4c049705bd44ffa016511dec213b5bfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= <mikrutrafal@protonmail.com>
Date: Mon, 21 Apr 2025 08:25:55 +0200
Subject: [PATCH] Fix non-reproducible builds
Bug: https://github.com/qarmin/czkawka/issues/1507
Bug: https://github.com/kellpossible/cargo-i18n/issues/150
Origin: https://github.com/kellpossible/cargo-i18n/pull/151
---
 src/lib.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/src/lib.rs
+++ b/src/lib.rs
@@ -492,8 +492,12 @@
             }
         }
         FlArgs::KeyValuePairs { specified_args } => {
+            // The iteration order of a HashMap in Rust is not guaranteed to be consistent.
+            let mut sorted_specified_args: Vec<_> = specified_args.iter().clone().collect();
+            sorted_specified_args.sort_by_key(|(s, _)| s.value());
+
             let mut arg_assignments = proc_macro2::TokenStream::default();
-            for (key, value) in &specified_args {
+            for (key, value) in &sorted_specified_args {
                 arg_assignments = quote! {
                     #arg_assignments
                     args.insert(#key, #value.into());