[PATCH] gnu: guile-irregex: Update to 0.9.11.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal

Debbugs page

Tomas Volf wrote 1 years ago
(address . guix-patches@gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
3ad16a6c2b1f0a7213c491570f438db81f3fe863.1708867568.git.~@wolfsden.cz
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
---
gnu/packages/guile-xyz.scm | 78 +++++++++++++++++++++++++++++---------
1 file changed, 60 insertions(+), 18 deletions(-)

Toggle diff (109 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index b34472d5bd..9d683199ac 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2895,7 +2895,7 @@ (define-public guile2.2-minikanren
(define-public guile-irregex
(package
(name "guile-irregex")
- (version "0.9.6")
+ (version "0.9.11")
(source (origin
(method url-fetch)
(uri (string-append
@@ -2903,25 +2903,46 @@ (define-public guile-irregex
version ".tar.gz"))
(sha256
(base32
- "1ia3m7dp3lcxa048q0gqbiwwsyvn99baw6xkhb4bhhzn4k7bwyqq"))))
+ "026kzl96pmwbjqdc7kh8rdh8ng813sjvdsik0dag5acza20sjm19"))))
(build-system guile-build-system)
(arguments
- '(#:phases (modify-phases %standard-phases
- (add-after 'unpack 'move-files-around
- (lambda _
- ;; Move the relevant source files to src/ and create the
- ;; rx/ directory to match the expected module hierarchy.
- (mkdir-p "src/rx/source")
- (rename-file "irregex-guile.scm"
- "src/rx/irregex.scm")
- (rename-file "irregex.scm"
- "src/rx/source/irregex.scm")
- ;; Not really reachable via guile's packaging system,
- ;; but nice to have around.
- (rename-file "irregex-utils.scm"
- "src/rx/source/irregex-utils.scm")
- #t)))
- #:source-directory "src"))
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'move-files-around
+ (lambda _
+ ;; Copy the relevant source files to src/ and create the
+ ;; rx/ directory to match the expected module hierarchy.
+ (mkdir-p "src/rx/source")
+ (copy-file "irregex-guile.scm"
+ "src/rx/irregex.scm")
+ (copy-file "irregex.scm"
+ "src/rx/source/irregex.scm")
+
+ (mkdir-p "src/rx/irregex")
+ (copy-file "irregex-utils-guile.scm"
+ "src/rx/irregex/utils.scm")
+ (copy-file "irregex-utils.scm"
+ "src/rx/source/irregex-utils.scm")))
+ (add-after 'build 'check
+ (lambda _
+ (for-each (lambda (f)
+ (invoke "guile" "--no-auto-compile" "-L" "." "-s" f))
+ (find-files "tests" "^guile-.*\\.scm"))))
+ (add-after 'install 'check-installed
+ (lambda _
+ (define-values (scm go) (target-guile-scm+go #$output))
+ (for-each
+ (lambda (f)
+ (substitute* f
+ (("\\(load-from-path \"irregex\"\\)")
+ "(use-modules (rx irregex))")
+ (("\\(load-from-path \"irregex-utils\"\\)")
+ "(use-modules (rx irregex utils))"))
+ (invoke "guile" "-L" scm "-C" go "-L" "tests" f))
+ (delete "tests/guile-cset.scm" ; Tests non-exported API
+ (find-files "tests" "^guile-.*\\.scm"))))))
+ #:source-directory "src"))
(native-inputs
(list guile-3.0))
(home-page "https://synthcode.com/scheme/irregex")
@@ -2936,6 +2957,27 @@ (define-public guile2.0-irregex
(package
(inherit guile-irregex)
(name "guile2.0-irregex")
+ (arguments
+ (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))
+ (for-each
+ (lambda (f)
+ (symlink (regexp-substitute #f (string-match "/([^/]+)$" f)
+ 1 ".scm")
+ f))
+ '("tests/guile/test-support"
+ "tests/test-cset"
+ "tests/test-irregex"
+ "tests/test-irregex-from-gauche"
+ "tests/test-irregex-pcre"
+ "tests/test-irregex-scsh"
+ "tests/test-irregex-utf8"))))))))
(native-inputs (list guile-2.0))))
(define-public guile2.2-irregex

base-commit: aefc7428203203ae88c64cc4769113453c01a185
--
2.41.0
Ludovic Courtès wrote 1 years ago
(name . Tomas Volf)(address . ~@wolfsden.cz)(address . 69380-done@debbugs.gnu.org)
87o7bwd33a.fsf@gnu.org
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

Toggle quote (15 lines)
> 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!

Toggle quote (9 lines)
> + (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.

Toggle quote (6 lines)
> + (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’.
Closed
Tomas Volf wrote 1 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 69380@debbugs.gnu.org)
ZeSr9wdkSyTA7suE@ws
On 2024-03-02 17:13:13 +0100, Ludovic Courtès wrote:
Toggle quote (10 lines)
> > + (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?

Yes, I think this could have been just (string-append (basename f) ".scm"). I
forgot there is such function, thanks for pointing it out.

Have a nice day,
Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmXkq/cACgkQL7/ufbZ/
wangOxAAhRDBDFH8nsUKmt5J3Co+rdBxu9j4IjYGtIrEFvH8WRYy0pG1gnia9O0u
44ARLkoA6g+vaAgQxm04SCpny1UOm4xKQ1hnywwmmWiX61vKoHzlrrWLS4WWXAAB
GLUUSM/FloJSUq/z1xL9chYLuO/X/EZRa+cRzBhFhav5t4cx7nQ0mhBFAKdjonqX
8wu2EgcysVGNZIyIvn+p2WHJwkxox5wV4B0g2LdK9JBlq06R7WtNNyub21Kb930a
fVnfo4SPhlNjo0A88l4YvzgaUQgLpA/WmXCT7NJXA7SAQg0XPc7VoaO0hGHd6Acq
u/ff2WXPW36Au/aJTOOKlpX5625PhWP8TUyIWXHlpnB051SuotYcP9wIPR5A6PTA
8MdE+DNLTN2ARXRJvWRhVpHcD5NElQDAqLWnN1sQimEj68vnVCC4wuFxD2JOKi32
6Xrs564BztI4Dfhj7teaBcyMOosT8iEaq9+7K3VJkd38Vf7yZudpJlrPpMSqNm8A
O7/WW8PpZwjL8/5T0wDHZF8qeYD4Y+/RK/OgcyNTwJgUpSAUImii812kUiB+jSXw
lYlx4/tooxNiWs80+CJ1aqO0wc2PuowAlJvp6ohPLLLwrmlTBLwbc81HWiv9ktEz
ubHbv+OOU9s7KyFxC16fC5PxHO0VhY/GZ4hGWDBrnh6TDHBTOoQ=
=luVL
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 69380@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 69380
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help