guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

G-expressions and chroot environment? (was Re: branch master updated: gn


From: Simon Tournier
Subject: G-expressions and chroot environment? (was Re: branch master updated: gnu: Add passff.)
Date: Fri, 03 Nov 2023 19:46:00 +0100

Hi,

On Sat, 28 Oct 2023 at 17:05, Clément Lassieur <clement@lassieur.org> wrote:

>>   ./pre-inst-env guix show passff-host
>>   name: passff-host
>>   version: 1.2.3
>>   outputs:
>>   + out: everything
>>   systems: x86_64-linux mips64el-linux aarch64-linux powerpc64le-linux 
>> riscv64-linux
>>   + i686-linux armhf-linux i586-gnu powerpc-linux
>>   dependencies: 
>
> I imagine it's a bug in `guix show`?

It is not a bug of ’guix show’ because ’guix show’ accesses to the
fields of the package record.  And Clément’s patch is an “abuse” of the
G-expressions machinery. :-)

>                                       As doc says:
>
>    • Gexps carry information about the packages or derivations they
>      refer to, and these dependencies are automatically added as inputs
>      to the build processes that use them.

Well, this is correct from my understanding. ;-)

However, there is still something that I am missing.  The derivations
tracks all and that’s expected; thanks G-expression machinery. :-)
However, I miss how the builder works with the chrooted environment if
nothing is passed to it.

The derivation reads,

--8<---------------cut here---------------start------------->8---
Derive
([("out","/gnu/store/0amanwyzx3jylyw7bz5nmszpybxll8ww-passff-host-1.2.3","","")]
 ,[("/gnu/store/070vbkzbs0dn6w9mhz0xw8fi5hfp92rg-make-4.3.drv",["out"])
   ,("/gnu/store/2i4781y3mmnm2jlx3awa4mwbqam2ar80-python-3.10.7.drv",["out"])
   ,("/gnu/store/ax7wdlbxhcz7w8nfyrxkb1pqai80niw6-sed-4.8.drv",["out"])
   ,("/gnu/store/gb247cil5nlnx175dhqmgg67q7ng7n2h-which-2.21.drv",["out"])
   
,("/gnu/store/ghwl0z5ci5sssbrzixxji8l0x3j9i3dv-bash-minimal-5.1.16.drv",["out"])
   
,("/gnu/store/mqmnsly3nm0a7hj46apf2hfm7j8wk56h-module-import-compiled.drv",["out"])
   ,("/gnu/store/raay3plnbzadwqc0yv8yw8pjr929pkqd-coreutils-9.1.drv",["out"])
   
,("/gnu/store/rnphhzpwkz82zf1il1cg52041myvp3d4-password-store-1.7.4.drv",["out"])
   
,("/gnu/store/y6871hl8lklcslvw57wj4bnyysxlv2np-passff-host-1.2.3-checkout.drv",["out"])
   ,("/gnu/store/y9l0jnyxssx1glbyg3cav78js2fm7j50-grep-3.8.drv",["out"])
   ,("/gnu/store/zraigp7miin3vzr5dcbr4i9rvds0i07r-guile-3.0.9.drv",["out"])]
 
,["/gnu/store/8nam67byqnpvbfn4anpgg5pb2qrqhs3v-passff-host-1.2.3-builder","/gnu/store/pj751v3199vmv6i6sf0szp185ryzcfdg-module-import"]
 
,"x86_64-linux","/gnu/store/g8p09w6r78hhkl2rv1747pcp9zbk6fxv-guile-3.0.9/bin/guile",["--no-auto-compile","-L","/gnu/store/pj751v3199vmv6i6sf0szp185ryzcfdg-module-import","-C","/gnu/store/2gbsk55kwag577skxwsxrfy3l4cl03xh-module-import-compiled","/gnu/store/8nam67byqnpvbfn4anpgg5pb2qrqhs3v-passff-host-1.2.3-builder"]
 ,[("out","/gnu/store/0amanwyzx3jylyw7bz5nmszpybxll8ww-passff-host-1.2.3")])
--8<---------------cut here---------------end--------------->8---

However the builder reads,

--8<---------------cut here---------------start------------->8---
(begin
  (define %build-inputs
    (quote
     (("source" . 
"/gnu/store/fjnkcv14qb61623lm16kq1mgb4bsxivl-passff-host-1.2.3-checkout"))))
  (define %outputs
    (list
     (cons "out"
           ((@
             (guile)
             getenv)
            "out"))))
  (define %output
    (assoc-ref %outputs "out"))
  (begin
    (use-modules
     (guix build utils))
    (setenv "PATH"
            (string-join
             (list 
"/gnu/store/yr39rh6wihd1wv6gzf7w4w687dwzf3vb-coreutils-9.1/bin" 
"/gnu/store/ixr7c3jadiqg640b8pz3njqhhm5zzmvj-grep-3.8/bin" 
"/gnu/store/sj794a2709pxsi4mgvi619qdpi1g32aa-password-store-1.7.4/bin" 
"/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/bin" 
"/gnu/store/fyy3wkjkix16sb1ginqw2kbji74cwl2b-sed-4.8/bin" 
"/gnu/store/6vxk0i5j9w8mik4l6gx3cbw33f9x4l24-which-2.21/bin")
             ":"))
    (copy-recursively 
"/gnu/store/fjnkcv14qb61623lm16kq1mgb4bsxivl-passff-host-1.2.3-checkout" ".")
    (substitute* "src/install_host_app.sh"
      (("#!/usr/bin/env sh")
       "/gnu/store/9vw5slrffp27rzy2i2plnw7xfqjyk7m4-bash-minimal-5.1.16/bin/sh")
      (("(TARGET_DIR_FIREFOX=).*" all var)
       (string-append var
                      ((@
                        (guile)
                        getenv)
                       "out")
                      "/lib/icecat/native-messaging-hosts")))
    (invoke "/gnu/store/vq4g8390wbz2434m678v010mkpnkjb2w-make-4.3/bin/make"
            (string-append "VERSION=" "1.2.3")
            "install-unix")))
--8<---------------cut here---------------end--------------->8---

and I would have expect that it fails because of the isolated
environment.

How is it possible that the builder script is able to run that?

For another example using the gnu-build system.

--8<---------------cut here---------------start------------->8---
(define-module (appendix)
  #:use-module (guix packages)
  #:use-module (gnu packages base)
  #:use-module (guix utils)
  #:use-module (guix gexp)
  #:use-module (gnu packages emacs))

(define-public bye
  (package
    (inherit hello)
    (name "bye")
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'do-something-with-emacs
            (lambda _
              (invoke #$(file-append emacs-minimal
                                     "/bin/emacs") "--version"))))))))
--8<---------------cut here---------------end--------------->8---

Considering the builder of this, I miss how, in an isolated environment,
’gnu-build’ access to the store item ’emacs-minimal’ if it is not listed
in ’%build-inputs’.

Is it a bug?  Or someone could help me to understand what I miss with
the chrooted environment.

Cheers,
simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]