summaryrefslogtreecommitdiff
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
parent273cce9875a1deba2b6669099e69824db55c9622 (diff)
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.
-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 a9dffef1d22..bf5f0e141bb 100644
--- a/build-aux/update-NEWS.scm
+++ b/build-aux/update-NEWS.scm
@@ -30,6 +30,7 @@
30 (ice-9 match) 30 (ice-9 match)
31 (ice-9 rdelim) 31 (ice-9 rdelim)
32 (ice-9 regex) 32 (ice-9 regex)
33 (ice-9 vlist)
33 (ice-9 pretty-print)) 34 (ice-9 pretty-print))
34 35
35(define %header-rx 36(define %header-rx
@@ -98,31 +99,60 @@ paragraph."
98 (lambda (match port) 99 (lambda (match port)
99 (let ((stars (match:substring match 1))) 100 (let ((stars (match:substring match 1)))
100 (format port 101 (format port
101 "~a ~a new packages~%~%~a~%~%" 102 "~a ~a new packages~%~%"
102 stars (length added) 103 stars (length added)))))))))
103 (enumeration->paragraph added)))))))))
104 104
105(define (write-packages-updates news-file old new) 105(define (write-packages-updates news-file old new)
106 "Write to NEWS-FILE the list of packages upgraded between OLD and NEW." 106 "Write to NEWS-FILE the list of packages upgraded between OLD and NEW."
107 (let ((upgraded (filter-map (match-lambda 107 (define important
108 ((package . new-version) 108 '("gcc" "glibc" "binutils" "gdb" ;toolchain
109 (match (assoc package old) 109 "shepherd" "linux-libre" "xorg-server" "cups" ;OS
110 ((_ . old-version) 110 "gnome" "xfce" "enlightenment" "lxde" "mate" ;desktop env.
111 (and (version>? new-version old-version) 111 "guile" "bash" "python" "python2" "perl" ;languages
112 (string-append package "@" 112 "ghc" "rust" "go" "julia" "r" "ocaml"
113 new-version))) 113 "icedtea" "openjdk" "clojure" "sbcl" "racket"
114 (_ #f)))) 114 "emacs" "gimp" "inkscape" "libreoffice" ;applications
115 new))) 115 "octave" "icecat" "gnupg"))
116
117 (let* ((table (fold (lambda (package table)
118 (match package
119 ((name . version)
120 (vhash-cons name version table))))
121 vlist-null
122 new))
123 (latest (lambda (name)
124 (let ((versions (vhash-fold* cons '() name table)))
125 (match (sort versions version>?)
126 ((latest . _) latest)))))
127 (upgraded (filter-map (match-lambda
128 ((package . new-version)
129 (match (assoc package old)
130 ((_ . old-version)
131 (and (string=? new-version
132 (latest package))
133 (version>? new-version old-version)
134 (cons package new-version)))
135 (_ #f))))
136 new))
137 (noteworthy (filter (match-lambda
138 ((package . version)
139 (member package important)))
140 upgraded)))
116 (with-atomic-file-replacement news-file 141 (with-atomic-file-replacement news-file
117 (lambda (input output) 142 (lambda (input output)
118 (rewrite-org-section input output 143 (rewrite-org-section input output
119 (make-regexp "^(\\*+) (.*) package updates") 144 (make-regexp "^(\\*+) (.*) package updates")
120 (lambda (match port) 145 (lambda (match port)
121 (let ((stars (match:substring match 1))) 146 (let ((stars (match:substring match 1))
147 (lst (map (match-lambda
148 ((package . version)
149 (string-append package " "
150 version)))
151 noteworthy)))
122 (format port 152 (format port
123 "~a ~a package updates~%~%~a~%~%" 153 "~a ~a package updates~%~%Noteworthy updates:~%~a~%~%"
124 stars (length upgraded) 154 stars (length upgraded)
125 (enumeration->paragraph upgraded))))))))) 155 (enumeration->paragraph lst)))))))))
126 156
127 157
128(define (main . args) 158(define (main . args)
@@ -138,6 +168,8 @@ paragraph."
138 168
139 (let-values (((previous-version new-version) 169 (let-values (((previous-version new-version)
140 (call-with-input-file news-file NEWS->versions))) 170 (call-with-input-file news-file NEWS->versions)))
171 (format (current-error-port) "Updating NEWS for ~a to ~a...~%"
172 previous-version new-version)
141 (let* ((old (call-with-input-file (package-file previous-version) 173 (let* ((old (call-with-input-file (package-file previous-version)
142 read)) 174 read))
143 (new (fold-packages (lambda (p r) 175 (new (fold-packages (lambda (p r)