* Newbie: How to debug my custom packages? Is there something like Emacs' edebug but for Guix packages?
@ 2023-04-07 4:20 Rodrigo Morales
2023-04-07 8:33 ` Simon Tournier
0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Morales @ 2023-04-07 4:20 UTC (permalink / raw)
To: help-guix
Table of Contents
_________________
1. The problem
2. Additional information
1 The problem
=============
I'm learning how to define my own Guix packages. To debug the packages
that I write, I'm currently repeatedly executing the command `guix
package -i' , check whether the downloaded files have been placed in
the correct locations. If the installation failed, I switched back to
the previous generation, do some changes and repeat the same
process. However, I feel there's a better way to do this, because this
is a rather slow process. Besides that, there are some variables whose
value I don't know how to print or see their current value during the
entire installation of the package.
For example, I've defined the following Guix package (see code block
below). In this package, I'd like to be able to know the result of the
evaluation of `(string-append #$output "/share/rime-data")' during
installation. I know this can be inferred, because `#$output' is a
commonly used term. However, some sexps are more complex and I'd also
be interested in see the results they yield to.
,----
| (define-module (rime)
| #:use-module (guix licenses)
| #:use-module (guix packages)
| #:use-module (guix gexp)
| #:use-module (guix build-system trivial)
| #:use-module (guix git-download))
|
| (define-public rime-wubi-8105
| (package
| (name "rime-wubi-8105")
| (version "1.0")
| (source (origin
| (method git-fetch)
| (uri (git-reference
| (url "https://github.com/rdrg109/wubi-8105")
| (commit "3e81f26ac6f261ad5bb361ef23bc4a7df6a088d1")))
| (file-name (git-file-name name version))
| (sha256
| (base32
| "133vf7gsicqikv4kyl1rx0d1yiblgihis1x8gm9h21k59ql8gadn"))))
| (build-system trivial-build-system)
| (arguments
| (list
| #:modules `((guix build utils))
| #:builder
| #~(begin
| (use-modules (guix build utils))
| (chdir (assoc-ref %build-inputs "source"))
| (install-file "wubi86_8105.dict.yaml" (string-append #$output
"/share/rime-data"))
| (install-file "wubi86_8105.schema.yaml" (string-append
#$output "/share/rime-data")))))
| (synopsis "Wubi86 input method of standard Chinese characters for
RIME")
| (description "This package contains a RIME dictionary and schema for
the 86 version
| of Wubi, a shape-based input method for Chinese characters. The domain
| of characters are those characters from the Table of General Standard
| Chinese Characters (https://www.wikidata.org/wiki/Q14941454).")
| (home-page "https://github.com/rdrg109/wubi-8105")
| (license lgpl3)))
`----
2 Additional information
========================
I have previously defined my own Emacs packages and what I found
useful was the [edebug utility] which allows me to step through any
step of the function and see the value of any variable at any point.
I'm wondering if there's something like that but for Guix packages.
Any other tool that can help me debug the packages that I write is
also appreciated.
[edebug utility]:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Using-Edebug.html)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Newbie: How to debug my custom packages? Is there something like Emacs' edebug but for Guix packages?
2023-04-07 4:20 Newbie: How to debug my custom packages? Is there something like Emacs' edebug but for Guix packages? Rodrigo Morales
@ 2023-04-07 8:33 ` Simon Tournier
0 siblings, 0 replies; 2+ messages in thread
From: Simon Tournier @ 2023-04-07 8:33 UTC (permalink / raw)
To: Rodrigo Morales, help-guix
Hi,
On ven., 07 avril 2023 at 04:20, Rodrigo Morales <moralesrodrigo1100@gmail.com> wrote:
> | (build-system trivial-build-system)
Please note that the ’trivial-build-system’ is the less trivial build
system. I think you need ’copy-build-system’ instead.
Roughly speaking, using this,
mkdir path/to/test/folder
edit path/to/test/folder/rime.scm
where rime.scm contains the block you provided. Then my trial-error
loop looks like:
guix build -L path/to/test/folder rime-wubi-8105 -K
With the option ’-K’, it keeps the temporary build under
/tmp/guix-<something> but here it does not seem very useful.
Last, you can check with,
--8<---------------cut here---------------start------------->8---
$ tree $(guix build -L /tmp/foo rime-wubi-8105 --no-grafts)
/gnu/store/nqc3sfndq6665d0lfrb3h6j58d559j6a-rime-wubi-8105-1.0
└── share
└── rime-data
├── wubi86_8105.dict.yaml
└── wubi86_8105.schema.yaml
--8<---------------cut here---------------end--------------->8---
Hope that helps,
simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-07 10:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-07 4:20 Newbie: How to debug my custom packages? Is there something like Emacs' edebug but for Guix packages? Rodrigo Morales
2023-04-07 8:33 ` Simon Tournier
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).