[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4] packages: Support for full Guix specification
From: |
Olivier Dion |
Subject: |
[PATCH v4] packages: Support for full Guix specification |
Date: |
Sun, 22 May 2022 08:38:44 -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 | 24 +++++++++++++++++++-----
gwl/processes.scm | 5 ++++-
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/gwl/packages.scm b/gwl/packages.scm
index 6fe82d4..23bc09d 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,18 @@
(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)))
+ (let* ((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-object-property! package #:gwl/package-output output)
+ package)))
(define (valid-package? val)
(or (package? val)
@@ -100,6 +111,9 @@ the version. By default, DELIMITER is \"@\"."
((? inferior-package? pkg)
(inferior-package-full-name pkg))))
+(define (package-output pkg)
+ (object-property pkg #:gwl/package-output))
+
(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
- [PATCH v4] packages: Support for full Guix specification,
Olivier Dion <=