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
2019-12-10 18:16:59 +03:00
e l s e
SHORTEN := >>$( BUILDLOG)
2012-04-23 22:56:35 +04:00
e n d i f
2019-12-08 14:12:00 +03:00
report = $( and $( 1) ,$( report_body) )
d e f i n e r e p o r t _ b o d y
{ i f [ - s "$$OUT" ] ; t h e n \
echo " ** $( 1) : $$ OUT " $( SHORTEN) ; \
f i ; }
e n d e f
2021-04-28 14:48:59 +03:00
all : reports /targets reports /scripts reports /cleanlog \
reports/contents reports/packages
2012-04-25 17:42:04 +04:00
@if [ -n " $( IMAGE_OUTPATH) " ] ; then \
2021-04-16 11:31:03 +03:00
rm -fr " $( LOGDIR) / $( IMAGE_OUTFILE) .reports " ; \
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 " ; \
2019-12-08 14:12:00 +03:00
BUILDDIR = " $( BUILDDIR) " \
cleanlog < $( BUILDLOG) > " $$ OUT " \
&& $( call report,diffable log)
2012-10-17 01:55:53 +04:00
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 " \
2019-12-08 14:12:00 +03:00
&& $( call report,scripts report)
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 \
2021-04-29 17:26:51 +03:00
OUT = " $( REPORTDIR) / $( @F) .svgz " ; \
2012-04-23 21:45:32 +04:00
report-targets < " $( REPORT_PATH) " \
2021-04-29 17:26:51 +03:00
| dot -Tsvgz -o " $$ OUT " \
2019-12-08 14:12:00 +03:00
&& $( call report,target graph report) ; \
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 " \
2019-12-08 14:12:00 +03:00
&& $( call report,graphviz missing, target graph dot file) ; \
fi ; \
2012-04-23 22:56:35 +04:00
mv " $( REPORT_PATH) " " $( REPORTDIR) / $( @F) .log "
2012-04-23 13:42:13 +04:00
2018-06-11 11:15:49 +03:00
reports/contents : reports /prep
@case $( IMAGE_OUTFILE) in \
*.iso) \
if type -t isoinfo >& /dev/null; then \
OUT = " $( REPORTDIR) / $( @F) .txt " ; \
2019-12-08 14:12:00 +03:00
isoinfo -f -R -i $( IMAGE_OUTPATH) > $$ OUT \
&& $( call report,contents list) ; \
2018-06-11 11:15:49 +03:00
else \
echo "reports.mk: missing isoinfo" >& 2; \
fi ; \
esac
2021-04-28 14:48:59 +03:00
2021-04-28 16:29:46 +03:00
reports/packages : SHELL = /bin /bash
2021-04-28 14:48:59 +03:00
reports/packages : reports /prep
@grep -E 'chroot/.in/[^/]*.rpm' < $( BUILDLOG) | \
cut -d' ' -f 1 | tr -d "'" '`' | \
2021-04-28 15:06:57 +03:00
tee /dev/stderr 2> >( sed 's,^.*/,,' | \
sort -u > " $( REPORTDIR) /list-rpms.txt " ) | \
2021-04-28 14:48:59 +03:00
xargs rpm -qp --queryformat '%{sourcerpm}\n' | \
sort -u > " $( REPORTDIR) /list-srpms.txt "
2018-06-11 11:15:49 +03:00
2012-04-23 13:42:13 +04:00
e l s e
all : ; @:
e n d i f