Subject: [bug#60386] [PATCH] gnu: Add guile-proba.

From: Jelle Licht <[email-masked]>
Date: Mon, 13 Feb 2023 14:44:58 +0100

Hi Luis,

Luis Felipe via Guix-patches via <[email-masked]> writes:

> Hello again,
>
> This is a new patch with guile-proba version 0.3.0, which solves the missing module import problem.

Thank you for working on this, both upstream and the package itself. 

> [snip]

> +
> +(define-public guile-proba
> +  (package
> +    (name "guile-proba")
> +    (version "0.3.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://codeberg.org/luis-felipe/guile-proba")
> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "1mjnrbb6gv5f95i1ihn75yh7ya445pcnj13cy34x2v58h9n2r80s"))))
> +    (build-system guile-build-system)
> +    (inputs (list bash-minimal))
> +    (native-inputs (list guile-3.0 texinfo))

I think guile should be a normal input.  Other packages like this
(e.g. guilescript, ccwl) seem to do it that way.

> +    (propagated-inputs (list guile-config guile-lib))
> +    (arguments
> +     (list
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'build 'check
> +            (lambda _
> +              (invoke "guile" "proba.scm" "run" "tests")))
> +          (add-after 'install 'install-wrapped-script
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let* ((out (assoc-ref outputs "out"))
> +                     (version (target-guile-effective-version))
> +                     (scm (string-append "/share/guile/site/" version))
> +                     (go (string-append "/lib/guile/" version "/site-ccache"))
> +                     (bin-dir (string-append out "/bin"))
> +                     (script (string-append bin-dir "/proba")))
> +                (mkdir-p bin-dir)
> +                (copy-file "proba.scm" script)
> +                (chmod script #o555)
> +                (wrap-program script
> +                  `("GUILE_LOAD_PATH" prefix
> +                    (,(string-append out scm)))
> +                  `("GUILE_LOAD_COMPILED_PATH" prefix
> +                    (,(string-append out go)))))))

This seems almost correct, as it extends the GUILE_LOAD_{,COMPILED}_PATH
at runtime; the user would for still need to have the guile-config and
guile in their profile. Although guile-config is also listed as a
propagated input, when the guile search paths specifications are not
active, the following would not work:

`guix shell --pure guile-proba -- proba run tests'

You could have a look at the 'wrap phase of the ccwl package; they use
the value of (getenv "GUILE_LOAD_{,COMPILED}_PATH") retrieved while
building the package to wrap their script.

> +          (add-after 'install 'install-manual
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let* ((out (assoc-ref outputs "out"))
> +                     (info-dir (string-append out "/share/info")))
> +                (mkdir-p info-dir)
> +                (invoke "makeinfo" "manual/main.texi")
> +                (install-file "guile-proba" info-dir)))))
Nitpick, so feel free to ignore:
You could split up building and installing the manual.

> +      #:not-compiled-file-regexp
> +      "((bogus|bogus-tests|packages|tests)\\/.*.scm|(proba|manifest).scm)$"))

All of the files listed in this regex are still installed in
<out>/share/guile/site/3.0.  Do you think it would be possible to ensure
these files are not installed?

> +    (home-page "https://luis-felipe.gitlab.io/guile-proba/")
> +    (synopsis "Testing tools for GNU Guile projects with SRFI 64 test suites")
> +    (description
> +     "This software is a set of testing tools for GNU Guile projects
> +with SRFI 64-based test suites.  It comes with a command-line interface
> +to run test collections, and a library that includes a test runner and
> +helpers for writing tests.")
> +    (license license:public-domain)))
>
> base-commit: fc5dc3e04789a15d80a7b35987adaefc1a94b97c
> -- 
> 2.38.1