unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48082: “guix environment -l” does not work with inferior packages
@ 2021-04-28 16:19 Ricardo Wurmus
  2021-08-01 14:13 ` Brice Waegeneire
  0 siblings, 1 reply; 5+ messages in thread
From: Ricardo Wurmus @ 2021-04-28 16:19 UTC (permalink / raw)
  To: 48082

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




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

* bug#48082: “guix environment -l” does not work with inferior packages
  2021-04-28 16:19 bug#48082: “guix environment -l” does not work with inferior packages Ricardo Wurmus
@ 2021-08-01 14:13 ` Brice Waegeneire
  2021-08-01 16:07   ` Ricardo Wurmus
  0 siblings, 1 reply; 5+ messages in thread
From: Brice Waegeneire @ 2021-08-01 14:13 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 48082

Hello Ricardo,

Ricardo Wurmus <rekado@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




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

* bug#48082: “guix environment -l” does not work with inferior packages
  2021-08-01 14:13 ` Brice Waegeneire
@ 2021-08-01 16:07   ` Ricardo Wurmus
  2021-08-01 21:12     ` bug#48082: [PATCH] environment: Add support for <inferior-package> Brice Waegeneire
  0 siblings, 1 reply; 5+ messages in thread
From: Ricardo Wurmus @ 2021-08-01 16:07 UTC (permalink / raw)
  To: Brice Waegeneire; +Cc: 48082


Brice Waegeneire <brice@waegenei.re> writes:

> Hello Ricardo,
>
> Ricardo Wurmus <rekado@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




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

* bug#48082: [PATCH] environment: Add support for <inferior-package>.
  2021-08-01 16:07   ` Ricardo Wurmus
@ 2021-08-01 21:12     ` Brice Waegeneire
  2021-08-17 10:01       ` zimoun
  0 siblings, 1 reply; 5+ messages in thread
From: Brice Waegeneire @ 2021-08-01 21:12 UTC (permalink / raw)
  To: rekado; +Cc: 48082

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@gnu.org>
 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Mike Gerwitz <mtg@gnu.org>
+;;; Copyright © 2021 Brice Waegeneire <brice@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





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

* bug#48082: [PATCH] environment: Add support for <inferior-package>.
  2021-08-01 21:12     ` bug#48082: [PATCH] environment: Add support for <inferior-package> Brice Waegeneire
@ 2021-08-17 10:01       ` zimoun
  0 siblings, 0 replies; 5+ messages in thread
From: zimoun @ 2021-08-17 10:01 UTC (permalink / raw)
  To: Brice Waegeneire, rekado; +Cc: 48082

Hi Brice,

Thanks for the fix. :-)

On Sun, 01 Aug 2021 at 23:12, Brice Waegeneire <brice@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@gnu.org>
>  ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
>  ;;; Copyright © 2018 Mike Gerwitz <mtg@gnu.org>
> +;;; Copyright © 2021 Brice Waegeneire <brice@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




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

end of thread, other threads:[~2021-08-17 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 16:19 bug#48082: “guix environment -l” does not work with inferior packages Ricardo Wurmus
2021-08-01 14:13 ` Brice Waegeneire
2021-08-01 16:07   ` Ricardo Wurmus
2021-08-01 21:12     ` bug#48082: [PATCH] environment: Add support for <inferior-package> Brice Waegeneire
2021-08-17 10:01       ` zimoun

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