Commit 3a5b47e7 authored by Michael Shigorin's avatar Michael Shigorin

improved logging during profile creation

- better *_LISTS printout - somewhat cleaner .base comments - more comprehensible git log messages + special handling for complex subprofiles + no need to commit build.log ;-)
parent 2b90dffa
...@@ -5,25 +5,29 @@ ifndef BUILDDIR ...@@ -5,25 +5,29 @@ ifndef BUILDDIR
$(error BUILDDIR not defined) $(error BUILDDIR not defined)
endif endif
-include $(BUILDDIR)/distcfg.mk include $(BUILDDIR)/distcfg.mk
# first rsync what's static, and make backups -- # first rsync what's static, and make backups (*~) --
# these might signal of file clashes (or plain dirt); # these might signal of file clashes (or plain dirt);
# then handle two more ways of implementing a feature # then handle two more ways of implementing a feature
# NB: subprofile can be specified as src/dest # NB: some subprofiles will be specified as src/dest
all: all:
@echo "** starting feature configuration" @echo "** starting feature configuration"
@if test -n "$(GLOBAL_DEBUG)"; then echo "** requested: $(FEATURES)"; fi @if test -n "$(GLOBAL_DEBUG)"; then \
echo "** target subprofiles: $(notdir $(SUBPROFILES))"; \
echo "** requested features: $(FEATURES)"; \
fi
@for dir in $(FEATURES); do \ @for dir in $(FEATURES); do \
for sub in $(SUBPROFILES); do \ for sub in $(SUBPROFILES); do \
dst="$${sub#*/}" && \ dst="$${sub#*/}" && \
if test -d "$$dir/$$dst/"; then \ if test -d "$$dir/$$dst/"; then \
if rsync -ab "$$dir/$$dst/" "$(BUILDDIR)/$$dst/"; \ if rsync -qab "$$dir/$$dst/" \
"$(BUILDDIR)/$$dst/"; \
then \ then \
type -t git >&/dev/null && \ type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$dst/" && \ pushd "$(BUILDDIR)/$$dst/" && \
git add . && \ git add . && \
git commit -qam "$@/$$dir/$$dst" ||:; \ git commit -qam "$$dir feature ($$dst subprofile part)" ||:; \
popd; \ popd; \
fi; \ fi; \
fi; \ fi; \
...@@ -36,8 +40,16 @@ all: ...@@ -36,8 +40,16 @@ all:
if test -s "$$dir/generate.mk"; then \ if test -s "$$dir/generate.mk"; then \
$(MAKE) -C "$$dir" -f generate.mk; \ $(MAKE) -C "$$dir" -f generate.mk; \
fi; \ fi; \
type -t git >&/dev/null && \
pushd "$(BUILDDIR)/" && \
git add . && \
git commit -qam "$$dir feature generation complete" ||:; \
popd; \
done done
@find "$(BUILDDIR)/" -name '*~' \
| sed "s,$(BUILDDIR)/,** warning: file clash: ," >&2
help: # FIXME: drop or fix regarding undefined BUILDDIR being ok
@echo "** available features:" #help:
@grep -h '^use/' */config.mk # @echo "** available features:"
# @grep -h '^use/' */config.mk | fmt -sw"$$((COLUMNS>>1))" | column -t
#!/bin/sh #!/bin/sh
# TODO: invent some way to remove this inter-subprofile thing # TODO: invent some way to remove this inter-subprofile thing
rm -vf $WORKDIR/{squashcfg.mk,initfs} rm -vf $WORKDIR/{squashcfg.mk,initfs,.gitignore}
#!/bin/sh #!/bin/sh
# FIXME: bring to common style
verbose() verbose()
{ {
......
...@@ -5,6 +5,7 @@ ifndef BUILDDIR ...@@ -5,6 +5,7 @@ ifndef BUILDDIR
$(error BUILDDIR not defined) $(error BUILDDIR not defined)
endif endif
# sequential execution, no reason to haste
all: all:
@for dir in lists groups; do \ @for dir in lists groups; do \
$(MAKE) -C $$dir; \ $(MAKE) -C $$dir; \
......
...@@ -16,7 +16,7 @@ all: $(GLOBAL_DEBUG) ...@@ -16,7 +16,7 @@ all: $(GLOBAL_DEBUG)
type -t git >&/dev/null && \ type -t git >&/dev/null && \
cd $(TARGET) && \ cd $(TARGET) && \
git add . && \ git add . && \
git commit -qam "$(SUFFIX)"; \ git commit -qam "requested $(SUFFIX) copied over"; \
cd - >&/dev/null; \ cd - >&/dev/null; \
fi fi
......
...@@ -18,30 +18,36 @@ all: $(TARGET) $(GLOBAL_DEBUG) ...@@ -18,30 +18,36 @@ all: $(TARGET) $(GLOBAL_DEBUG)
-- $(value $V)))) -- $(value $V))))
# construct .base packagelist for alterator-pkg # construct .base packagelist for alterator-pkg
@( \ @( \
echo "### generated via pkg.in/lists/Makefile" && \ echo "## generated via pkg.in/lists/Makefile"; \
echo "### BASE_LISTS" && \ [ -n "$(BRANDING)" ] && { \
cat $(BASE_LISTS) /dev/null && \ echo "branding-$(BRANDING)-release"; \
echo "### branding" && \ }; \
echo "branding-$(BRANDING)-release" && \ [ -n "$(BASE_LISTS)" ] && { \
echo "### COMMON_PACKAGES" && \ echo "### BASE_LISTS"; \
echo "$(COMMON_PACKAGES)" && \ cat $(BASE_LISTS); \
echo "### BASE_PACKAGES" && \ }; \
echo "$(BASE_PACKAGES)" \ [ -n "$(COMMON_PACKAGES)" ] && { \
echo "## COMMON_PACKAGES"; \
echo "$(COMMON_PACKAGES)"; \
}; \
[ -n "$(BASE_PACKAGES)" ] && { \
echo "## BASE_PACKAGES"; \
echo "$(BASE_PACKAGES)"; \
}; \
) | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' >$(TARGET)/.base ) | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' >$(TARGET)/.base
@[ -z $(GROUPS) ] || cp -at $(TARGET) $(GROUPS) @[ -z "$(GROUPS)" ] || cp -at $(TARGET) $(GROUPS)
@type -t git >&/dev/null && \ @type -t git >&/dev/null && \
cd $(TARGET) && \ cd $(TARGET) && \
git add . && \ git add . && \
git commit -qam "$(SUFFIX)"; git commit -qam "requested $(SUFFIX) copied over" ||:
# do beforehand as foreach gets expanded before recipe execution # do beforehand as foreach gets expanded before recipe execution
$(TARGET): $(TARGET):
@mkdir -p $(TARGET) @mkdir -p $(TARGET)
# figure out *_LISTS variables and print them out nicely
debug: debug:
@$(foreach V, \ @echo -e $(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \ $(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),\ $(if $(filter environment% file,$(origin $V)),\
$(warning $V=$(value $V)))) $(shell echo '\\n"**"' $V: $(value $V)))) '\n'
@echo "** LISTS: -- see above"
@echo "** GROUPS: $(GROUPS)"
...@@ -9,16 +9,16 @@ BUILDDIR := $(shell [ -s build ] \ ...@@ -9,16 +9,16 @@ BUILDDIR := $(shell [ -s build ] \
|| bin/mktmpdir mkimage-profiles.build) || bin/mktmpdir mkimage-profiles.build)
endif endif
# holds a postprocessor; shell test executes in particular situation
# NB: not exported, for toplevel use only
SHORTEN = $(shell [ "$(DEBUG)" != 2 -a -s build ] \
&& echo "| sed 's,$(BUILDDIR),build,'")
# even smart caching only hurts when every build goes from scratch # even smart caching only hurts when every build goes from scratch
NO_CACHE ?= 1 NO_CACHE ?= 1
export BUILDDIR NO_CACHE export BUILDDIR NO_CACHE
# holds a postprocessor; shell test executes in particular situation
# NB: not exported, for toplevel use only
SHORTEN = $(shell [ "$(DEBUG)" != 2 -a -s build ] \
&& echo "| sed 's,$(BUILDDIR),build,'")
# step 1: initialize the off-tree mkimage profile (BUILDDIR) # step 1: initialize the off-tree mkimage profile (BUILDDIR)
profile/init: distclean profile/init: distclean
@echo -n "** initializing BUILDDIR: " @echo -n "** initializing BUILDDIR: "
...@@ -34,7 +34,7 @@ profile/init: distclean ...@@ -34,7 +34,7 @@ profile/init: distclean
cd $(BUILDDIR) && \ cd $(BUILDDIR) && \
git init -q && \ git init -q && \
git add . && \ git add . && \
git commit -qam 'init' git commit -qam 'distribution profile initialized'
@rm -f build && \ @rm -f build && \
if [ -w . ]; then \ if [ -w . ]; then \
ln -sf "$(BUILDDIR)" build && \ ln -sf "$(BUILDDIR)" build && \
......
...@@ -12,19 +12,20 @@ all: ...@@ -12,19 +12,20 @@ all:
@for sub in $(SUBPROFILES); do \ @for sub in $(SUBPROFILES); do \
src="$${sub%/*}" && \ src="$${sub%/*}" && \
dst="$${sub#*/}" && \ dst="$${sub#*/}" && \
neq="$${src#$$dst}" && \
rsync -a "$$src/" "$(BUILDDIR)/$$dst/" && \ rsync -a "$$src/" "$(BUILDDIR)/$$dst/" && \
type -t git >&/dev/null && \ type -t git >&/dev/null && \
cd "$(BUILDDIR)/$$dst/" && \ cd "$(BUILDDIR)/$$dst/" && \
git add . && \ git add . && \
git commit -qam "$$sub"; \ git commit -qam "$$dst subprofile initialized$${neq:+ (using $$src)}"; \
cd - >&/dev/null; \ cd - >&/dev/null; \
done done
clean: clean:
@for sub in $(SUBPROFILES); do \ @for sub in $(SUBPROFILES); do \
dst="${sub#*/}" && \ dst="${sub#*/}" && \
if [ -n "$$dst" ]; then \ if [ -n "$$dst" -a -n "$(BUILDDIR)" ]; then \
rm -rf "$(BUILDDIR)/$$dst" && \ rm -r "$(BUILDDIR)/$$dst" && \
mkdir -p "$(BUILDDIR)/$$dst"; \ mkdir -p "$(BUILDDIR)/$$dst"; \
fi; \ fi; \
done done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment