summary refs log tree commit diff
path: root/build-aux/update-NEWS.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-05-11 22:42:59 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-05-11 22:42:59 -0400
commitb7cbca221f74e9e9ef43c228dca9fa9930babec5 (patch)
tree33d0c1b2ae9a09a6e50652f61cdb16c7ba5d9003 /build-aux/update-NEWS.scm
parentc80627731bc100baa4b6c5d265df5465cee9498e (diff)
parentfb5d04d36334784a5ac76c4a90de1e1376120885 (diff)
downloadguix-b7cbca221f74e9e9ef43c228dca9fa9930babec5.tar.gz
Merge branch 'version-1.3.0'
Diffstat (limited to 'build-aux/update-NEWS.scm')
-rw-r--r--build-aux/update-NEWS.scm18
1 files changed, 12 insertions, 6 deletions
diff --git a/build-aux/update-NEWS.scm b/build-aux/update-NEWS.scm
index a05ecad091..c029d2f0da 100644
--- a/build-aux/update-NEWS.scm
+++ b/build-aux/update-NEWS.scm
@@ -95,7 +95,7 @@ paragraph."
     (with-atomic-file-replacement news-file
       (lambda (input output)
         (rewrite-org-section input output
-                             (make-regexp "^(\\*+) (.*) new packages")
+                             (make-regexp "^(\\*+).*new packages")
                              (lambda (match port)
                                (let ((stars (match:substring match 1)))
                                  (format port
@@ -141,7 +141,7 @@ paragraph."
     (with-atomic-file-replacement news-file
       (lambda (input output)
         (rewrite-org-section input output
-                             (make-regexp "^(\\*+) (.*) package updates")
+                             (make-regexp "^(\\*+).*package updates")
                              (lambda (match port)
                                (let ((stars (match:substring match 1))
                                      (lst   (map (match-lambda
@@ -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)))