Subject: [bug#74979] [PATCH v2 3/4] scripts: style: Only sort packages with string literal name.

From: Herman Rimm <[email-masked]>
Date: Tue, 21 Jan 2025 22:43:02 +0100

* guix/scripts/style.scm (order-packages): Only match string literals.

Change-Id: I48a5976930501c20415b5413966b5294958bc23b
---
 guix/scripts/style.scm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 6f07f6c3b9e..4801529f7e9 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -515,11 +515,13 @@ (define (order-packages lst)
   (define (package>? lst1 lst2)
     (let-values (((name1 version1) (package-fields lst1))
                  ((name2 version2) (package-fields lst2)))
-      (and name1 name2 (or (string>? name1 name2)
-                           (and (string=? name1 name2)
-                                version1
-                                version2
-                                (version>? version2 version1))))))
+      (and (string? name1)
+           (string? name2)
+           (or (string>? name1 name2)
+               (and (string=? name1 name2)
+                    (string? version1)
+                    (string? version2)
+                    (version>? version2 version1))))))
 
         ;; Group define-public with preceding blanks and defines.
   (let ((lst (fold2 (lambda (expr tail head)
-- 
2.47.1