guix package: Clarify upgrade code.
* guix/scripts/package.scm (upgradeable?): Rename to... (upgraded-manifest-entry): ... this. Change to take a <manifest-entry> and to return a <manifest-entry>. (options->installable)[to-upgrade]: Adjust accordingly.
This commit is contained in:
parent
6fabb196e3
commit
dd72173455
|
@ -261,19 +261,25 @@ synopsis or description matches all of REGEXPS."
|
||||||
((<) #t)
|
((<) #t)
|
||||||
(else #f)))))
|
(else #f)))))
|
||||||
|
|
||||||
(define (upgradeable? name current-version current-path)
|
(define (upgraded-manifest-entry entry)
|
||||||
"Return #t if there's a version of package NAME newer than CURRENT-VERSION,
|
"Return either a <manifest-entry> corresponding to an upgrade of ENTRY, or
|
||||||
or if the newest available version is equal to CURRENT-VERSION but would have
|
#f if no upgrade was found."
|
||||||
an output path different than CURRENT-PATH."
|
(match entry
|
||||||
(match (vhash-assoc name (find-newest-available-packages))
|
(($ <manifest-entry> name version output (? string? path))
|
||||||
((_ candidate-version pkg . rest)
|
(match (vhash-assoc name (find-newest-available-packages))
|
||||||
(case (version-compare candidate-version current-version)
|
((_ candidate-version pkg . rest)
|
||||||
((>) #t)
|
(case (version-compare candidate-version version)
|
||||||
((<) #f)
|
((>)
|
||||||
((=) (let ((candidate-path (derivation->output-path
|
(package->manifest-entry pkg output))
|
||||||
(package-derivation (%store) pkg))))
|
((<)
|
||||||
(not (string=? current-path candidate-path))))))
|
#f)
|
||||||
(#f #f)))
|
((=)
|
||||||
|
(let ((candidate-path (derivation->output-path
|
||||||
|
(package-derivation (%store) pkg))))
|
||||||
|
(and (not (string=? path candidate-path))
|
||||||
|
(package->manifest-entry pkg output))))))
|
||||||
|
(#f
|
||||||
|
#f)))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
@ -560,16 +566,9 @@ return the new list of manifest entries."
|
||||||
(options->upgrade-predicate opts))
|
(options->upgrade-predicate opts))
|
||||||
|
|
||||||
(define to-upgrade
|
(define to-upgrade
|
||||||
(filter-map (match-lambda
|
(filter-map (lambda (entry)
|
||||||
(($ <manifest-entry> name version output path _)
|
(and (upgrade? (manifest-entry-name entry))
|
||||||
(and (upgrade? name)
|
(upgraded-manifest-entry entry)))
|
||||||
(upgradeable? name version path)
|
|
||||||
(let ((output (or output "out")))
|
|
||||||
(call-with-values
|
|
||||||
(lambda ()
|
|
||||||
(specification->package+output name output))
|
|
||||||
package->manifest-entry))))
|
|
||||||
(_ #f))
|
|
||||||
(manifest-entries manifest)))
|
(manifest-entries manifest)))
|
||||||
|
|
||||||
(define to-install
|
(define to-install
|
||||||
|
|
Loading…
Reference in New Issue