profiles: manifest-lookup-package: Optionally match version prefix.
* guix/profiles.scm (manifest-lookup-package): Optionally filter store item matches by version prefix.
This commit is contained in:
parent
f3cfe4515a
commit
2c9f4786c9
|
@ -472,21 +472,30 @@ replace it."
|
||||||
(cons (gexp-input thing output) deps)))
|
(cons (gexp-input thing output) deps)))
|
||||||
(manifest-entries manifest)))
|
(manifest-entries manifest)))
|
||||||
|
|
||||||
(define (manifest-lookup-package manifest name)
|
(define* (manifest-lookup-package manifest name #:optional version)
|
||||||
"Return as a monadic value the first package or store path referenced by
|
"Return as a monadic value the first package or store path referenced by
|
||||||
MANIFEST that named NAME, or #f if not found."
|
MANIFEST that is named NAME and optionally has the given VERSION prefix, or #f
|
||||||
|
if not found."
|
||||||
;; Return as a monadic value the package or store path referenced by the
|
;; Return as a monadic value the package or store path referenced by the
|
||||||
;; manifest ENTRY, or #f if not referenced.
|
;; manifest ENTRY, or #f if not referenced.
|
||||||
(define (entry-lookup-package entry)
|
(define (entry-lookup-package entry)
|
||||||
(define (find-among-inputs inputs)
|
(define (find-among-inputs inputs)
|
||||||
(find (lambda (input)
|
(find (lambda (input)
|
||||||
(and (package? input)
|
(and (package? input)
|
||||||
(equal? name (package-name input))))
|
(equal? name (package-name input))
|
||||||
|
(if version
|
||||||
|
(string-prefix? version (package-version input))
|
||||||
|
#t)))
|
||||||
inputs))
|
inputs))
|
||||||
(define (find-among-store-items items)
|
(define (find-among-store-items items)
|
||||||
(find (lambda (item)
|
(find (lambda (item)
|
||||||
(equal? name (package-name->name+version
|
(let-values (((pkg-name pkg-version)
|
||||||
|
(package-name->name+version
|
||||||
(store-path-package-name item))))
|
(store-path-package-name item))))
|
||||||
|
(and (equal? name pkg-name)
|
||||||
|
(if version
|
||||||
|
(string-prefix? version pkg-version)
|
||||||
|
#t))))
|
||||||
items))
|
items))
|
||||||
|
|
||||||
;; TODO: Factorize.
|
;; TODO: Factorize.
|
||||||
|
|
Loading…
Reference in New Issue