mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
upstream: Honor package properties for ignored and extra inputs.
* guix/upstream.scm (update-package-inputs)[filtered-inputs] [regular-inputs, native-inputs, propagated-inputs]: New procedures. Use them in 'update-field' calls. * tests/guix-refresh.sh (GUIX_TEST_UPDATER_TARGETS): Add "libreoffice" to the dependencies of "the-test-package". Add 'updater-ignored-inputs' property to "the-test-package". * doc/guix.texi (Invoking guix refresh): Document it.
This commit is contained in:
parent
9e237fe0bd
commit
57ceb64e34
3 changed files with 69 additions and 5 deletions
|
@ -14359,6 +14359,36 @@ guix refresh -L /path/to/channel -u @var{package}
|
|||
|
||||
@xref{Creating a Channel}, on how to create a channel.
|
||||
|
||||
This command updates the version and source code hash of the package.
|
||||
Depending on the updater being used, it can also update the various
|
||||
@samp{inputs} fields of the package. In some cases, the updater might
|
||||
get inputs wrong---it might not know about an extra input that's
|
||||
necessary, or it might add an input that should be avoided.
|
||||
|
||||
@cindex @code{updater-extra-inputs}, package property
|
||||
@cindex @code{updater-ignored-inputs}, package property
|
||||
To address that, packagers can add properties stating inputs that should
|
||||
be added to those found by the updater or inputs that should be ignored:
|
||||
the @code{updater-extra-inputs} and @code{updater-ignored-inputs}
|
||||
properties pertain to ``regular'' inputs, and there are equivalent
|
||||
properties for @samp{native} and @samp{propagated} inputs. In the
|
||||
example below, we tell the updater that we need @samp{openmpi} as an
|
||||
additional input:
|
||||
|
||||
@lisp
|
||||
(define-public python-mpi4py
|
||||
(package
|
||||
(name "python-mpi4py")
|
||||
;; @dots{}
|
||||
(inputs (list openmpi))
|
||||
(properties
|
||||
'((updater-extra-inputs . ("openmpi"))))))
|
||||
@end lisp
|
||||
|
||||
That way, @command{guix refresh -u python-mpi4py} will leave the
|
||||
@samp{openmpi} input, even if it is not among the inputs it would
|
||||
normally add.
|
||||
|
||||
@item --select=[@var{subset}]
|
||||
@itemx -s @var{subset}
|
||||
Select all the packages in @var{subset}, one of @code{core}, @code{non-core}
|
||||
|
|
|
@ -557,11 +557,44 @@ (define unchanged?
|
|||
(G_ "~a: expected '~a' value: ~s~%")
|
||||
(package-name package) field new))))
|
||||
|
||||
(define (filtered-inputs source-inputs extra-property ignore-property)
|
||||
;; Return a procedure that behaves like SOURCE-INPUTS but additionally
|
||||
;; honors EXTRA-PROPERTY and IGNORE-PROPERTY from PACKAGE.
|
||||
(lambda (source)
|
||||
(let* ((inputs (source-inputs source))
|
||||
(properties (package-properties package))
|
||||
(ignore (or (assoc-ref properties ignore-property) '()))
|
||||
(extra (or (assoc-ref properties extra-property) '())))
|
||||
(append (if (null? ignore)
|
||||
inputs
|
||||
(remove (lambda (input)
|
||||
(member (upstream-input-downstream-name input)
|
||||
ignore))
|
||||
inputs))
|
||||
(map (lambda (name)
|
||||
(upstream-input
|
||||
(name name)
|
||||
(downstream-name name)))
|
||||
extra)))))
|
||||
|
||||
(define regular-inputs
|
||||
(filtered-inputs upstream-source-regular-inputs
|
||||
'updater-extra-inputs
|
||||
'updater-ignored-inputs))
|
||||
(define native-inputs
|
||||
(filtered-inputs upstream-source-native-inputs
|
||||
'updater-extra-native-inputs
|
||||
'updater-ignored-native-inputs))
|
||||
(define propagated-inputs
|
||||
(filtered-inputs upstream-source-propagated-inputs
|
||||
'updater-extra-propagated-inputs
|
||||
'updater-ignored-propagated-inputs))
|
||||
|
||||
(for-each update-field
|
||||
'(inputs native-inputs propagated-inputs)
|
||||
(list upstream-source-regular-inputs
|
||||
upstream-source-native-inputs
|
||||
upstream-source-propagated-inputs)
|
||||
(list regular-inputs
|
||||
native-inputs
|
||||
propagated-inputs)
|
||||
(list package-inputs
|
||||
package-native-inputs
|
||||
package-propagated-inputs)))
|
||||
|
|
|
@ -35,7 +35,7 @@ GUIX_TEST_UPDATER_TARGETS='
|
|||
("libreoffice" "" (("1.0" "file:///dev/null")))
|
||||
("idutils" "" (("'$idutils_version'" "file:///dev/null")))
|
||||
("the-test-package" "" (("5.5" "file://'$PWD/$module_dir'/source"
|
||||
("grep" "sed")))))'
|
||||
("grep" "sed" "libreoffice")))))'
|
||||
|
||||
# No newer version available.
|
||||
guix refresh -t test idutils # XXX: should return non-zero?
|
||||
|
@ -93,7 +93,8 @@ cat > "$module_dir/sample.scm"<<EOF
|
|||
(sha256
|
||||
(base32
|
||||
"086vqwk2wl8zfs47sq2xpjc9k066ilmb8z6dn0q6ymwjzlm196cd"))))
|
||||
(inputs (list coreutils tar))))
|
||||
(inputs (list coreutils tar))
|
||||
(properties '((updater-ignored-inputs . ("libreoffice"))))))
|
||||
EOF
|
||||
guix refresh -t test -L "$module_dir" the-test-package
|
||||
guix refresh -t test -L "$module_dir" the-test-package -u \
|
||||
|
|
Loading…
Reference in a new issue