all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Catonano <catonano@gmail.com>
To: 26295@debbugs.gnu.org
Subject: bug#26295: [PATCH] 'Debugging Build Failures' subsection
Date: Wed, 29 Mar 2017 12:06:47 +0200	[thread overview]
Message-ID: <CAJ98PDwKu_8=F+3MeN1CxYndJFoYJbo-DLEn9AAbbx9q_K5xDw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 313 bytes --]

This is my first attempt at editing the manual

The line in the git log is completely made up, I couldn't find an example
of logging edits to the manual

I managed to compile it without warning and errors and I even managed to
see it rendered in html (thanks ng0 !!)

Also, I'm not sure about the language style.

[-- Attachment #1.2: Type: text/html, Size: 398 bytes --]

[-- Attachment #2: series.patch --]
[-- Type: text/x-patch, Size: 3467 bytes --]

From 55b9fab0c6f218b73fdf1804c606a4bdcf2ddda4 Mon Sep 17 00:00:00 2001
From: humanitiesNerd <catonano@gmail.com>
Date: Wed, 29 Mar 2017 11:43:55 +0200
Subject: [PATCH 1/1] gnu: Add 'Debugging Build Failures' subsection to
 'Invoking guix build'

* doc/guix.texi (Debugging Build Failures): New subsection.
---
 doc/guix.texi | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 57595b95e..418c0c844 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -34,7 +34,8 @@ Copyright @copyright{} 2017 Clément Lassieur@*
 Copyright @copyright{} 2017 Mathieu Othacehe@*
 Copyright @copyright{} 2017 Federico Beffa@*
 Copyright @copyright{} 2017 Carlo Zancanaro@*
-Copyright @copyright{} 2017 Thomas Danckaert
+Copyright @copyright{} 2017 Thomas Danckaert@*
+Copyright @copyright{} 2017 humanitiesNerd
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -4729,6 +4730,7 @@ described in the subsections below.
 * Common Build Options::        Build options for most commands.
 * Package Transformation Options::  Creating variants of packages.
 * Additional Build Options::    Options specific to 'guix build'.
+* Debugging Build Failures::    Real life packaging experience
 @end menu
 
 @node Common Build Options
@@ -5141,6 +5143,73 @@ https://hydra.gnu.org/log/@dots{}-gdb-7.10
 You can freely access a huge library of build logs!
 @end table
 
+@node Debugging Build Failures
+@subsection Debugging Build Failures
+
+When defining a new package, you will probably find yourself
+spending some time debugging and tweaking the build.
+orr example if the Makefile needs to
+be modified, or some test-cases adjusted.
+
+So you need to operate the build commands yourself in an
+environment as close as possible to the one that the daemon uses.
+
+Say you're packaging foo-1.2 and the build is failing.
+
+The option @option{-K} will keep the (failed) build folder in /tmp.
+
+So you can cd in
+
+@example
+cd /tmp/guix-build-foo.drv-0
+@end example
+
+Here, you will find an ``environment-variables'' file
+containing all the environment variables the daemon is using.
+
+@example
+source environment-variables
+cd foo-1.2
+@end example
+
+Now, you can call commands as if you were the daemon
+(almost) and troubleshoot your build process.
+
+Sometimes it happens that, for example, the tests pass
+when you run them manually and fail when the daemon runs them.
+
+In such cases you need to run them in a container
+like the daemon does.
+
+@example
+  guix build -K foo
+  # build fails…
+  cd /tmp/guix-build-foo.drv-0
+@end example
+
+this is equal to the previous example.
+
+Now:
+
+@example
+  guix environment -C foo --ad-hoc strace gdb
+
+@end example
+
+here, the @option{-C} option creates a container
+and runs your process in it.
+Note the inclusion of @command{strace} and @command{gdb}
+
+@example
+  rm /bin/sh           # to be really like in the guix-daemon environment
+  source ./environment-variables
+  cd foo-1.2
+  $GUIX_ENVIRONMENT/bin/strace -f -o log make check
+@end example
+
+In this way, not only you will have reproduced the environment variables
+the daemon uses, you will also be running the build process in a container
+similar to the one the daemon uses.
 
 @node Invoking guix edit
 @section Invoking @command{guix edit}
-- 
2.12.0


             reply	other threads:[~2017-03-29 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 10:06 Catonano [this message]
2017-05-03 21:53 ` bug#26295: [PATCH] 'Debugging Build Failures' subsection Ludovic Courtès
2017-05-04  5:35   ` Catonano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ98PDwKu_8=F+3MeN1CxYndJFoYJbo-DLEn9AAbbx9q_K5xDw@mail.gmail.com' \
    --to=catonano@gmail.com \
    --cc=26295@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.