reports.mk: added reports/scripts
This one extracts the exact time-ordered list of script hooks run while building the image. Some commons refactoring is also due.
This commit is contained in:
parent
c66e8ae242
commit
6ada32dc91
@ -71,7 +71,7 @@
|
||||
+ см. ../lib/build.mk
|
||||
|
||||
- REPORT
|
||||
+ запрашивает создание отчёта о собранном образе
|
||||
+ запрашивает создание отчётов о собранном образе
|
||||
+ значение: пусто (по умолчанию) либо любая строка
|
||||
+ NB: в силу специфики обработки передаётся только явно
|
||||
+ см. ../Makefile, ../report.mk, ../lib/report.mk
|
||||
|
16
lib/common.mk
Normal file
16
lib/common.mk
Normal file
@ -0,0 +1,16 @@
|
||||
# common bits for building and reporting parts
|
||||
|
||||
# somewhat reusable
|
||||
BUILD_LOG = build.log
|
||||
|
||||
# link it to BUILDDIR if possible
|
||||
SYMLINK = build
|
||||
|
||||
# brevity postprocessor; not exported, for toplevel use only
|
||||
SHORTEN = $(shell \
|
||||
echo -n "| sed"; \
|
||||
if [ -s "$(SYMLINK)" ]; then \
|
||||
echo -n " -e 's,$(BUILDDIR),$(SYMLINK),'"; \
|
||||
fi; \
|
||||
echo -n " -e 's,$(TMP),\$$TMP,' -e 's,$(HOME),~,'"; \
|
||||
)
|
11
lib/log.mk
11
lib/log.mk
@ -14,7 +14,7 @@ ifeq (-,$(shell rpmvercmp $(HSH_VERSION) $(HSH_VER_OPTIMAL) | tr -d [0-9]))
|
||||
$(info warning: hasher-$(HSH_VERSION) is suboptimal, consider upgrading)
|
||||
endif
|
||||
|
||||
BUILDLOG ?= $(BUILDDIR)/build.log
|
||||
BUILDLOG ?= $(BUILDDIR)/$(BUILD_LOG)
|
||||
|
||||
# LOG holds a redirecting postprocessor
|
||||
ifdef DEBUG
|
||||
@ -35,12 +35,3 @@ DATE = $(shell date +%Y%m%d)
|
||||
TIME = `date +%H:%M:%S`
|
||||
|
||||
export BUILDLOG DATE GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL
|
||||
|
||||
# brevity postprocessor; not exported, for toplevel use only
|
||||
SHORTEN = $(shell \
|
||||
echo -n "| sed"; \
|
||||
if [ -s "$(SYMLINK)" ]; then \
|
||||
echo -n " -e 's,$(BUILDDIR),$(SYMLINK),'"; \
|
||||
fi; \
|
||||
echo -n " -e 's,$(TMP),\$$TMP,' -e 's,$(HOME),~,'"; \
|
||||
)
|
||||
|
@ -2,8 +2,6 @@ ifndef MKIMAGE_PROFILES
|
||||
$(error this makefile is designed to be included in toplevel one)
|
||||
endif
|
||||
|
||||
SYMLINK = build
|
||||
|
||||
# this could have come from env; or could be symlinked; or is made anew
|
||||
# (the reuse rationale is avoiding extra tmpdir lookups)
|
||||
# NB: immediate assignment matters
|
||||
|
30
reports.mk
30
reports.mk
@ -1,19 +1,33 @@
|
||||
# collect what's left
|
||||
|
||||
all: reports/targets
|
||||
BUILDDIR := $(shell sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' "$$REPORT_PATH")
|
||||
|
||||
reports/targets:
|
||||
include lib/common.mk
|
||||
|
||||
all: reports/targets reports/scripts
|
||||
|
||||
reports/prep:
|
||||
@if ! [ -n "$$REPORT_PATH" -a -s "$$REPORT_PATH" ]; then \
|
||||
exit 0; \
|
||||
fi; \
|
||||
BUILDDIR="`sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' "$$REPORT_PATH"`"; \
|
||||
if type -t dot >&/dev/null; then \
|
||||
REPORT_IMAGE="$$BUILDDIR/targets.png"; \
|
||||
mkdir -p "$(BUILDDIR)/reports/"
|
||||
|
||||
reports/scripts: reports/prep
|
||||
@grep "^mki.*scripts: Run: " $(BUILDDIR)/$(BUILD_LOG) \
|
||||
| sed -rn "s,^.*($(BUILDDIR)|$(SYMLINK))/(.*)'$$,\2,p" \
|
||||
> "$(BUILDDIR)/$@.log" \
|
||||
&& echo "** scripts report: $(BUILDDIR)/$@.log" $(SHORTEN)
|
||||
|
||||
reports/targets: reports/prep
|
||||
@if type -t dot >&/dev/null; then \
|
||||
REPORT_IMAGE="$(BUILDDIR)/$@.png"; \
|
||||
report-targets < "$$REPORT_PATH" \
|
||||
| dot -Tpng -o "$$REPORT_IMAGE" \
|
||||
&& echo "** target graph report: $$REPORT_IMAGE"; \
|
||||
else \
|
||||
REPORT_DOT="$$BUILDDIR/targets.dot"; \
|
||||
REPORT_DOT="$(BUILDDIR)/targets.dot"; \
|
||||
report-targets < "$$REPORT_PATH" > "$$REPORT_DOT" \
|
||||
&& echo "** graphviz missing, target graph dot file: $$REPORT_DOT"; \
|
||||
fi && mv "$$REPORT_PATH" "$$BUILDDIR/targets.log"
|
||||
&& echo "** graphviz missing, " \
|
||||
"target graph dot file: $$REPORT_DOT"; \
|
||||
fi $(SHORTEN); \
|
||||
mv "$$REPORT_PATH" "$(BUILDDIR)/$@.log"
|
||||
|
Loading…
Reference in New Issue
Block a user