unofficial mirror of gwl-devel@gnu.org
 help / color / mirror / Atom feed
From: Olivier Dion <olivier.dion@polymtl.ca>
To: Olivier Dion <olivier.dion@polymtl.ca>,
	Olivier Dion via <gwl-devel@gnu.org>
Subject: [PATCH v5] packages: Support for full Guix specification
Date: Mon, 23 May 2022 17:45:07 -0400	[thread overview]
Message-ID: <20220523214507.6154-1-olivier.dion@polymtl.ca> (raw)
In-Reply-To: <20220522123844.23527-1-olivier.dion@polymtl.ca>

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



  parent reply	other threads:[~2022-05-23 21:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 17:22 Packages specification does not work Olivier Dion via
2022-04-21 18:25 ` Olivier Dion via
2022-04-21 19:51 ` [PATCH v1 1/2] packages: Support for full Guix specification Olivier Dion
2022-04-21 19:51   ` [PATCH v1 2/2] pre-inst-env.in: Export GUIX_EXTENSIONS_PATH Olivier Dion
2022-04-29 11:42     ` Ricardo Wurmus
2022-04-21 20:10   ` [PATCH v1 1/2] packages: Support for full Guix specification Olivier Dion via
2022-04-22 18:43   ` [PATCH v2 0/2] Support full package specifications Olivier Dion
2022-04-22 18:43     ` [PATCH v2 1/2] packages: Support for full Guix specification Olivier Dion
2022-04-26 18:11       ` Ricardo Wurmus
2022-04-26 18:59         ` Olivier Dion via
2022-04-26 20:30           ` Ricardo Wurmus
2022-04-26 21:52             ` Olivier Dion via
2022-04-22 18:43     ` [PATCH v2 2/2] pre-inst-env.in: Export GUIX_EXTENSIONS_PATH Olivier Dion
2022-04-29  9:00       ` zimoun
2022-04-29 18:02     ` [PATCH v3 0/1] Support full package specifications Olivier Dion
2022-04-29 18:02       ` [PATCH v3 1/1] packages: Support for full Guix specification Olivier Dion
2022-05-22  6:43         ` Ricardo Wurmus
2022-05-22 12:33           ` Olivier Dion via
2022-05-17 20:40       ` [PATCH v3 0/1] Support full package specifications Olivier Dion via
2022-05-22 12:38       ` [PATCH v4] packages: Support for full Guix specification Olivier Dion
2022-05-23 21:02         ` Ricardo Wurmus
2022-05-23 21:45         ` Olivier Dion [this message]
2022-06-01 13:07           ` [PATCH v5] " Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.guixwl.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220523214507.6154-1-olivier.dion@polymtl.ca \
    --to=olivier.dion@polymtl.ca \
    --cc=gwl-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).