help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie: How to debug my custom packages? Is there something like Emacs'


From: Rodrigo Morales
Subject: Newbie: How to debug my custom packages? Is there something like Emacs' edebug but for Guix packages?
Date: Fri, 7 Apr 2023 04:20:46 +0000

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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]