refresh: Report suggested input changes with 'info'.

* guix/scripts/refresh.scm (update-package): Define 'field', 'name',
'loc', and 'change-name'.  Use 'info' rather than 'format' to report
suggested input changes.
This commit is contained in:
Ludovic Courtès 2021-10-15 23:14:47 +02:00
parent 7770016402
commit 058ea2672b
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 34 additions and 18 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Alex Kost <alezost@gmail.com> ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
@ -329,23 +329,39 @@ warn about packages that have no matching updater."
(package-version package) version) (package-version package) version)
(for-each (for-each
(lambda (change) (lambda (change)
(format (current-error-port) (define field
(match (list (upstream-input-change-action change) (match (upstream-input-change-type change)
(upstream-input-change-type change)) ('native 'native-inputs)
(('add 'regular) ('propagated 'propagated-inputs)
(G_ "~a: consider adding this input: ~a~%")) (_ 'inputs)))
(('add 'native)
(G_ "~a: consider adding this native input: ~a~%")) (define name
(('add 'propagated) (package-name package))
(G_ "~a: consider adding this propagated input: ~a~%")) (define loc
(('remove 'regular) (package-field-location package field))
(G_ "~a: consider removing this input: ~a~%")) (define change-name
(('remove 'native) (upstream-input-change-name change))
(G_ "~a: consider removing this native input: ~a~%"))
(('remove 'propagated) (match (list (upstream-input-change-action change)
(G_ "~a: consider removing this propagated input: ~a~%"))) (upstream-input-change-type change))
(package-name package) (('add 'regular)
(upstream-input-change-name change))) (info loc (G_ "~a: consider adding this input: ~a~%")
name change-name))
(('add 'native)
(info loc (G_ "~a: consider adding this native input: ~a~%")
name change-name))
(('add 'propagated)
(info loc (G_ "~a: consider adding this propagated input: ~a~%")
name change-name))
(('remove 'regular)
(info loc (G_ "~a: consider removing this input: ~a~%")
name change-name))
(('remove 'native)
(info loc (G_ "~a: consider removing this native input: ~a~%")
name change-name))
(('remove 'propagated)
(info loc (G_ "~a: consider removing this propagated input: ~a~%")
name change-name))))
(upstream-source-input-changes source)) (upstream-source-input-changes source))
(let ((hash (call-with-input-file tarball (let ((hash (call-with-input-file tarball
port-sha256))) port-sha256)))