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


Message #176 received at 66801 <at> debbugs.gnu.org (full text, mbox):

From: Pierre-Henry Fröhring <phfrohring <at> deeplinks.com>
To: 66801 <at> debbugs.gnu.org
Subject: Fwd: ['PATCH v2' 01/14] build-system: Add mix-build-system.
Date: Wed, 15 Nov 2023 13:40:51 +0100
[Message part 1 (text/plain, inline)]
> No.  Look at all the other build systems.  None of them use submodules of
(gnu
> packages), for a good reason.

Ok, I see. It would introduce circular dependencies. By "resolve," you
mean something like: ~(resolve-interface '(gnu packages yyy))~. So, in
our case it means:
#+begin_src scheme
(define (default-glibc-utf8-locales)
  (let* ((base (resolve-interface '(gnu packages base)))
         (glibc (module-ref base 'glibc))
         (make-glibc-utf8-locales (module-ref base
'make-glibc-utf8-locales)))
    (make-glibc-utf8-locales glibc #:locales (list "en_US"))))

(define (default-elixir-hex)
  (let ((elixir (resolve-interface '(gnu packages elixir))))
    (module-ref elixir 'elixir-hex)))

(define (default-rebar3)
  (let ((erlang (resolve-interface '(gnu packages erlang))))
    (module-ref erlang 'rebar3)))
#+end_src

Then:
#+begin_src scheme
(define* (lower name
                #:key
                (elixir (default-elixir))
                (elixir-hex (default-elixir-hex))
                (glibc-utf8-locales (default-glibc-utf8-locales))
                (rebar3 (default-rebar3))
                …
                #:allow-other-keys #:rest arguments)
  …)
#+end_src

Is this correct?


> Not necessarily, but you want a different way of building
$out/lib/elixir/X.Y/
> that doesn't leak through the function signature.

Following ~python-build-system.scm~, it means something like:
#+begin_src scheme
(define (elixir-version elixir)
  (let* ((version     (last (string-split elixir #\-)))
         (components  (string-split version #\.))
         (major+minor (take components 2)))
    (string-join major+minor ".")))

(define (install-dir inputs outputs)
  "Return the path of the current output's Elixir library."
  (let ((out (assoc-ref outputs "out"))
        (elixir (assoc-ref inputs "elixir")))
    (string-append out "/lib/elixir/" (elixir-version elixir))))
#+end_src

Is this correct?


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

Ah. Propagated inputs are propagated. Who would have thought? So, this is
not necessary:
#+begin_src scheme
(define* (lower …)
  …
  (define all-propagated-inputs
    ((compose
      (cut delete-duplicates <> equal?)
      (cut filter erlang-or-elixir-input? <>)
      (cut append-map package-transitive-propagated-inputs <>)
      (cut map cadr <>))
     (append inputs native-inputs)))

  (define build-inputs
    `(…
      ,@all-propagated-inputs
      ,@inputs
      ,@native-inputs))

  (bag …
       (build-inputs build-inputs)
       …))
#+end_src
I've just removed ~all-propagated-inputs~ and all packages build just fine.

Is this what you meant?


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

If ~all-propagated-inputs~ is removed, then the discussion of this comment
is
closed.
[Message part 2 (text/html, inline)]

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.