I'm using pbuilder-dist to test a build against a specific Ubuntu release and architecture. When I build SiLK 3.10.2 for i386 on 14.04 (trusty), one of the make tests fail:

make[5]: Entering directory `/tmp/buildd/silk-3.10.2/src/rwconvert'
PASS: tests/rwallformats-help.pl
PASS: tests/rwallformats-version.pl
PASS: tests/rwallformats-lone-command.pl
PASS: tests/rwrtd2split-help.pl
PASS: tests/rwrtd2split-version.pl
PASS: tests/rwrtd2split-lone-command.pl
FAIL: tests/rwallformats-all.pl
Testsuite summary for SiLK 3.10.2
# TOTAL: 7
# PASS:  6
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
See src/rwconvert/test-suite.log
Please report to netsa-help@cert.org
make[5]: *** [test-suite.log] Error 1
make[5]: Leaving directory `/tmp/buildd/silk-3.10.2/src/rwconvert'
make[4]: *** [check-TESTS] Error 2
make[4]: Leaving directory `/tmp/buildd/silk-3.10.2/src/rwconvert'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/tmp/buildd/silk-3.10.2/src/rwconvert'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/tmp/buildd/silk-3.10.2/src'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/tmp/buildd/silk-3.10.2'
dh_auto_test: make -j1 check returned exit code 2
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
I: unmounting dev/pts filesystem
I: unmounting run/shm filesystem
I: unmounting proc filesystem
I: cleaning the build env 
I: removing directory /var/cache/pbuilder/build//37742 and its subdirectories

I would like to get the log file src/rwconvert/test-suite.log the output above refers to, but how can I extract this file from the chrooted build environment, or get pbuilder-dist to output this file as well?

PS: my $HOME/pbuilder/trusty-i386_result/ directory only contains the console output and a log file called last_operation.log. But last_operation.log lists only the output from the cleaning of the build environment (which is executed after the build failed).


Found a way to solve this, so I'll answer my own question.

The solution was to use a hook script to pbuilder. The linked article describe it well, but for the sake of completeness, I'll redo the steps here:

First create a directory for you hook scripts:

sudo mkdir /var/cache/pbuilder/hook.d

Then add this directory to pbuilder's configuration:

echo HOOKDIR=\"/var/cache/pbuilder/hook.d\" >> ~/.pbuilderrc

Create a hook script called C10shell with the following contents:

# invoke shell if build fails.

apt-get install -y --force-yes vim less bash
cd /tmp/buildd/*/debian/..
/bin/bash < /dev/tty > /dev/tty 2> /dev/tty

Save it to your HOOKDIR, and make it executeable

sudo chmod a+x /var/cache/pbuilder/hook.d/C10shell

Now, if the build fails, you will be presented with a root shell within the chrooted environment of pbuilder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.