iso.mk: low space hint on build failure

Just in case the build.log will be inobvious, and it's easy to diagnose
automatically.  Thanks Andrey Stroganov for this use case.

Thanks for improving the initial implementation go to raorn@ for kind
commit lynch and to Yuri Bushmelev for actually suggesting something
more concise.

BTW the "1024" magic number was taken out of thin air:
the "no free space" errors are most likely to happen while
forming/populating a chroot (apt/rpm errors out) and chroots are
roughly two orders of magnitude heftier than a megabyte.
This commit is contained in:
Michael Shigorin 2011-09-14 19:37:29 +03:00
parent 368cfd26bd
commit b474bff468
2 changed files with 5 additions and 3 deletions

View File

@ -26,4 +26,4 @@ choose_tmpdir() {
} }
DIR="`choose_tmpdir`" DIR="`choose_tmpdir`"
mktemp -d "${1:-tmpdir}.XXXXXXXXXX" --tmpdir="${DIR:-..}" mktemp -d "${1:-tmpdir}.XXXXXXXXXX" --tmpdir="${DIR:-`realpath ..`}"

6
iso.mk
View File

@ -14,7 +14,7 @@ export ARCH ?= $(shell arch | sed 's/i686/i586/')
iso: iso:
@echo -n "** starting image build" @echo -n "** starting image build"
@if test -n "$(DEBUG)"; then \ @if [ -n "$(DEBUG)" ]; then \
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \ echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
else \ else \
echo " (coffee time)"; \ echo " (coffee time)"; \
@ -26,8 +26,10 @@ iso:
|| echo "no log"`)"; \ || echo "no log"`)"; \
else \ else \
echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \ echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \
if test -z "$(DEBUG)"; then \ if [ -z "$(DEBUG)" ]; then \
echo " (you might want to re-run with DEBUG=1)"; \ echo " (you might want to re-run with DEBUG=1)"; \
fi; \ fi; \
tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \ tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \
df -P $(BUILDDIR) | awk 'END { if ($$4 < 1024) \
{ print "** NB: low space on "$$6" ("$$5" used)"}}'; \
fi fi