Subject: bug#78012: [PATCH] gnu: mia: Fix determinism in the build

From: [email-masked]
Date: Wed, 23 Apr 2025 21:08:59 +0000

From: Ashish SHUKLA <[email-masked]>

* gnu/packages/image-processing.scm (mia)[arguments]: Add phases.

Change-Id: I5da0e31e03f0bc20b1930aa2cff0a784a43526ce
---
Hi,

This patch patches miareadxml.py in the similar way as it's handled in other scripts in doc scripts[0].

guix build --rounds=2 passed with this patch.

References:
[0] grep -F sorted doc/

 gnu/packages/image-processing.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 14bfdbfb20..c93feb1c30 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2022 Paul A. Patience <[email-masked]>
 ;;; Copyright © 2023 Cairn <[email-masked]>
 ;;; Copyright © 2024 Nicolas Graves <[email-masked]>
+;;; Copyright © 2025 Ashish SHUKLA <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -228,7 +229,15 @@ (define-public mia
     (arguments
      `(#:configure-flags
        (list "-DMIA_CREATE_NIPYPE_INTERFACES=OFF"
-             "-DCMAKE_CXX_FLAGS=-fpermissive")))
+             "-DCMAKE_CXX_FLAGS=-fpermissive")
+       #:phases
+       ,#~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-for-deterministic-manpages
+              (lambda _
+                (substitute* "doc/miareadxml.py"
+                  ;; sort the flags so the order is deterministic
+                  (("in self[.]flags")
+                   "in sorted(self.flags)")))))))
     (inputs
      (list boost
            dcmtk

base-commit: 6cf0f3cbb649b8be21dcc6337ef394902c4bd56c
-- 
2.49.0