Source: home-assistant-intents
Version: 2026.3.3-2
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: randomness
X-Debbugs-Cc: [email protected]

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
home-assistant-intents could not be built reproducibly.

This is because it creates the various json files in a non-reproducible
manner.

Patch attached, although the method is somewhat inefficent. Upstream
should likely rework the merged_output.py script and build the temporary
data structures in a way more amenable to sorting.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
--- a/debian/patches/reproducible-json.patch    1970-01-01 00:00:00.000000000 
+0000
--- b/debian/patches/reproducible-json.patch    2026-11-30 21:48:29.237845593 
+0000
@@ -0,0 +1,24 @@
+Description: Make the build reproducible
+Author: Chris Lamb <[email protected]>
+Last-Update: 2026-11-30
+
+--- home-assistant-intents-2026.3.3.orig/script/merged_output.py
++++ home-assistant-intents-2026.3.3/script/merged_output.py
+@@ -98,7 +98,7 @@ def main() -> None:
+ 
+             num_intent_sentences = 0
+             data = []
+-            for data_set in info["data"]:
++            for data_set in sorted(info["data"], key=lambda x: json.dumps(x, 
ensure_ascii=False, indent=2, sort_keys=True)):
+                 if len(data_set["sentences"]) > 0:
+                     data.append(data_set)
+                     num_intent_sentences += len(data_set["sentences"])
+@@ -148,7 +148,7 @@ def main() -> None:
+         # Write as JSON
+         target_path = target / f"{language}.json"
+         with target_path.open("w", encoding="utf-8") as target_file:
+-            json.dump(output, target_file, ensure_ascii=False, indent=2)
++            json.dump(output, target_file, ensure_ascii=False, indent=2, 
sort_keys=True)
+ 
+         num_processed_languages += 1
+ 
--- a/debian/patches/series     1970-01-01 00:00:00.000000000 +0000
--- b/debian/patches/series     2026-11-30 21:38:35.976083861 +0000
@@ -0,0 +1 @@
+reproducible-json.patch

Reply via email to