all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / Atom feed
* [bug#47986] [PATCH] inferior: Support querying package replacements.
@ 2021-04-24  5:45 Christopher Baines
  2021-05-03 20:50 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Baines @ 2021-04-24  5:45 UTC (permalink / raw)
  To: 47986

I'm looking at this to help with adding support for looking up package
replacements to store in the Guix Data Service.

* guix/inferior.scm (inferior-package-replacement): New procedure.
---
 guix/inferior.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index eb457f81f9..19607724c0 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -90,6 +90,7 @@
             inferior-package-native-search-paths
             inferior-package-transitive-native-search-paths
             inferior-package-search-paths
+            inferior-package-replacement
             inferior-package-provenance
             inferior-package-derivation
 
@@ -462,6 +463,25 @@ package."
 (define inferior-package-transitive-native-search-paths
   (cut %inferior-package-search-paths <> 'package-transitive-native-search-paths))
 
+(define (inferior-package-replacement package)
+  (match (inferior-package-field
+          package
+          '(compose (match-lambda
+                      ((? package? package)
+                       (let ((id (object-address package)))
+                         (hashv-set! %package-table id package)
+                         (list id
+                               (package-name package)
+                               (package-version package))))
+                      (#f #f))
+                    package-replacement))
+    (#f #f)
+    ((id name version)
+     (inferior-package (inferior-package-inferior package)
+                       name
+                       version
+                       id))))
+
 (define (inferior-package-provenance package)
   "Return a \"provenance sexp\" for PACKAGE, an inferior package.  The result
 is similar to the sexp returned by 'package-provenance' for regular packages."
-- 
2.30.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [bug#47986] [PATCH] inferior: Support querying package replacements.
  2021-04-24  5:45 [bug#47986] [PATCH] inferior: Support querying package replacements Christopher Baines
@ 2021-05-03 20:50 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2021-05-03 20:50 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 47986

Hi,

Christopher Baines <mail@cbaines.net> skribis:

> I'm looking at this to help with adding support for looking up package
> replacements to store in the Guix Data Service.
>
> * guix/inferior.scm (inferior-package-replacement): New procedure.

Could you add a docstring and ideally a test?  (There might be
complications for the test, let’s see how it goes.)

Thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-03 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24  5:45 [bug#47986] [PATCH] inferior: Support querying package replacements Christopher Baines
2021-05-03 20:50 ` Ludovic Courtès

all messages for Guix-related lists mirrored at yhetil.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix

Example config snippet for mirrors.


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git