Subject: bug#60386: closed (Re: [bug#60386] [PATCH] gnu: Add guile-proba.)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 21 Feb 2023 17:55:02 +0000

Your bug report

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

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60386: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60386
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#60386] [PATCH] gnu: Add guile-proba.
From: Jelle Licht <[email-masked]>
To: Luis Felipe <[email-masked]>
Cc: Ludovic Courtès <[email-masked]>, [email-masked]
Date: Tue, 21 Feb 2023 18:54:15 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Luis,

Pushed to master! Some comments still follow.

Luis Felipe <[email-masked]> writes:

> Hi Jelle, thanks for taking a look.
>
> I'm sending a new patch after this message, but I'm replying to your review below.
>
>
> On Monday, February 13th, 2023 at 13:44, Jelle Licht <[email-masked]> wrote:
>
>> > + (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.
>
> I moved it to inputs now. But I placed it in native-inputs following the guile-build-system documentation in the manual:
>
> "Packages built with ‘guile-build-system’ must provide a Guile package in their ‘native-inputs’ field."
>
> Did I misunderstand or should that part of the manual be updated?

You are correct, but in order to cleanly cross compile, we'd need to:
- add guile to both inputs (for the shebang) and native-inputs (for
cross compilation)
- add all guile libraries to both propagated-inputs and native-inputs
- ensure all guile libraries we depend on can be cross compiled.
- rework the `(getenv ...)' trick again, to be constructed out of the
guile libraries in (propagated-)inputs, instead of the native-inputs.

A quick bit of research makes me think guix is one of few packages
written in guile using autotools that supports cross compilation. I
think we can just leave the entire cross-compilation thing to be done
later, and then have it be done properly for all guile packages at once.

>> > + (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.
>
> I added a new phase to set Guile load paths so that they take (getenv "GUILE_LOAD{,COMPILED}_PATH") into account, and modified the wrapping accordingly. In my test, running "guix shell --pure guile-proba -- proba run tests" works now.
>
>
>> > + (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.
>
> I put building into a separate phase.
>
>
>> > + #: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?
>
> It was possible. Now it looks like this:
>
> /gnu/store/xaqmf7n83h5dq9xv6is46ybjk98ssakr-guile-proba-0.3.0
> |-- bin
> |   `-- proba
> |-- lib
> |   `-- guile
> |       `-- 3.0
> |           `-- site-ccache
> |               `-- proba
> |                   |-- cli.go
> |                   |-- commands.go
> |                   |-- runners.go
> |                   |-- templates.go
> |                   `-- utils.go
> `-- share
>     |-- doc
>     |   `-- guile-proba-0.3.0
>     |       |-- README.org
>     |       `-- index.html
>     |-- guile
>     |   `-- site
>     |       `-- 3.0
>     |           `-- proba
>     |               |-- cli.scm
>     |               |-- commands.scm
>     |               |-- runners.scm
>     |               |-- templates.scm
>     |               `-- utils.scm
>     `-- info
>         `-- guile-proba

Subject: [PATCH] gnu: Add guile-proba.
From: Luis Felipe <[email-masked]>
To: Luis Felipe via Guix-patches <[email-masked]>
Date: Wed, 28 Dec 2022 18:07:52 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi, a new package here.

---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/

From 332ea52f1f060a4fa1b8af7100b4cbd2f481f24b Mon Sep 17 00:00:00 2001
From: Luis Felipe <[email-masked]>
Date: Wed, 28 Dec 2022 12:45:32 -0500
Subject: [PATCH] gnu: Add guile-proba.

* gnu/packages/check.scm (guile-proba): New variable.
---
 gnu/packages/check.scm | 51 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index aaa41777dc..3967a22f76 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -41,6 +41,7 @@
 ;;; Copyright © 2022 David Elsing <[email-masked]>
 ;;; Copyright © 2022 Sharlatan Hellseher <[email-masked]>
 ;;; Copyright © 2022 jgart <[email-masked]>
+;;; Copyright © 2022 Luis Felipe López Acevedo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -70,6 +71,8 @@ (define-module (gnu packages check)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages guile)
+  #:use-module (gnu packages guile-xyz)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -78,6 +81,7 @@ (define-module (gnu packages check)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages python-science)
+  #:use-module (gnu packages texinfo)
   #:use-module (gnu packages time)
   #:use-module (gnu packages xml)
   #:use-module (guix utils)
@@ -90,6 +94,7 @@ (define-module (gnu packages check)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
+  #:use-module (guix build-system guile)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
@@ -3455,3 +3460,49 @@ (define-public python-pytest-regressions
 tables by saving expected data in a data directory (courtesy of pytest-datadir)
 that can be used to verify that future runs produce the same data.")
     (license license:expat)))
+
+(define-public guile-proba
+  (package
+    (name "guile-proba")
+    (version "0.2.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 "04si01wzhc9c8rqy9vr12fpkf8gnlx7crkph8djy80s2c7b1lvr7"))))
+    (build-system guile-build-system)
+    (native-inputs (list guile-3.0 texinfo))
+    (propagated-inputs (list guile-3.0 guile-config guile-lib texinfo))
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'build 'check
+            (lambda _
+              (invoke "guile" "proba.scm" "run" "tests")))
+          (add-after 'install 'install-script-and-manual
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin-dir (string-append out "/bin"))
+                     (info-dir (string-append out "/share/info"))
+                     (script (string-append bin-dir "/proba")))
+                (mkdir-p bin-dir)
+                (mkdir-p info-dir)
+                (copy-file "proba.scm" script)
+                (chmod script #o555)
+                (invoke "makeinfo" "manual/main.texi")
+                (install-file "guile-proba" info-dir)))))
+      #:not-compiled-file-regexp
+      "((packages|tests)\\/.*.scm|(proba|manifest).scm)$"))
+    (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