Subject: Re: [bug#69380] [PATCH] gnu: guile-irregex: Update to 0.9.11.
From: Ludovic Courtès <[email-masked]>
To: Tomas Volf <[email-masked]>
Cc: [email-masked]
Date: Sat, 02 Mar 2024 17:13:13 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Tomas Volf <[email-masked]> skribis:

> Since upstream now provides tests for guile, they are executed, both before
> install (testing the internals) and after install (making sure the guile
> module and everything works well).
>
> Guile 2.0 for some reason cannot load "foo.scm" using (load-from-path "foo"),
> so symlinks are created to work around that.
>
> * gnu/packages/guile-xyz.scm (guile-irregex)[version]: Update to 0.9.11.
> [arguments]: Convert to gexp.
> <#:phases>{'move-files-around}: Copy files instead of moving.
> {'check, 'check-installed}: New phases.
> (guile2.0-irregex)[arguments]: Add 'create-symlinks phase.
>
> Change-Id: Ib9d4e9c24475aa8e7fc1e70b868b690eaf6ad42e

Applied, thanks!

> +     (substitute-keyword-arguments (package-arguments guile-irregex)
> +       ((#:phases phases)
> +        #~(modify-phases #$phases
> +            ;; For some reason guile 2.0 cannot load foo.scm using
> +            ;; (load-from-path "foo").  So create symlinks to work around it.
> +            (add-before 'check 'create-symlinks
> +              (lambda _
> +                (use-modules (ice-9 regex))

As a rule of thumb, only write ‘use-modules’ at the top level.  Use
#:modules here.

I left it here because it doesn’t matter all that much, and because we
could/should probably remove ‘guile2.0-irregex’ anyway.

> +                (for-each
> +                 (lambda (f)
> +                   (symlink (regexp-substitute #f (string-match "/([^/]+)$" f)
> +                                               1 ".scm")
> +                            f))

I would avoid using regexps for such things: it’s heavyweight, hard to
read, and error-prone.  Looks like you could do away with just
‘basename’ and the likes, no?

Thanks,
Ludo’.