guix-patches
[Top][All Lists]
Advanced

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

[bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.


From: Liliana Marie Prikler
Subject: [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
Date: Tue, 14 Nov 2023 18:53:22 +0100
User-agent: Evolution 3.46.4

Am Dienstag, dem 14.11.2023 um 11:37 +0100 schrieb Pierre-Henry
Fröhring:
> > > +(define-module (guix build-system mix)
> > > +  #:use-module (gnu packages base)
> > > +  #:use-module (gnu packages elixir)
> > > +  #:use-module (gnu packages elixir-xyz)
> > > +  #:use-module (gnu packages erlang)
> > You probably want to resolve those imports rather than use-modules
> > them.
> 
> You mean something like this?
> #+begin_src scheme
> (define-module (guix build-system mix)
>   #:use-module ((gnu packages base) #:select (glibc make-glibc-utf8-
> locales))
>   #:use-module ((gnu packages elixir) #:select (elixir elixir-hex))
>   #:use-module ((gnu packages erlang) #:select (rebar3))
> #+end_src
> 
> I have moved `elixir-hex' to elixir.scm to avoid a circular
> dependency.
No.  Look at all the other build systems.  None of them use submodules
of (gnu packages), for a good reason.

> > > +(define (input=? input1 input2)
> > > +  "Tell whether inputs INPUT1 and INPUT2 are equal."
> > > +  (define pkg1 (match input1 ((_ pkg) pkg)))
> > > +  (define pkg2 (match input2 ((_ pkg) pkg)))
> > > +  (string=? (package-name pkg1) (package-name pkg2)))
> > Again, checking for label equivalence is a bad idea.
> 
> OK, after reading a bit more about Guile, I understand that `equal?'
> is what should be used here, right?  The intent is to remove
> duplicated inputs in the code below:
> 
> #+begin_src scheme
> (define all-propagated-inputs
>     ((compose
>       (cut delete-duplicates <> equal?) ;<-- Here
>       (cut filter erlang-or-elixir-input? <>)
>       (cut append-map package-transitive-propagated-inputs <>)
>       (cut map cadr <>))
>      (append inputs native-inputs)))
> #+end_src
Yep, that would work.  Note that delete-duplicates is O(n^2), though. 
We have a little bit of code where it's done in (I assume) O(n*log(n))
with vhashes.

> 
> > > +(define (elixir-input? X.Y input)
> > > +  "Determines if the given INPUT is an Elixir input."
> > > +  (match input
> > > +    ((label . path)
> > > +     ;; XXX: The second condition may be enough.
> > > +     (and (elixir-name? label)
> > > +          (directory-exists? (path->elixir-lib path X.Y))))))
> > Ahem, search-path-as-list.
> > Also, leaking the version is kinda bad, API-wise.
> 
> Does this mean that build artifacts should be installed under
> `$out/lib/elixir/$libname` instead of `$out/lib/elixir/X.Y/$libname`?
Not necessarily, but you want a different way of building
$out/lib/elixir/X.Y/ that doesn't leak through the function signature.

Btw. I think that you're resolving transitive inputs twice; once on the
build system code and once by fattening the outputs.  You probably only
need either of those, not both.

Cheers





reply via email to

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