summary refs log tree commit diff
path: root/build-aux/update-NEWS.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-12-04 23:49:56 +0100
committerLudovic Courtès <ludo@gnu.org>2018-12-05 00:08:34 +0100
commite3c03952be99419b958e98e5934fb3b86f71165d (patch)
tree3abb38d883c04114bdb763ae6cab4d1a04b17461 /build-aux/update-NEWS.scm
parent273cce9875a1deba2b6669099e69824db55c9622 (diff)
downloadguix-e3c03952be99419b958e98e5934fb3b86f71165d.tar.gz
maint: update-NEWS: Don't produce full package lists.
The lists of new and upgraded packages in 'NEWS' had become way too long
and redundant with what 'guix pull' reports.

* build-aux/update-NEWS.scm (write-packages-added): Don't print ADDED.
(write-packages-updates)[important, table, latest, noteworthy]: New
variables.
Print NOTEWORTHY rather than all of UPGRADED.
(main): Print PREVIOUS-VERSION and NEW-VERSION.
Diffstat (limited to 'build-aux/update-NEWS.scm')
-rw-r--r--build-aux/update-NEWS.scm62
1 files changed, 47 insertions, 15 deletions
diff --git a/build-aux/update-NEWS.scm b/build-aux/update-NEWS.scm
index a9dffef1d2..bf5f0e141b 100644
--- a/build-aux/update-NEWS.scm
+++ b/build-aux/update-NEWS.scm
@@ -30,6 +30,7 @@
              (ice-9 match)
              (ice-9 rdelim)
              (ice-9 regex)
+             (ice-9 vlist)
              (ice-9 pretty-print))
 
 (define %header-rx
@@ -98,31 +99,60 @@ paragraph."
                              (lambda (match port)
                                (let ((stars (match:substring match 1)))
                                  (format port
-                                         "~a ~a new packages~%~%~a~%~%"
-                                         stars (length added)
-                                         (enumeration->paragraph added)))))))))
+                                         "~a ~a new packages~%~%"
+                                         stars (length added)))))))))
 
 (define (write-packages-updates news-file old new)
   "Write to NEWS-FILE the list of packages upgraded between OLD and NEW."
-  (let ((upgraded (filter-map (match-lambda
-                                ((package . new-version)
-                                 (match (assoc package old)
-                                   ((_ . old-version)
-                                    (and (version>? new-version old-version)
-                                         (string-append package "@"
-                                                        new-version)))
-                                   (_ #f))))
-                              new)))
+  (define important
+    '("gcc" "glibc" "binutils" "gdb"                   ;toolchain
+      "shepherd" "linux-libre" "xorg-server" "cups"    ;OS
+      "gnome" "xfce" "enlightenment" "lxde" "mate"     ;desktop env.
+      "guile" "bash" "python" "python2" "perl"         ;languages
+      "ghc" "rust" "go" "julia" "r" "ocaml"
+      "icedtea" "openjdk" "clojure" "sbcl" "racket"
+      "emacs" "gimp" "inkscape" "libreoffice"          ;applications
+      "octave" "icecat" "gnupg"))
+
+  (let* ((table    (fold (lambda (package table)
+                           (match package
+                             ((name . version)
+                              (vhash-cons name version table))))
+                         vlist-null
+                         new))
+         (latest   (lambda (name)
+                     (let ((versions (vhash-fold* cons '() name table)))
+                       (match (sort versions version>?)
+                         ((latest . _) latest)))))
+         (upgraded (filter-map (match-lambda
+                                 ((package . new-version)
+                                  (match (assoc package old)
+                                    ((_ . old-version)
+                                     (and (string=? new-version
+                                                    (latest package))
+                                          (version>? new-version old-version)
+                                          (cons package new-version)))
+                                    (_ #f))))
+                               new))
+         (noteworthy (filter (match-lambda
+                               ((package . version)
+                                (member package important)))
+                             upgraded)))
     (with-atomic-file-replacement news-file
       (lambda (input output)
         (rewrite-org-section input output
                              (make-regexp "^(\\*+) (.*) package updates")
                              (lambda (match port)
-                               (let ((stars (match:substring match 1)))
+                               (let ((stars (match:substring match 1))
+                                     (lst   (map (match-lambda
+                                                   ((package . version)
+                                                    (string-append package " "
+                                                                   version)))
+                                                 noteworthy)))
                                  (format port
-                                         "~a ~a package updates~%~%~a~%~%"
+                                         "~a ~a package updates~%~%Noteworthy updates:~%~a~%~%"
                                          stars (length upgraded)
-                                         (enumeration->paragraph upgraded)))))))))
+                                         (enumeration->paragraph lst)))))))))
 
 
 (define (main . args)
@@ -138,6 +168,8 @@ paragraph."
 
        (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)