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

* build-aux/update-NEWS.scm (main): Sort packages.
This commit is contained in:
Maxim Cournoyer 2021-05-10 12:23:55 -04:00
parent 7418a20074
commit ed2d4d52dd
No known key found for this signature in database
GPG Key ID: 1260E46482E63562

@ -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)))