2012-03-19 15:42:10 +04:00
# collect what's left
2012-04-23 13:42:13 +04:00
i f n e q ( , $( REPORT ) )
2012-04-18 23:22:29 +04:00
i n c l u d e l i b / c o m m o n . m k
2012-04-23 21:45:32 +04:00
2012-04-23 22:56:35 +04:00
BUILDDIR := $( shell sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' " $( REPORT_PATH) " )
BUILDLOG := $( BUILDDIR) /$( BUILD_LOG)
2012-04-25 17:42:04 +04:00
REPORTDIR := $( BUILDDIR) /reports
2012-04-23 22:56:35 +04:00
IMAGE_OUTPATH := $( shell sed -n 's/^IMAGE_OUTPATH = \(.*\)/\1/p' $( BUILDLOG) )
2012-06-15 20:33:04 +04:00
IMAGE_OUTFILE := $( shell sed -n 's/^IMAGE_OUTFILE = \(.*\)/\1/p' $( BUILDLOG) )
LOGDIR := $( shell sed -n 's/^LOGDIR = \(.*\)/\1/p' $( BUILDLOG) )
2012-04-23 22:56:35 +04:00
# for a multi-image build there's no sense to refer to buildroot
# contained reports as these are very ephemeral between builds
i f n e q ( 1 , $( NUM_TARGETS ) )
SHORTEN := >/dev/null
e n d i f
2012-10-17 01:55:53 +04:00
all : reports /targets reports /scripts reports /cleanlog
2012-04-25 17:42:04 +04:00
@if [ -n " $( IMAGE_OUTPATH) " ] ; then \
2012-06-15 20:33:04 +04:00
cp -a " $( REPORTDIR) " " $( LOGDIR) / $( IMAGE_OUTFILE) .reports " ; \
2012-04-25 17:42:04 +04:00
fi
2012-04-18 23:22:29 +04:00
reports/prep :
2012-04-23 22:56:35 +04:00
@mkdir -p " $( REPORTDIR) "
2012-04-18 23:22:29 +04:00
2012-10-17 01:55:53 +04:00
# try to drop common noise rendering diff(1) mostly useless
reports/cleanlog : reports /prep
@OUT= " $( REPORTDIR) / $( @F) .log " ; \
sed -r \
-e 's,$(BUILDDIR),,g' \
-e '/\/var\/lib\/apt\/lists/d' \
-e 's/... .. ..:..:..//g' \
-e 's/\[[0-9]+\]//g' \
-e '/^(Reading Package Lists|Building Dependency Tree)/d' \
-e '/^(Fetched|Need to get|After unpacking) /d' \
-e '/^(Preparing packages for installation|Done\.)/d' \
-e '/^hsh(|-(initroot|install|fakedev|(mk|rm)chroot|run)): /d' \
-e '/^(hasher-priv|mkaptbox|(mk|rm)dir): /d' \
-e '/^mki-((invalidate-|)cache|check-obsolete|prepare): /d' \
-e '/^(mode of|changed (group|ownership)|removed) /d' \
-e '/^chroot\/.in\//d' \
-e '/ has started executing\.$$/d' \
-e '/\/var\/log\/apt\.log$$/d' \
-e '/\/usr\/share\/apt\/scripts\/log\.lua/d' \
-e '/\.rpm$$/d' \
-e "/' -> '/d" \
< $( BUILDLOG) \
> " $( REPORTDIR) / $( @F) .log " \
&& echo " ** diffable log: $$ OUT " $( SHORTEN)
2012-04-18 23:22:29 +04:00
reports/scripts : reports /prep
2012-04-25 17:56:48 +04:00
@OUT= " $( REPORTDIR) / $( @F) .log " ; \
grep "^mki.*scripts: Run: " $( BUILDLOG) \
| sed -rn " s,^.*( $( BUILDDIR) | $( SYMLINK) )/(.*)' $$ ,\2,p " > " $$ OUT " \
&& if [ -s " $$ OUT " ] ; then \
echo " ** scripts report: $$ OUT " $( SHORTEN) ; \
fi
2012-04-18 23:22:29 +04:00
reports/targets : reports /prep
2012-04-23 21:45:32 +04:00
@if ! [ -n " $( REPORT_PATH) " -a -s " $( REPORT_PATH) " ] ; then \
exit 0; \
fi ; \
2012-04-23 13:42:13 +04:00
if type -t dot >& /dev/null; then \
2012-04-25 17:56:48 +04:00
OUT = " $( REPORTDIR) / $( @F) .png " ; \
2012-04-23 21:45:32 +04:00
report-targets < " $( REPORT_PATH) " \
2012-04-25 17:56:48 +04:00
| dot -Tpng -o " $$ OUT " \
&& if [ -s " $$ OUT " ] ; then \
echo " ** target graph report: $$ OUT " ; \
fi ; \
2012-04-09 15:40:42 +04:00
else \
2012-04-25 17:56:48 +04:00
OUT = " $( BUILDDIR) /targets.dot " ; \
report-targets < " $( REPORT_PATH) " > " $$ OUT " \
&& if [ -s " $$ OUT " ] ; then \
echo "** graphviz missing, " \
" target graph dot file: $$ OUT " ; \
fi ; \
2012-04-18 23:22:29 +04:00
fi $( SHORTEN) ; \
2012-04-23 22:56:35 +04:00
mv " $( REPORT_PATH) " " $( REPORTDIR) / $( @F) .log "
2012-04-23 13:42:13 +04:00
e l s e
all : ; @:
e n d i f