GNU bug report logs - #66801
[PATCH] mix-build-system: draft 1

Previous Next

Package: guix-patches;

Reported by: Pierre-Henry Fröhring <phfrohring <at> deeplinks.com>

Date: Sat, 28 Oct 2023 20:21:02 UTC

Severity: normal

Tags: patch

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Pierre-Henry Fröhring <phfrohring <at> deeplinks.com>,  66801 <at> debbugs.gnu.org
Subject: [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
Date: Tue, 14 Nov 2023 18:53:22 +0100
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




This bug report was last modified 1 year and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.