GNU bug report logs - #48082
“guix environment -l” does not work with inferior packages

Previous Next

Package: guix;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Wed, 28 Apr 2021 16:20:02 UTC

Severity: important

To reply to this bug, email your comments to 48082 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#48082; Package guix. (Wed, 28 Apr 2021 16:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <rekado <at> elephly.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 28 Apr 2021 16:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: bug-guix <at> gnu.org
Subject: “guix environment -l” does
 not work with inferior packages
Date: Wed, 28 Apr 2021 18:19:31 +0200
I wanted to use an environment file that contains a package 
definition, and use it with inferiors.  Here is the full guix.scm:

--8<---------------cut here---------------start------------->8---
(use-modules
(guix channels)
(guix inferior)
(guix build-system gnu)
(guix packages)
(guix licenses)
(gnu packages)
(ice-9 match))

(define channels
 (list (channel
        (name 'guix-bimsb)
        (url "https://github.com/BIMSBbioinfo/guix-bimsb.git")
        (commit
         "be42b099867a29a68a9ffbf304dc7f9137b75fe3"))
       (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (commit
         "01e33a031e493477d930b9383d397fea012a3b1a")
        (introduction
         (make-channel-introduction
          "9edb3f66fd807b096b48283debdcddccfea34bad"
          (openpgp-fingerprint
           "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 
           54FA"))))))

(define (lookup name)
 (specification->package name))

(define (lookup-inferior name)
 (define inferior
   (inferior-for-channels channels))
 (match (lookup-inferior-packages inferior name)
   ((first . rest) first)
   (_ (error
       (format #false "Could not find package `~a'.~%" name)))))

(define (p name)
 (let* ((how (if (getenv "USE_GUIX_INFERIOR")
                 lookup-inferior lookup))
        (pkg (how name)))
   `(,name ,pkg)))

(define %version
 (symbol->string (with-input-from-file "VERSION" read)))

(define-public my-package
 (package
   (name "my-package")
   (version %version)
   (source
    (string-append (getcwd) "/my-package-" version ".tar.gz"))
   (build-system gnu-build-system)
   (inputs
    (map p (list "bwa"
                 "r-minimal"
                 "r-rmarkdown"
                 "python-wrapper"
                 "python-pyyaml")))
   (native-inputs
    (map p (list "autoconf"
                 "automake")))
   (home-page "TODO")
   (synopsis "TODO")
   (description "TODO")
   (license gpl3+)))

my-package
--8<---------------cut here---------------end--------------->8---

The idea was that you would use the provided channels with

   USE_GUIX_INFERIOR=t guix environment -l guix.scm

Unfortunately, this does not work, but there also is no error.  I 
end up in an environment where none of the declared inputs are 
available.  That’s because (guix scripts environments) has no 
facilities to deal with packages that are of type 
<inferior-package>.

-- 
Ricardo




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 28 Apr 2021 20:48:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#48082; Package guix. (Sun, 01 Aug 2021 14:14:02 GMT) Full text and rfc822 format available.

Message #10 received at 48082 <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 48082 <at> debbugs.gnu.org
Subject: Re: bug#48082: “guix environment -l” does not work with inferior packages
Date: Sun, 01 Aug 2021 16:13:13 +0200
Hello Ricardo,

Ricardo Wurmus <rekado <at> elephly.net> writes:

> I wanted to use an environment file that contains a package 
> definition, and use it with inferiors.  Here is the full guix.scm:
>
> [...]
>
> The idea was that you would use the provided channels with
>
>     USE_GUIX_INFERIOR=t guix environment -l guix.scm
>
> Unfortunately, this does not work, but there also is no error.  I 
> end up in an environment where none of the declared inputs are 
> available.  That’s because (guix scripts environments) has no 
> facilities to deal with packages that are of type 
> <inferior-package>.

Unfortunatly the environment file isn't self contained (VERSION and the
package source are missing), so I couldn't reproduce your issue.

I wanted to reproduce it since I think it may be a duplicate of #40272¹,
that is you can't build packages with inputs containing inferior-packages.

¹ https://issues.guix.gnu.org/40272

Cheers,
- Brice




Information forwarded to bug-guix <at> gnu.org:
bug#48082; Package guix. (Sun, 01 Aug 2021 16:09:01 GMT) Full text and rfc822 format available.

Message #13 received at 48082 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: 48082 <at> debbugs.gnu.org
Subject: Re: bug#48082: “guix environment -l” does not work with inferior packages
Date: Sun, 01 Aug 2021 18:07:55 +0200
Brice Waegeneire <brice <at> waegenei.re> writes:

> Hello Ricardo,
>
> Ricardo Wurmus <rekado <at> elephly.net> writes:
>
>> I wanted to use an environment file that contains a package 
>> definition, and use it with inferiors.  Here is the full 
>> guix.scm:
>>
>> [...]
>>
>> The idea was that you would use the provided channels with
>>
>>     USE_GUIX_INFERIOR=t guix environment -l guix.scm
>>
>> Unfortunately, this does not work, but there also is no error. 
>> I 
>> end up in an environment where none of the declared inputs are 
>> available.  That’s because (guix scripts environments) has no 
>> facilities to deal with packages that are of type 
>> <inferior-package>.
>
> Unfortunatly the environment file isn't self contained (VERSION 
> and the
> package source are missing), so I couldn't reproduce your issue.

This example was taken from the source code here:

   https://github.com/BIMSBbioinfo/pigx_sarscov2_ww/blob/main/manifest.scm
   https://github.com/BIMSBbioinfo/pigx_sarscov2_ww/blob/main/guix.scm

-- 
Ricardo




Information forwarded to bug-guix <at> gnu.org:
bug#48082; Package guix. (Sun, 01 Aug 2021 21:13:01 GMT) Full text and rfc822 format available.

Message #16 received at 48082 <at> debbugs.gnu.org (full text, mbox):

From: Brice Waegeneire <brice <at> waegenei.re>
To: rekado <at> elephly.net
Cc: 48082 <at> debbugs.gnu.org
Subject: [PATCH] environment: Add support for <inferior-package>.
Date: Sun,  1 Aug 2021 23:12:13 +0200
Fix <https://issues.guix.gnu.org/48082>.

* guix/scripts/environment.scm (input->manifest-entry): Add support for
  <inferior-package>.
---
 guix/scripts/environment.scm | 6 ++++++
 1 file changed, 6 insertions(+)

Ricardo, thank you for the links, I managed to reproduce the issue.  And fixed
it with the help of Ludovic on IRC.

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 6958bd6238..c464e7cfb3 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2014, 2015, 2018 David Thompson <davet <at> gnu.org>
 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Mike Gerwitz <mtg <at> gnu.org>
+;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@
   #:use-module (guix packages)
   #:use-module (guix profiles)
   #:use-module (guix search-paths)
+  #:use-module (guix inferior)
   #:use-module (guix build utils)
   #:use-module (guix monads)
   #:use-module ((guix gexp) #:select (lower-object))
@@ -74,6 +76,10 @@ package."
      (package->manifest-entry package))
     ((_ (? package? package) output)
      (package->manifest-entry package output))
+    ((_ (? inferior-package? package))
+     (inferior-package->manifest-entry package))
+    ((_ (? inferior-package? package) output)
+     (inferior-package->manifest-entry package output))
     (_
      #f)))
 
-- 
2.32.0





Information forwarded to bug-guix <at> gnu.org:
bug#48082; Package guix. (Tue, 17 Aug 2021 15:17:02 GMT) Full text and rfc822 format available.

Message #19 received at 48082 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Brice Waegeneire <brice <at> waegenei.re>, rekado <at> elephly.net
Cc: 48082 <at> debbugs.gnu.org
Subject: Re: bug#48082: [PATCH] environment: Add support for
 <inferior-package>.
Date: Tue, 17 Aug 2021 12:01:37 +0200
Hi Brice,

Thanks for the fix. :-)

On Sun, 01 Aug 2021 at 23:12, Brice Waegeneire <brice <at> waegenei.re> wrote:

> Fix <https://issues.guix.gnu.org/48082>.

Usually, the commit message is:

  Fixes <https://bugs.gnu.org/48082>.


> * guix/scripts/environment.scm (input->manifest-entry): Add support for
>   <inferior-package>.
> ---
>  guix/scripts/environment.scm | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> Ricardo, thank you for the links, I managed to reproduce the issue.  And fixed
> it with the help of Ludovic on IRC.
>
> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
> index 6958bd6238..c464e7cfb3 100644
> --- a/guix/scripts/environment.scm
> +++ b/guix/scripts/environment.scm
> @@ -2,6 +2,7 @@
>  ;;; Copyright © 2014, 2015, 2018 David Thompson <davet <at> gnu.org>
>  ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org>
>  ;;; Copyright © 2018 Mike Gerwitz <mtg <at> gnu.org>
> +;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -28,6 +29,7 @@
>    #:use-module (guix packages)
>    #:use-module (guix profiles)
>    #:use-module (guix search-paths)
> +  #:use-module (guix inferior)
>    #:use-module (guix build utils)
>    #:use-module (guix monads)
>    #:use-module ((guix gexp) #:select (lower-object))
> @@ -74,6 +76,10 @@ package."
>       (package->manifest-entry package))
>      ((_ (? package? package) output)
>       (package->manifest-entry package output))
> +    ((_ (? inferior-package? package))
> +     (inferior-package->manifest-entry package))
> +    ((_ (? inferior-package? package) output)
> +     (inferior-package->manifest-entry package output))
>      (_
>       #f)))

LGTM.


All the best,
simon




This bug report was last modified 2 years and 224 days ago.

Previous Next


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