forked from altcloud/mkimage-profiles
reports.mk: refactor report output
Make it uniform through a function -- with the initially desired effect of no extra lines while building multiple images with REPORT=1 (those were useless anyways printing repeatedly the same path that's relative to a particular builddir).
This commit is contained in:
parent
e80a3e7cca
commit
5e20cec7e2
29
reports.mk
29
reports.mk
@ -17,6 +17,13 @@ ifneq (1,$(NUM_TARGETS))
|
|||||||
SHORTEN := >/dev/null
|
SHORTEN := >/dev/null
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
report = $(and $(1),$(report_body))
|
||||||
|
define report_body
|
||||||
|
{ if [ -s "$$OUT" ]; then \
|
||||||
|
echo "** $(1): $$OUT" $(SHORTEN); \
|
||||||
|
fi; }
|
||||||
|
endef
|
||||||
|
|
||||||
all: reports/targets reports/scripts reports/cleanlog reports/contents
|
all: reports/targets reports/scripts reports/cleanlog reports/contents
|
||||||
@if [ -n "$(IMAGE_OUTPATH)" ]; then \
|
@if [ -n "$(IMAGE_OUTPATH)" ]; then \
|
||||||
cp -a "$(REPORTDIR)" "$(LOGDIR)/$(IMAGE_OUTFILE).reports"; \
|
cp -a "$(REPORTDIR)" "$(LOGDIR)/$(IMAGE_OUTFILE).reports"; \
|
||||||
@ -28,16 +35,15 @@ reports/prep:
|
|||||||
# try to drop common noise rendering diff(1) mostly useless
|
# try to drop common noise rendering diff(1) mostly useless
|
||||||
reports/cleanlog: reports/prep
|
reports/cleanlog: reports/prep
|
||||||
@OUT="$(REPORTDIR)/$(@F).log"; \
|
@OUT="$(REPORTDIR)/$(@F).log"; \
|
||||||
BUILDDIR="$(BUILDDIR)" cleanlog < $(BUILDLOG) > "$$OUT" \
|
BUILDDIR="$(BUILDDIR)" \
|
||||||
&& echo "** diffable log: $$OUT" $(SHORTEN)
|
cleanlog < $(BUILDLOG) > "$$OUT" \
|
||||||
|
&& $(call report,diffable log)
|
||||||
|
|
||||||
reports/scripts: reports/prep
|
reports/scripts: reports/prep
|
||||||
@OUT="$(REPORTDIR)/$(@F).log"; \
|
@OUT="$(REPORTDIR)/$(@F).log"; \
|
||||||
grep "^mki.*scripts: Run: " $(BUILDLOG) \
|
grep "^mki.*scripts: Run: " $(BUILDLOG) \
|
||||||
| sed -rn "s,^.*($(BUILDDIR)|$(SYMLINK))/(.*)'$$,\2,p" > "$$OUT" \
|
| sed -rn "s,^.*($(BUILDDIR)|$(SYMLINK))/(.*)'$$,\2,p" > "$$OUT" \
|
||||||
&& if [ -s "$$OUT" ]; then \
|
&& $(call report,scripts report)
|
||||||
echo "** scripts report: $$OUT" $(SHORTEN); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
reports/targets: reports/prep
|
reports/targets: reports/prep
|
||||||
@if ! [ -n "$(REPORT_PATH)" -a -s "$(REPORT_PATH)" ]; then \
|
@if ! [ -n "$(REPORT_PATH)" -a -s "$(REPORT_PATH)" ]; then \
|
||||||
@ -47,17 +53,12 @@ reports/targets: reports/prep
|
|||||||
OUT="$(REPORTDIR)/$(@F).png"; \
|
OUT="$(REPORTDIR)/$(@F).png"; \
|
||||||
report-targets < "$(REPORT_PATH)" \
|
report-targets < "$(REPORT_PATH)" \
|
||||||
| dot -Tpng -o "$$OUT" \
|
| dot -Tpng -o "$$OUT" \
|
||||||
&& if [ -s "$$OUT" ]; then \
|
&& $(call report,target graph report); \
|
||||||
echo "** target graph report: $$OUT"; \
|
|
||||||
fi; \
|
|
||||||
else \
|
else \
|
||||||
OUT="$(BUILDDIR)/targets.dot"; \
|
OUT="$(BUILDDIR)/targets.dot"; \
|
||||||
report-targets < "$(REPORT_PATH)" > "$$OUT" \
|
report-targets < "$(REPORT_PATH)" > "$$OUT" \
|
||||||
&& if [ -s "$$OUT" ]; then \
|
&& $(call report,graphviz missing, target graph dot file); \
|
||||||
echo "** graphviz missing," \
|
|
||||||
"target graph dot file: $$OUT"; \
|
|
||||||
fi; \
|
fi; \
|
||||||
fi $(SHORTEN); \
|
|
||||||
mv "$(REPORT_PATH)" "$(REPORTDIR)/$(@F).log"
|
mv "$(REPORT_PATH)" "$(REPORTDIR)/$(@F).log"
|
||||||
|
|
||||||
reports/contents: reports/prep
|
reports/contents: reports/prep
|
||||||
@ -65,8 +66,8 @@ reports/contents: reports/prep
|
|||||||
*.iso) \
|
*.iso) \
|
||||||
if type -t isoinfo >&/dev/null; then \
|
if type -t isoinfo >&/dev/null; then \
|
||||||
OUT="$(REPORTDIR)/$(@F).txt"; \
|
OUT="$(REPORTDIR)/$(@F).txt"; \
|
||||||
isoinfo -f -R -i $(IMAGE_OUTPATH) > $$OUT && \
|
isoinfo -f -R -i $(IMAGE_OUTPATH) > $$OUT \
|
||||||
echo "** contents list: $$OUT" $(SHORTEN); \
|
&& $(call report,contents list); \
|
||||||
else \
|
else \
|
||||||
echo "reports.mk: missing isoinfo" >&2; \
|
echo "reports.mk: missing isoinfo" >&2; \
|
||||||
fi; \
|
fi; \
|
||||||
|
Loading…
Reference in New Issue
Block a user