Commit daa802a0 authored by Joey Hess's avatar Joey Hess

point users at the log file on error, try to show a package name too

When installation or configuration of a package fails, output a message
that points the user to the log file[1]. Attempt to grep out the first
package that dpkg failed on and show its name too. Closes: #472704

Sample:

W: Failure while configuring base packages.  This will be re-attempted up to five times.
W: See sid/debootstrap.log for details (possibly the package libept1 is at fault)

This relies on the LANG=C currently set for the debootstrap run.
Changes to the "dpkg: error processing $PACKAGE" message would break
the package name extractor, but it'd fall back to not showing a
package name.

This adds cut to the set of utilities debootstrap uses, which shouldn't
be a problem.

[1] In d-i, debootstrap doesn't know where the log file is, but then
this message goes to the same syslog file, so I didn't add any special
handling for this case.
parent 67932a83
debootstrap (1.0.40) UNRELEASED; urgency=low
* When installation or configuration of a package fails, output a message
that points the user to the log file. Attempt to grep out the first
package that dpkg failed on and show its name too. Closes: #472704
-- Joey Hess <joeyh@debian.org> Tue, 17 Apr 2012 20:35:53 -0400
debootstrap (1.0.39) unstable; urgency=low
* Retry corrupted downloads rather than carrying on almost regardless.
......
......@@ -876,6 +876,18 @@ in_target_failmsg () {
local arg="$3"
shift; shift; shift
if ! $CHROOT_CMD "$@"; then
warning "$code" "$msg" "$arg"
# Try to point user at actual failing package.
msg="See %s for details"
if [ -e "$TARGET/debootstrap/debootstrap.log" ]; then
arg="$TARGET/debootstrap/debootstrap.log"
local pkg="$(grep '^dpkg: error processing ' "$TARGET/debootstrap/debootstrap.log" | head -n 1 | cut -d ' ' -f 4)"
if [ -n "$pkg" ]; then
msg="$msg (possibly the package $pkg is at fault)"
fi
else
arg="the log"
fi
warning "$code" "$msg" "$arg"
return 1
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment