guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: maint: update-NEWS: Sort packages prior writing to the data file.


From: guix-commits
Subject: 01/02: maint: update-NEWS: Sort packages prior writing to the data file.
Date: Mon, 10 May 2021 13:49:10 -0400 (EDT)

apteryx pushed a commit to branch version-1.3.0
in repository guix.

commit ed2d4d52dde00bdccc1bb2c93b24ffcc72a7fcd3
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon May 10 12:23:55 2021 -0400

    maint: update-NEWS: Sort packages prior writing to the data file.
    
    * build-aux/update-NEWS.scm (main): Sort packages.
---
 build-aux/update-NEWS.scm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/build-aux/update-NEWS.scm b/build-aux/update-NEWS.scm
index e916f3f..c029d2f 100644
--- a/build-aux/update-NEWS.scm
+++ b/build-aux/update-NEWS.scm
@@ -166,16 +166,22 @@ paragraph."
          (string-append data-directory "/packages-"
                         version ".txt"))
 
+       (define (package<? p1 p2)
+         (string<? (package-full-name p1) (package-full-name p2)))
+
        (let-values (((previous-version new-version)
                      (call-with-input-file news-file NEWS->versions)))
          (format (current-error-port) "Updating NEWS for ~a to ~a...~%"
                  previous-version new-version)
          (let* ((old (call-with-input-file (package-file previous-version)
                        read))
-                (new (fold-packages (lambda (p r)
-                                      (alist-cons (package-name p) 
(package-version p)
-                                                  r))
-                                    '())))
+                (all-packages/sorted (sort (fold-packages (lambda (p r)
+                                                            (cons p r))
+                                                          '())
+                                           package<?))
+                (new (map (lambda (p)
+                            (cons (package-name p) (package-version p)))
+                          all-packages/sorted)))
            (call-with-output-file (package-file new-version)
              (lambda (port)
                (pretty-print new port)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]