Move 'specification->package+output' to (gnu packages).
* guix/scripts/package.scm (specification->package+output): Move to... * gnu/packages.scm (specification->package+output): ... here * guix/scripts/archive.scm (guix): Adjust accordingly.
This commit is contained in:
parent
08fa76131e
commit
84189ebc66
|
@ -51,7 +51,8 @@
|
||||||
|
|
||||||
check-package-freshness
|
check-package-freshness
|
||||||
|
|
||||||
specification->package))
|
specification->package
|
||||||
|
specification->package+output))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;;
|
;;;
|
||||||
|
@ -418,3 +419,36 @@ present, return the preferred newest version."
|
||||||
(leave (_ "~A: package not found for version ~a~%")
|
(leave (_ "~A: package not found for version ~a~%")
|
||||||
name version)
|
name version)
|
||||||
(leave (_ "~A: unknown package~%") name))))))
|
(leave (_ "~A: unknown package~%") name))))))
|
||||||
|
|
||||||
|
(define* (specification->package+output spec #:optional (output "out"))
|
||||||
|
"Return the package and output specified by SPEC, or #f and #f; SPEC may
|
||||||
|
optionally contain a version number and an output name, as in these examples:
|
||||||
|
|
||||||
|
guile
|
||||||
|
guile-2.0.9
|
||||||
|
guile:debug
|
||||||
|
guile-2.0.9:debug
|
||||||
|
|
||||||
|
If SPEC does not specify a version number, return the preferred newest
|
||||||
|
version; if SPEC does not specify an output, return OUTPUT."
|
||||||
|
(define (ensure-output p sub-drv)
|
||||||
|
(if (member sub-drv (package-outputs p))
|
||||||
|
sub-drv
|
||||||
|
(leave (_ "package `~a' lacks output `~a'~%")
|
||||||
|
(package-full-name p)
|
||||||
|
sub-drv)))
|
||||||
|
|
||||||
|
(let-values (((name version sub-drv)
|
||||||
|
(package-specification->name+version+output spec output)))
|
||||||
|
(match (find-best-packages-by-name name version)
|
||||||
|
((p)
|
||||||
|
(values p (ensure-output p sub-drv)))
|
||||||
|
((p p* ...)
|
||||||
|
(warning (_ "ambiguous package specification `~a'~%")
|
||||||
|
spec)
|
||||||
|
(warning (_ "choosing ~a from ~a~%")
|
||||||
|
(package-full-name p)
|
||||||
|
(location->string (package-location p)))
|
||||||
|
(values p (ensure-output p sub-drv)))
|
||||||
|
(()
|
||||||
|
(leave (_ "~a: package not found~%") spec)))))
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#:use-module (guix ui)
|
#:use-module (guix ui)
|
||||||
#:use-module (guix pki)
|
#:use-module (guix pki)
|
||||||
#:use-module (guix pk-crypto)
|
#:use-module (guix pk-crypto)
|
||||||
|
#:use-module (guix scripts build)
|
||||||
|
#:use-module (gnu packages)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
#:use-module (ice-9 rdelim)
|
#:use-module (ice-9 rdelim)
|
||||||
|
@ -34,8 +36,6 @@
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (srfi srfi-37)
|
#:use-module (srfi srfi-37)
|
||||||
#:use-module (guix scripts build)
|
|
||||||
#:use-module (guix scripts package)
|
|
||||||
#:use-module (rnrs io ports)
|
#:use-module (rnrs io ports)
|
||||||
#:export (guix-archive))
|
#:export (guix-archive))
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@
|
||||||
#:use-module (gnu packages base)
|
#:use-module (gnu packages base)
|
||||||
#:use-module (gnu packages guile)
|
#:use-module (gnu packages guile)
|
||||||
#:use-module ((gnu packages bootstrap) #:select (%bootstrap-guile))
|
#:use-module ((gnu packages bootstrap) #:select (%bootstrap-guile))
|
||||||
#:export (specification->package+output
|
#:export (switch-to-generation
|
||||||
switch-to-generation
|
|
||||||
switch-to-previous-generation
|
switch-to-previous-generation
|
||||||
roll-back
|
roll-back
|
||||||
delete-generation
|
delete-generation
|
||||||
|
@ -324,39 +323,6 @@ similar."
|
||||||
(primitive-_exit 0)
|
(primitive-_exit 0)
|
||||||
(apply throw args)))))
|
(apply throw args)))))
|
||||||
|
|
||||||
(define* (specification->package+output spec #:optional (output "out"))
|
|
||||||
"Return the package and output specified by SPEC, or #f and #f; SPEC may
|
|
||||||
optionally contain a version number and an output name, as in these examples:
|
|
||||||
|
|
||||||
guile
|
|
||||||
guile-2.0.9
|
|
||||||
guile:debug
|
|
||||||
guile-2.0.9:debug
|
|
||||||
|
|
||||||
If SPEC does not specify a version number, return the preferred newest
|
|
||||||
version; if SPEC does not specify an output, return OUTPUT."
|
|
||||||
(define (ensure-output p sub-drv)
|
|
||||||
(if (member sub-drv (package-outputs p))
|
|
||||||
sub-drv
|
|
||||||
(leave (_ "package `~a' lacks output `~a'~%")
|
|
||||||
(package-full-name p)
|
|
||||||
sub-drv)))
|
|
||||||
|
|
||||||
(let-values (((name version sub-drv)
|
|
||||||
(package-specification->name+version+output spec output)))
|
|
||||||
(match (find-best-packages-by-name name version)
|
|
||||||
((p)
|
|
||||||
(values p (ensure-output p sub-drv)))
|
|
||||||
((p p* ...)
|
|
||||||
(warning (_ "ambiguous package specification `~a'~%")
|
|
||||||
spec)
|
|
||||||
(warning (_ "choosing ~a from ~a~%")
|
|
||||||
(package-full-name p)
|
|
||||||
(location->string (package-location p)))
|
|
||||||
(values p (ensure-output p sub-drv)))
|
|
||||||
(()
|
|
||||||
(leave (_ "~a: package not found~%") spec)))))
|
|
||||||
|
|
||||||
(define (upgradeable? name current-version current-path)
|
(define (upgradeable? name current-version current-path)
|
||||||
"Return #t if there's a version of package NAME newer than CURRENT-VERSION,
|
"Return #t if there's a version of package NAME newer than CURRENT-VERSION,
|
||||||
or if the newest available version is equal to CURRENT-VERSION but would have
|
or if the newest available version is equal to CURRENT-VERSION but would have
|
||||||
|
|
Loading…
Reference in New Issue