unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#49158] Add ruby-for-crystal.
@ 2021-06-21 16:19 jgart via Guix-patches via
  2021-06-21 18:04 ` Maxime Devos
  2022-09-28 18:36 ` bug#49158: " Maxim Cournoyer
  0 siblings, 2 replies; 4+ messages in thread
From: jgart via Guix-patches via @ 2021-06-21 16:19 UTC (permalink / raw)
  To: 49158; +Cc: Raghav Gururajan, rprior, mail

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

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?

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, or do we want to have each checkout be an independent input to the package?

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

best regards,

jgart

[-- Attachment #2: 0001-gnu-Add-ruby-for-crystal.patch --]
[-- Type: application/octet-stream, Size: 1363 bytes --]

From 1602b839e464220e60de6316500a411ee312232e Mon Sep 17 00:00:00 2001
From: LibreMiami <packaging-guix@libremiami.org>
Date: Mon, 21 Jun 2021 12:00:12 -0400
Subject: [PATCH] gnu: Add ruby-for-crystal.

* gnu/packages/ruby.scm (ruby-for-crystal):
    New variable.

Co-authored-by: David Dashyan <mail@davie.li>
Co-authored-by: jgart <jgart@dismail.de>
Co-authored-by: Raghav Gururajan <rg@raghavgururajan.name>
Co-authored-by: Ryan Prior <rprior@protonmail.com>
---
 gnu/packages/ruby.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 7c2cf35ac2..a5546b7228 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -244,6 +244,20 @@ a focus on simplicity and productivity.")
                    (delete-file-recursively "ext/fiddle/libffi-3.2.1")
                    #t))))))
 
+(define-public ruby-for-crystal
+  (package
+    (inherit ruby)
+    (version "1.9.3-p551")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                           (version-major+minor version)
+                           "/ruby-" version ".tar.xz"))
+       (sha256
+        (base32
+         "1ijm9f3pj8vz861hiqdhypxiclac7hz2lds77brgsk8zhsbq48j4"))))))
+
 (define-public mruby
   (package
     (name "mruby")
-- 
2.29.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#49158] Add ruby-for-crystal.
  2021-06-21 16:19 [bug#49158] Add ruby-for-crystal jgart via Guix-patches via
@ 2021-06-21 18:04 ` Maxime Devos
  2022-09-28 18:36 ` bug#49158: " Maxim Cournoyer
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Devos @ 2021-06-21 18:04 UTC (permalink / raw)
  To: jgart, 49158; +Cc: Raghav Gururajan, rprior, mail

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#49158: Add ruby-for-crystal.
  2021-06-21 16:19 [bug#49158] Add ruby-for-crystal jgart via Guix-patches via
  2021-06-21 18:04 ` Maxime Devos
@ 2022-09-28 18:36 ` Maxim Cournoyer
  2022-09-28 20:36   ` [bug#49158] " jgart via Guix-patches via
  1 sibling, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2022-09-28 18:36 UTC (permalink / raw)
  To: jgart; +Cc: Raghav Gururajan, 49158-done, rprior, mail

Hello,

"jgart" <jgart@dismail.de> writes:

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

Since the crystal-lang patches haven't landed in more than a year,
I think it's safer to punt on this.

Closing.

Thanks!

Maxim




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#49158] Add ruby-for-crystal.
  2022-09-28 18:36 ` bug#49158: " Maxim Cournoyer
@ 2022-09-28 20:36   ` jgart via Guix-patches via
  0 siblings, 0 replies; 4+ messages in thread
From: jgart via Guix-patches via @ 2022-09-28 20:36 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: Raghav Gururajan, 49158-done, rprior, mail

On Wed, 28 Sep 2022 14:36:12 -0400 Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
> Since the crystal-lang patches haven't landed in more than a year,
> I think it's safer to punt on this.

makes sense!

...for now ;)

thnx for closing




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-28 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 16:19 [bug#49158] Add ruby-for-crystal jgart via Guix-patches via
2021-06-21 18:04 ` Maxime Devos
2022-09-28 18:36 ` bug#49158: " Maxim Cournoyer
2022-09-28 20:36   ` [bug#49158] " jgart via Guix-patches via

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).