all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: jgart <jgart@dismail.de>, 49158@debbugs.gnu.org
Cc: Raghav Gururajan <rg@raghavgururajan.name>,
	rprior@protonmail.com, mail@davie.li
Subject: [bug#49158] Add ruby-for-crystal.
Date: Mon, 21 Jun 2021 20:04:02 +0200	[thread overview]
Message-ID: <96173ec7e0043c7b85808f3bc2a42ad3410d9e19.camel@telenet.be> (raw)
In-Reply-To: <fc2ab5b3b1ea562ad3b27220fd004afc@dismail.de>

[-- Attachment #1: Type: text/plain, Size: 3469 bytes --]

jgart via Guix-patches via schreef op ma 21-06-2021 om 16:19 [+0000]:
> Hi Guix,
> 
> We've (Ryan, David, Raghav, and others) started packaging crystal for guix: https://crystal-lang.org/
> 
> This patch adds an old version of ruby that is required by the crystal language bootstrap process. This is related to 49142.
> 
> This was an effort of the volunteers at the last guix packaging meetup hosted by LibreMiami.
> 
> Here are some notes, questions, and a list of dependencies regarding what is needed
> to finish a properly bootstraped crystal package:
> 
> https://github.com/ryanprior/guix-packages/blob/master/testing/crystal.org
> 
> We are trying to recreate this bootstrapping process in guix:
> 
> https://github.com/crystal-lang/bootstrap-script
> 
> There are 160 stages!
> 
> Some questions extracted from our notes follow:
> 
> Is it preferable to have 160 bootstrap packages, one for each stage,
> or one big bootstrap package with 160 build-* stages, or somewhere inbetween?

Definitely 160 separate bootstrap packages I'd say.
Though the first 159 wouldn't be exported and would be hidden.
Because:
  (1) presumably, building all these different versions of crystal
      would take a lot of time
  (2) if the build process OOMS, if there is a build failure at some
      stage, the user cancelled the build, and retried,
      then ideally Guix wouldn't start rebuilding the previous stages
  (3) so, 160 separate packages.

> How best can we use Guile macros to clean up the large amount of code implied by executing 160 stages of bootstrap logic?

There doesn't seem to be much reason to use
macro's here (except 'package' & 'define' itself)
Basically, you'd do something similar to what's already done
for Rust:

(define* (crystal-bootstrapped-package base-crystal version checksum commit)
  "Bootstrap crystal VERSION with source checksum CHECKSUM and git commit COMMIT
using BASE-CRYSTAL"
  (package
    (inherit base-crystal)
    (version version)
    (source
      (origin
        (inherit (package-source base-crystal))
        (commit commit)
        (sha256 (base32 checksum))))))

To start the process,
define an initial version crystal-stage1 like you'd do for any other package.
Then, for each N+1, define

(define crystal-N+1 (crystal-bootstrapped-package crystal-N VERSION CHECKSUM COMMIT))

Some crystals probably need somewhat different inputs, or require some fudging
in phases, so you might to occasionally modify the resulting package a little:

(define crystal-N+1
  (package
    (inherit crystal-N)
    (inputs `(("stuff" ,libstuff)
              ,@(package-inputs crystal-N)))

And export the final version:

;; Don't forget to remove the 'hiddenness' from crystal-160!
(define-export crystal crystal-160)

> Each stage needs a different checkout of the git repository - can we preserve info in .git
> such that we can checkout again during the build,

The .git directory isn't bit-for-bit reproducible
(think different versions of git, different versions of compression
libraries, different parallelism levels, etc. causing a slightly
different pack), so no.

Also, falling back to Software Heritage wouldn't work.

>  or do we want to have each checkout be an
> independent input to the package?

If you'll be using the 'crystal-bootstrapped-package' from above,
then you'll automatically get independent inputs.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2021-06-21 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 16:19 [bug#49158] Add ruby-for-crystal jgart via Guix-patches via
2021-06-21 18:04 ` Maxime Devos [this message]
2022-09-28 18:36 ` bug#49158: " Maxim Cournoyer
2022-09-28 20:36   ` [bug#49158] " jgart via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96173ec7e0043c7b85808f3bc2a42ad3410d9e19.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=49158@debbugs.gnu.org \
    --cc=jgart@dismail.de \
    --cc=mail@davie.li \
    --cc=rg@raghavgururajan.name \
    --cc=rprior@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.