From f8ae619bbb3fb057003afef8a2bd0098bca76cd3 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Thu, 6 Jun 2019 11:42:34 +0300 Subject: [PATCH] cleanlog, reports.mk: factor the script out Sometimes REPORT=1 just wasn't passed to make, and the build.log saved is noisy and harder to compare through diff(1); let's move the implementation out of the makefile and into a standalone script so it can be reused like this: BUILDDIR=$(sed -rn "s/^mki-image-scripts: export GLOBAL_BUILDDIR='(.*)'$/\1/p" build/build.log bin/cleanlog < build/build.log > build/reports/clean.log See "export GLOBAL_BUILDDIR=" line in the particular log (grabbing that one from stdin is not exactly trivial though). --- bin/cleanlog | 24 ++++++++++++++++++++++++ reports.mk | 21 +-------------------- 2 files changed, 25 insertions(+), 20 deletions(-) create mode 100755 bin/cleanlog diff --git a/bin/cleanlog b/bin/cleanlog new file mode 100755 index 00000000..ade013ac --- /dev/null +++ b/bin/cleanlog @@ -0,0 +1,24 @@ +#!/bin/sh +# try making build logs more diffable +# see also reports.mk + +[ -n "$BUILDDIR" ] || exit 1 + +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" diff --git a/reports.mk b/reports.mk index 99461eac..c358f12a 100644 --- a/reports.mk +++ b/reports.mk @@ -28,26 +28,7 @@ reports/prep: # 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" \ + BUILDDIR="$(BUILDDIR)" cleanlog < $(BUILDLOG) > "$$OUT" \ && echo "** diffable log: $$OUT" $(SHORTEN) reports/scripts: reports/prep