unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* which package gets built first?
@ 2022-11-04  5:34 jgart
  2022-11-04  5:35 ` jgart
  2022-11-04  9:49 ` zimoun
  0 siblings, 2 replies; 5+ messages in thread
From: jgart @ 2022-11-04  5:34 UTC (permalink / raw)
  To: Guix Help

What determines which package gets built first in the following invocation?

`guix build emacs-zig-mode zig`


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

* Re: which package gets built first?
  2022-11-04  5:34 which package gets built first? jgart
@ 2022-11-04  5:35 ` jgart
  2022-11-04  9:49 ` zimoun
  1 sibling, 0 replies; 5+ messages in thread
From: jgart @ 2022-11-04  5:35 UTC (permalink / raw)
  To: Guix Help

On Fri, 04 Nov 2022 00:34:32 -0500 jgart <jgart@dismail.de> wrote:
> What determines which package gets built first in the following invocation?
> 
> `guix build emacs-zig-mode zig`

The reason I ask is because zig got built first but I'm not sure why...


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

* Re: which package gets built first?
  2022-11-04  5:34 which package gets built first? jgart
  2022-11-04  5:35 ` jgart
@ 2022-11-04  9:49 ` zimoun
  2022-11-04 16:39   ` (
  1 sibling, 1 reply; 5+ messages in thread
From: zimoun @ 2022-11-04  9:49 UTC (permalink / raw)
  To: jgart, Guix Help

Hi,

On Fri, 04 Nov 2022 at 00:34, jgart <jgart@dismail.de> wrote:
> What determines which package gets built first in the following invocation?
>
> `guix build emacs-zig-mode zig`

It depends. :-)  Usually, something like

  guix thing stuff1 stuff2

is processed in that order: stuff2 then stuff1.  Other said, the CLI is
somehow parsed from right to left.  For instance, see bug#43585 [1] or
bug#50473.  Well, compare:

--8<---------------cut here---------------start------------->8---
$ guix package --show=emacs --show=zig | recsel -Cp name
name: zig
name: emacs

$ guix package --show=zig --show=emacs  | recsel -Cp name
name: emacs
name: zig
--8<---------------cut here---------------end--------------->8---

(Note that “guix show” process from left to right since it is how most
of us type and read.)


That’s said, “guix build” is special.  Because it somehow processes the
topological order between stuff1 and stuff2.  Other said, if stuff2
depends on stuff1, then it first builds stuff1 then second stuff2.


1: <http://issues.guix.gnu.org/issue/43585>
2: <http://issues.guix.gnu.org/issue/50473>


Cheers,
simon


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

* Re: which package gets built first?
  2022-11-04  9:49 ` zimoun
@ 2022-11-04 16:39   ` (
  2022-11-04 19:40     ` zimoun
  0 siblings, 1 reply; 5+ messages in thread
From: ( @ 2022-11-04 16:39 UTC (permalink / raw)
  To: zimoun, jgart, Guix Help

Heya,

On Fri Nov 4, 2022 at 9:49 AM GMT, zimoun wrote:
> Other said, the CLI is somehow parsed from right to left.

Probably because:

  args: (pkg1 pkg2 pkg3)
  cmds: ()

  args: (pkg2 pkg3)
  cmds: ((install . pkg1))

  args: (pkg3)
  cmds: ((install . pkg2)
         (install . pkg1))

  args: ()
  cmds: ((install . pkg3)
         (install . pkg2)
         (install . pkg1))

I suppose we could add a reverse in this procedure, defined within
guix/scripts/package.scm's options->installable:

  (define to-install
    (filter-map (match-lambda
                  (('install . (? package? p))
                   ;; When given a package via `-e', install the first of its
                   ;; outputs (XXX).
                   (package->manifest-entry* (transform p) "out"))
                  (('install . (? string? spec))
                   (if (store-path? spec)
                       (store-item->manifest-entry spec)
                       (let-values (((package output)
                                     (specification->package+output spec)))
                         (package->manifest-entry* (transform package)
                                                   output))))
                  (('install . obj)
                   (leave (G_ "cannot install non-package object: ~s~%")
                          obj))
                  (_
                   #f))
                opts))

    -- (


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

* Re: which package gets built first?
  2022-11-04 16:39   ` (
@ 2022-11-04 19:40     ` zimoun
  0 siblings, 0 replies; 5+ messages in thread
From: zimoun @ 2022-11-04 19:40 UTC (permalink / raw)
  To: (, jgart, Guix Help

Hi,

On Fri, 04 Nov 2022 at 16:39, "(" <paren@disroot.org> wrote:
> On Fri Nov 4, 2022 at 9:49 AM GMT, zimoun wrote:

>> Other said, the CLI is somehow parsed from right to left.
>
> Probably because:

Well, it is because ’parse-command-line’ from (guix scripts), no?


> I suppose we could add a reverse in this procedure, defined within
> guix/scripts/package.scm's options->installable:

This would address a part of “guix package” but not “guix build” or
“guix shell” or etc.

From my point of view, the reverse should happen in ’parse-command-line’
and so all guix/scripts/<command>.scm would be consistent.

BTW, it is somehow what “guix show” does with,

  (define opts
    (parse-command-line args %options (list (list))
                        #:build-options? #f
                        #:argument-handler handle-argument))

[...]

  (guix-package* (reverse opts)))

Assuming we would like to parse left-to-right. :-)


Cheers,
simon


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

end of thread, other threads:[~2022-11-04 21:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  5:34 which package gets built first? jgart
2022-11-04  5:35 ` jgart
2022-11-04  9:49 ` zimoun
2022-11-04 16:39   ` (
2022-11-04 19:40     ` zimoun

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