[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5] packages: Support for full Guix specification
From: |
Olivier Dion |
Subject: |
[PATCH v5] packages: Support for full Guix specification |
Date: |
Mon, 23 May 2022 17:45:07 -0400 |
Guix package specifications match:
PACKAGE [@VERSION] [:OUTPUT]
thus the following are all valid package specifications:
- "guile"
- "guile@3.0.8"
- "guile:debug"
- "guile@3.0.8:debug"
This is not currently supported by gwl. To do so, simply mark the package with
its output through Guile's object properties infrastructure.
The `package-output' procedure can then be used to retrieve the package's
output.
---
gwl/packages.scm | 22 +++++++++++++++++-----
gwl/processes.scm | 5 ++++-
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/gwl/packages.scm b/gwl/packages.scm
index 6fe82d4..6a598ba 100644
--- a/gwl/packages.scm
+++ b/gwl/packages.scm
@@ -31,18 +31,22 @@
inferior-package-version
inferior-package-native-inputs
inferior-package-derivation))
+ #:use-module ((guix ui)
+ #:select (package-specification->name+version+output))
#:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
+ #:use-module (srfi srfi-71)
#:export (current-guix
inferior-store
lookup-package
valid-package?
package-name
+ package-output
bash-minimal
build-time-guix
@@ -73,11 +77,17 @@
(define (lookup-package specification)
(log-event 'guix (G_ "Looking up package `~a'~%") specification)
- (match (lookup-inferior-packages (current-guix) specification)
- ((first . rest) first)
- (_ (raise (condition
- (&gwl-package-error
- (package-spec specification)))))))
+ (let* ((name version output
+ (package-specification->name+version+output specification))
+ (inferior-package
+ (lookup-inferior-packages (current-guix) name version))
+ (package (match inferior-package
+ ((first . rest) first)
+ (_ (raise (condition
+ (&gwl-package-error
+ (package-spec specification))))))))
+ (set! (package-output package) output)
+ package))
(define (valid-package? val)
(or (package? val)
@@ -100,6 +110,8 @@ the version. By default, DELIMITER is \"@\"."
((? inferior-package? pkg)
(inferior-package-full-name pkg))))
+(define package-output (make-object-property))
+
(define bash-minimal
(mlambda ()
(lookup-package "bash-minimal")))
diff --git a/gwl/processes.scm b/gwl/processes.scm
index ce40d12..4fc4d6d 100644
--- a/gwl/processes.scm
+++ b/gwl/processes.scm
@@ -643,7 +643,10 @@ PROCESS."
(let* ((name (process-full-name process))
(packages (cons (bash-minimal)
(process-packages process)))
- (manifest (packages->manifest packages))
+ (manifest (packages->manifest (map
+ (lambda (pkg)
+ (list pkg (package-output pkg)))
+ packages)))
(profile (profile (content manifest)))
(search-paths (delete-duplicates
(map search-path-specification->sexp
--
2.36.0