Re: which package gets built first?

2022-11-04 Thread zimoun
Hi,

On Fri, 04 Nov 2022 at 16:39, "("  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/.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



Re: which package gets built first?

2022-11-04 Thread (
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))

-- (



Re: which package gets built first?

2022-11-04 Thread zimoun
Hi,

On Fri, 04 Nov 2022 at 00:34, jgart  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: 
2: 


Cheers,
simon



Re: which package gets built first?

2022-11-03 Thread jgart
On Fri, 04 Nov 2022 00:34:32 -0500 jgart  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...