GNU bug report logs - #47986
[PATCH] inferior: Support querying package replacements.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Sat, 24 Apr 2021 05:46:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Christopher Baines <mail <at> cbaines.net>
Subject: bug#47986: closed (Re: bug#47986: [PATCH] inferior: Support
 querying package replacements.)
Date: Sat, 15 May 2021 11:16:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#47986: [PATCH] inferior: Support querying package replacements.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 47986 <at> debbugs.gnu.org.

-- 
47986: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47986
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Christopher Baines <mail <at> cbaines.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 47986-done <at> debbugs.gnu.org
Subject: Re: bug#47986: [PATCH] inferior: Support querying package
 replacements.
Date: Sat, 15 May 2021 12:15:49 +0100
[Message part 3 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Christopher Baines <mail <at> 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.
>> * tests/inferior.scm ("inferior-package-replacement"): New test.
>
> [...]
>
>> +(test-equal "inferior-package-replacement"
>> +  (package-derivation %store
>> +                      (or (package-replacement sqlite) sqlite)
>> +                      "x86_64-linux")
>> +  (let* ((inferior (open-inferior %top-builddir
>> +                                  #:command "scripts/guix"))
>> +         (packages (inferior-packages inferior)))
>> +    (match (lookup-inferior-packages inferior
>> +                                     (package-name sqlite)
>> +                                     (package-version sqlite))
>> +      ((inferior-sqlite rest ...)
>> +       (inferior-package-derivation %store
>> +                                    (or (inferior-package-replacement
>> +                                         inferior-sqlite)
>> +                                        inferior-sqlite)
>> +                                    "x86_64-linux")))))
>
> Problem is that this test assumes sqlite has a replacement.  Maybe
> precede it:
>
>   (unless (package-replacement sqlite)
>     (test-skip 1))
>
> and remove (or (package-replacement …) …) and similar.
>
> That way we’ll notice when the test is skipped.

Sure, I've made those changes now.

> Otherwise LGTM, thanks!

Great, I've pushed this as 97d615b1761c2054561057f6b56e2a0caed13aa4.
[signature.asc (application/pgp-signature, inline)]
[Message part 5 (message/rfc822, inline)]
From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] inferior: Support querying package replacements.
Date: Sat, 24 Apr 2021 06:45:09 +0100
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




This bug report was last modified 4 years and 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.