unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: Hwo to debug and teacking builds?
Date: Tue, 28 Mar 2017 17:58:38 +0200	[thread overview]
Message-ID: <58DA882E.3040906@crazy-compilers.com> (raw)
In-Reply-To: <8737dx7mpb.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]

Hello,

thank you very much for these snippets. I'm a lazy guy :-) so I wrapped
this into a script, which starts a new bash with this environment (see
attachment). Maybe this could be enhanced using guix mechanisms?
Suggestions are welcome.

Usage:

./pkg-env  # go into latest failed build - very convenient :-)
./pkg-env  some-package # go into latest failed build of this package
./pkg-env /tmp/guix-build-some-package-1.4.01.drv-1 # go into this directory

> That would probably make a good “Debugging Build Failures” section.

Absolutely!

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |


[-- Attachment #2: pkg-env --]
[-- Type: text/plain, Size: 1059 bytes --]

#!/bin/bash
# Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
# License: GNU Public License v3.0 or (at your choice) later

PACKAGE="${1}"
if [ -z "${PACKAGE}" ] ; then
    PACKAGE=$(ls -td /var/tmp/guix-build-*.drv-* /tmp/guix-build-"$PACKAGE"-* 2>/dev/null | head -1)
    echo >&2 "No package name given, using $PACKAGE"
elif [ "${PACKAGE#/var/tmp/}" = "$PACKAGE" ] ; then
    PACKAGE=$(ls -td /var/tmp/guix-build-"$PACKAGE"-* /tmp/guix-build-"$PACKAGE"-* 2>/dev/null | head -1)
fi

if [ ! -d "$PACKAGE" ] ; then
    echo >&2 "Not found: $PACKAGE"
    exit 10
fi

#echo "Using $PACKAGE"

# TODO: Support containers:
#  guix environment -C foo --ad-hoc strace gdb
#  rm /bin/sh           # to be really like in the guix-daemon environment

inifile=$(mktemp)
cat > $inifile <<EOF
cd $PACKAGE
source $PACKAGE/environment-variables 
set +x
cd \$(find . -maxdepth 1 -mindepth 1 -type d 2>/dev/null) .
echo \$PWD
EOF

#echo '------------' ; cat $inifile ; echo '------------'
env -i HOME=/tmp bash --noprofile --init-file $inifile

rm -f $inifile

      parent reply	other threads:[~2017-03-28 15:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  9:16 Hwo to debug and teacking builds? Hartmut Goebel
2017-03-28  9:52 ` Ludovic Courtès
2017-03-28 13:45   ` Catonano
2017-03-28 16:07     ` ng0
2017-03-28 18:11       ` Catonano
2017-03-28 18:24         ` ng0
2017-04-10  6:39         ` Ricardo Wurmus
2017-04-10  7:19           ` Catonano
2017-03-29  6:10     ` Chris Marusich
2017-03-29 10:36       ` Catonano
2017-04-11 14:15       ` myglc2
2017-04-11 15:40         ` Chris Marusich
2017-04-11 16:36           ` Hartmut Goebel
2017-04-11 19:01             ` myglc2
2017-04-13  1:32             ` Chris Marusich
2017-03-28 15:58   ` Hartmut Goebel [this message]

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=58DA882E.3040906@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --cc=help-guix@gnu.org \
    --cc=ludo@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.
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).