unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70611: outputs are baked in gexps, cannot be removed in derived packages
@ 2024-04-27 16:55 Maxim Cournoyer
  2024-05-03 19:13 ` Simon Tournier
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Cournoyer @ 2024-04-27 16:55 UTC (permalink / raw)
  To: 70611

Hi Guix,

I've stumbled upon the following existing use case that no longer works
when the base package is expressed using gexps:

Base package:

--8<---------------cut here---------------start------------->8---
(define-public llvm-15
  (package
    (name "llvm")
    (version "15.0.7")
   
[...]

      #~(modify-phases %standard-phases
          (add-after 'unpack 'change-directory
            (lambda _
              (chdir "llvm")))
          (add-after 'install 'install-opt-viewer
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((opt-viewer-share (string-append #$output:opt-viewer
                                                      "/share")))
                (mkdir-p opt-viewer-share)
                (rename-file (string-append #$output "/share/opt-viewer")
                             opt-viewer-share)))))))

[...]

(define-public llvm-cling
  (let ((base llvm-18))
    (package/inherit base
      (name "llvm-cling")
      (version "18-20240227-01")
      (source
       (origin
         (inherit (package-source base))
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/root-project/llvm-project")
               (commit (string-append "cling-llvm" version))))
         (file-name (git-file-name "llvm-cling" version))
         (sha256
          (base32
           "0m5hhqk9y80srvkws2gs9rhpi6bjdy8mfk94z8fx6nmfxwrqsya8"))))
      (outputs '("out"))
      (arguments
       (substitute-keyword-arguments (package-arguments base)
         ((#:phases phases '%standard-phases)
          #~(modify-phases #$phases
              (delete 'install-opt-viewer))))))))
--8<---------------cut here---------------end--------------->8---

Attempting to build llvm-cling fails because the phases gexps inherited
from llvm-15 references the 'opt-viewer' output, which llvm-cling tries
to remove without success:

--8<---------------cut here---------------start------------->8---
builder for `/gnu/store/f2pdg9m5q3bxrlahjvlrdgw41x6kp3zd-llvm-cling-18-20240227-01.drv' failed to produce output path `/gnu/store/m1z5257hj5vwc2rl47wkpf0wmr6x0bq2-llvm-cling-18-20240227-01-opt-viewer'
--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim




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

* bug#70611: outputs are baked in gexps, cannot be removed in derived packages
  2024-04-27 16:55 bug#70611: outputs are baked in gexps, cannot be removed in derived packages Maxim Cournoyer
@ 2024-05-03 19:13 ` Simon Tournier
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Tournier @ 2024-05-03 19:13 UTC (permalink / raw)
  To: Maxim Cournoyer, 70611

Hi,

On sam., 27 avril 2024 at 12:55, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> --8<---------------cut here---------------start------------->8---
> builder for `/gnu/store/f2pdg9m5q3bxrlahjvlrdgw41x6kp3zd-llvm-cling-18-20240227-01.drv' failed to produce output path `/gnu/store/m1z5257hj5vwc2rl47wkpf0wmr6x0bq2-llvm-cling-18-20240227-01-opt-viewer'
> --8<---------------cut here---------------end--------------->8---

Yeah something is unexpected.

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build llvm-cling -d --no-grafts \
    | xargs guix drv-show | recsel -p outputs
outputs: 
+ /gnu/store/m1z5257hj5vwc2rl47wkpf0wmr6x0bq2-llvm-cling-18-20240227-01-opt-viewer   [opt-viewer]
+ /gnu/store/bg3xs25xyllpzw322sqcc8ipw9q8lph6-llvm-cling-18-20240227-01              [out]
--8<---------------cut here---------------end--------------->8---

But from ’guix repl’

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,pp (package-outputs llvm-cling-2)
$6 = ("out")
--8<---------------cut here---------------end--------------->8---

And the package arguments reads:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,pp (package-arguments llvm-cling-2)
$5 = (#:configure-flags
 #<gexp  gnu/packages/llvm.scm:586:6 7f6a06421150>
 #:build-type
 "Release"
 #:phases
 #<gexp (modify-phases #<gexp-input
          #<gexp (modify-phases %standard-phases
                   (add-after (quote unpack) (quote change-directory)
                     (lambda _
                       (chdir "llvm")))
                   (add-after (quote install) (quote install-opt-viewer)
                     (lambda* (#:key outputs #:allow-other-keys)
                       (let* ((opt-viewer-share (string-append #<gexp-output opt-viewer> "/share")))
                         (mkdir-p opt-viewer-share)
                         (rename-file (string-append #<gexp-output out> "/share/opt-viewer") opt-viewer-share)))))
          gnu/packages/llvm.scm:612:6 7f6a06421090>:out>
          (delete (quote install-opt-viewer)))
 gnu/packages/llvm.scm:2443:10 7f6a06421060>)
--8<---------------cut here---------------end--------------->8---

Concretely,
/gnu/store/rhb3lmkbp5d92c0x0sxkmfwbpbs4b4hp-llvm-cling-18-20240227-01-builder
reads,

--8<---------------cut here---------------start------------->8---
    (define %outputs
      (list
       (cons "out"
             ((@
               (guile)
               getenv)
              "out"))))
    (define %output
      (assoc-ref %outputs "out"))
    (cmake-build
[...]

                 #:phases
                 (modify-phases
                     (modify-phases %standard-phases
                       (add-after
                           (quote unpack)
                           (quote change-directory)
                         (lambda _
                           (chdir "llvm")))
                       (add-after
                           (quote install)
                           (quote install-opt-viewer)
                         (lambda*
                             (#:key outputs #:allow-other-keys)
                           (let*
                               ((opt-viewer-share
                                 (string-append
                                  ((@
                                    (guile)
                                    getenv)
                                   "opt-viewer")
                                  "/share")))
                             (mkdir-p opt-viewer-share)
                             (rename-file
                              (string-append
                               ((@
                                 (guile)
                                 getenv)
                                "out")
                               "/share/opt-viewer")
                              opt-viewer-share)))))
                   (delete
                    (quote install-opt-viewer)))
--8<---------------cut here---------------end--------------->8---

Therefore, the bug comes from an incorrect derivation (drv) file.  It
contains an output that it should not.

Well, I have not investigated further… Probably an issue with code
staging (what is evaluated when).


Cheers,
simon




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

end of thread, other threads:[~2024-05-06 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-27 16:55 bug#70611: outputs are baked in gexps, cannot be removed in derived packages Maxim Cournoyer
2024-05-03 19:13 ` Simon Tournier

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