1 |
commit: c770bea7dfb34a39f305407e8126f3536e6ce6af |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 29 16:43:54 2012 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 29 17:11:11 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/crossdev.git;a=commit;h=c770bea7 |
7 |
|
8 |
crossdev: tell users what to post when a build fails |
9 |
|
10 |
Include all the log files and such. |
11 |
|
12 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
13 |
|
14 |
--- |
15 |
crossdev | 55 +++++++++++++++++++++++++++++++++++++++---------------- |
16 |
1 files changed, 39 insertions(+), 16 deletions(-) |
17 |
|
18 |
diff --git a/crossdev b/crossdev |
19 |
index 14515ca..65bd433 100755 |
20 |
--- a/crossdev |
21 |
+++ b/crossdev |
22 |
@@ -16,14 +16,21 @@ CONFIGROOT="${PORTAGE_CONFIGROOT}/etc/portage" |
23 |
|
24 |
source /etc/init.d/functions.sh || exit 1 |
25 |
esyslog() { :; } |
26 |
-die() { |
27 |
+die_logs() { |
28 |
echo |
29 |
- eerror $* |
30 |
- eerror If you file a bug, please attach the following logfiles: |
31 |
- eerror ${PORT_LOGDIR}/cross-${CTARGET}-info.log |
32 |
- eerror ${logfile} |
33 |
+ eerror "$1" |
34 |
+ |
35 |
+ shift |
36 |
+ local log |
37 |
+ eerror |
38 |
+ eerror "If you file a bug, please attach the following logfiles:" |
39 |
+ eerror "${PORT_LOGDIR}/cross-${CTARGET}-info.log" |
40 |
+ for log in "$@" ; do |
41 |
+ eerror "${log}" |
42 |
+ done |
43 |
exit 1 |
44 |
} |
45 |
+die() { die_logs "$*"; } |
46 |
has() { [[ " ${@:2} " == *" $1 "* ]]; } |
47 |
|
48 |
usage() { |
49 |
@@ -274,7 +281,7 @@ setup_portage_vars() { |
50 |
local arch=${ARCH} arch_set=${ARCH+set} |
51 |
local chost=${CHOST} chost_set=${CHOST+set} |
52 |
unset arch chost |
53 |
- eval $(portageq envvar -v PORTDIR_OVERLAY PORTDIR PORT_LOGDIR ARCH CHOST) |
54 |
+ eval $(portageq envvar -v PORTDIR_OVERLAY PORTDIR PORT_LOGDIR PORTAGE_TMPDIR ARCH CHOST) |
55 |
|
56 |
# keep the original values, but be aware of the native ones |
57 |
HARCH=${ARCH} |
58 |
@@ -928,30 +935,46 @@ set_eopts_on_pkg_status() { |
59 |
|| EOPTS=${EOPTS_UP} |
60 |
} |
61 |
doemerge() { |
62 |
- [[ $1 == "[none]" ]] && return 0 |
63 |
+ local category="cross-${CTARGET}" |
64 |
+ local pn=$1 |
65 |
+ local atom="${category}/${pn}" |
66 |
+ |
67 |
+ [[ ${pn} == "[none]" ]] && return 0 |
68 |
|
69 |
- local logfile=${PORT_LOGDIR}/cross-${CTARGET} |
70 |
+ local logfile=${PORT_LOGDIR}/${category} |
71 |
[[ -z $2 ]] \ |
72 |
- && logfile=${logfile}-$1.log \ |
73 |
+ && logfile=${logfile}-${pn}.log \ |
74 |
|| logfile=${logfile}-$2.log |
75 |
|
76 |
einfo "Log: ${logfile}" |
77 |
- ebegin "Emerging cross-${2:-$1}" |
78 |
+ ebegin "Emerging cross-${2:-${pn}}" |
79 |
|
80 |
- set_use $1 ${USE} $( [[ ${MULTILIB_USE} == "no" ]] && echo - )multilib |
81 |
+ set_use ${pn} ${USE} $( [[ ${MULTILIB_USE} == "no" ]] && echo - )multilib |
82 |
|
83 |
if has -v ${UOPTS} || has -p ${UOPTS} || has -vp ${UOPTS} || has -pv ${UOPTS} ; then |
84 |
SHOW_FAIL_LOG="no" |
85 |
- emerge cross-${CTARGET}/$1 ${EOPTS} \ |
86 |
- 2>&1 | tee "${logfile}" |
87 |
+ emerge ${atom} ${EOPTS} 2>&1 | tee "${logfile}" |
88 |
else |
89 |
- emerge cross-${CTARGET}/$1 ${EOPTS} \ |
90 |
- >& "${logfile}" |
91 |
+ emerge ${atom} ${EOPTS} >& "${logfile}" |
92 |
fi |
93 |
local _pipestatus=${PIPESTATUS[*]} |
94 |
if [[ "${_pipestatus// /}" -ne 0 ]] ; then |
95 |
[[ ${SHOW_FAIL_LOG} == "yes" ]] && cat "${logfile}" |
96 |
- die "$1 failed :(" |
97 |
+ |
98 |
+ local d |
99 |
+ for d in "${PORTAGE_TMPDIR}"/portage/${atom}*/work/ ; do |
100 |
+ pushd "${d}" >/dev/null |
101 |
+ mkdir -p ../temp # sanity! |
102 |
+ find -name config.log | \ |
103 |
+ tar cf - --files-from=- | \ |
104 |
+ xz > ../temp/${pn}-config.logs.tar.xz |
105 |
+ popd "${d}" >/dev/null |
106 |
+ done |
107 |
+ xz -zk "${logfile}" |
108 |
+ |
109 |
+ die_logs "${pn} failed :(" \ |
110 |
+ "${logfile}.xz" \ |
111 |
+ "${PORTAGE_TMPDIR}/portage/${atom}*/temp/${pn}-config.logs.tar.xz" |
112 |
fi |
113 |
eend 0 |
114 |
} |