unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / 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
  2021-05-14  8:42 ` [bug#47986] [PATCH v2] " Christopher Baines
  0 siblings, 2 replies; 6+ 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 related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-15 11:16 UTC | newest]

Thread overview: 6+ 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
2021-05-14  8:45   ` Christopher Baines
2021-05-14  8:42 ` [bug#47986] [PATCH v2] " Christopher Baines
2021-05-15 10:11   ` [bug#47986] [PATCH] " Ludovic Courtès
2021-05-15 11:15     ` bug#47986: " Christopher Baines

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).