mkimage-profiles/iso.mk
Michael Shigorin b474bff468 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.
2011-11-04 16:15:31 +02:00

36 lines
1.1 KiB
Makefile

# this makefile is designed to be included in toplevel one
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
export ARCH ?= $(shell arch | sed 's/i686/i586/')
# step 4 is kicked off here but actually done by image.in/Makefile
#
# adding boot/isolinux to prereqs is too late here,
# since profile/populate target is already done by now
#
# NB: /usr/bin/{i586,x86_64} are setarch(8) symlinks
iso:
@echo -n "** starting image build"
@if [ -n "$(DEBUG)" ]; then \
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
else \
echo " (coffee time)"; \
fi
@if time -f "%E %PCPU %Mk" $(ARCH) \
$(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR) $(LOG); \
then \
echo "** build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \
|| echo "no log"`)"; \
else \
echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \
if [ -z "$(DEBUG)" ]; then \
echo " (you might want to re-run with DEBUG=1)"; \
fi; \
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