diff --git a/features.in/Makefile b/features.in/Makefile index 80485d4a..7dca9d4c 100644 --- a/features.in/Makefile +++ b/features.in/Makefile @@ -5,25 +5,29 @@ ifndef BUILDDIR $(error BUILDDIR not defined) 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); # 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: @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 sub in $(SUBPROFILES); do \ dst="$${sub#*/}" && \ if test -d "$$dir/$$dst/"; then \ - if rsync -ab "$$dir/$$dst/" "$(BUILDDIR)/$$dst/"; \ + if rsync -qab "$$dir/$$dst/" \ + "$(BUILDDIR)/$$dst/"; \ then \ type -t git >&/dev/null && \ pushd "$(BUILDDIR)/$$dst/" && \ git add . && \ - git commit -qam "$@/$$dir/$$dst" ||:; \ + git commit -qam "$$dir feature ($$dst subprofile part)" ||:; \ popd; \ fi; \ fi; \ @@ -36,8 +40,16 @@ all: if test -s "$$dir/generate.mk"; then \ $(MAKE) -C "$$dir" -f generate.mk; \ fi; \ + type -t git >&/dev/null && \ + pushd "$(BUILDDIR)/" && \ + git add . && \ + git commit -qam "$$dir feature generation complete" ||:; \ + popd; \ done + @find "$(BUILDDIR)/" -name '*~' \ + | sed "s,$(BUILDDIR)/,** warning: file clash: ," >&2 -help: - @echo "** available features:" - @grep -h '^use/' */config.mk +# FIXME: drop or fix regarding undefined BUILDDIR being ok +#help: +# @echo "** available features:" +# @grep -h '^use/' */config.mk | fmt -sw"$$((COLUMNS>>1))" | column -t diff --git a/image.in/.gitignore b/image.in/.gitignore new file mode 100644 index 00000000..751b1d07 --- /dev/null +++ b/image.in/.gitignore @@ -0,0 +1 @@ +build.log diff --git a/image.in/scripts.d/00-cleanup b/image.in/scripts.d/00-cleanup index 431a6c92..a71b290b 100755 --- a/image.in/scripts.d/00-cleanup +++ b/image.in/scripts.d/00-cleanup @@ -1,4 +1,4 @@ #!/bin/sh # TODO: invent some way to remove this inter-subprofile thing -rm -vf $WORKDIR/{squashcfg.mk,initfs} +rm -vf $WORKDIR/{squashcfg.mk,initfs,.gitignore} diff --git a/image.in/scripts.d/01-genbasedir b/image.in/scripts.d/01-genbasedir index 59ec56c4..eeb7ff9e 100755 --- a/image.in/scripts.d/01-genbasedir +++ b/image.in/scripts.d/01-genbasedir @@ -1,4 +1,5 @@ #!/bin/sh +# FIXME: bring to common style verbose() { diff --git a/pkg.in/Makefile b/pkg.in/Makefile index d462ac9b..c4d25f3f 100644 --- a/pkg.in/Makefile +++ b/pkg.in/Makefile @@ -5,6 +5,7 @@ ifndef BUILDDIR $(error BUILDDIR not defined) endif +# sequential execution, no reason to haste all: @for dir in lists groups; do \ $(MAKE) -C $$dir; \ diff --git a/pkg.in/groups/Makefile b/pkg.in/groups/Makefile index 1faae094..dfada64f 100644 --- a/pkg.in/groups/Makefile +++ b/pkg.in/groups/Makefile @@ -16,7 +16,7 @@ all: $(GLOBAL_DEBUG) type -t git >&/dev/null && \ cd $(TARGET) && \ git add . && \ - git commit -qam "$(SUFFIX)"; \ + git commit -qam "requested $(SUFFIX) copied over"; \ cd - >&/dev/null; \ fi diff --git a/pkg.in/lists/Makefile b/pkg.in/lists/Makefile index 18c7f4e0..bdb7c01e 100644 --- a/pkg.in/lists/Makefile +++ b/pkg.in/lists/Makefile @@ -18,30 +18,36 @@ all: $(TARGET) $(GLOBAL_DEBUG) -- $(value $V)))) # construct .base packagelist for alterator-pkg @( \ - echo "### generated via pkg.in/lists/Makefile" && \ - echo "### BASE_LISTS" && \ - cat $(BASE_LISTS) /dev/null && \ - echo "### branding" && \ - echo "branding-$(BRANDING)-release" && \ - echo "### COMMON_PACKAGES" && \ - echo "$(COMMON_PACKAGES)" && \ - echo "### BASE_PACKAGES" && \ - echo "$(BASE_PACKAGES)" \ + echo "## generated via pkg.in/lists/Makefile"; \ + [ -n "$(BRANDING)" ] && { \ + echo "branding-$(BRANDING)-release"; \ + }; \ + [ -n "$(BASE_LISTS)" ] && { \ + echo "### BASE_LISTS"; \ + cat $(BASE_LISTS); \ + }; \ + [ -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 - @[ -z $(GROUPS) ] || cp -at $(TARGET) $(GROUPS) + @[ -z "$(GROUPS)" ] || cp -at $(TARGET) $(GROUPS) @type -t git >&/dev/null && \ cd $(TARGET) && \ git add . && \ - git commit -qam "$(SUFFIX)"; + git commit -qam "requested $(SUFFIX) copied over" ||: # do beforehand as foreach gets expanded before recipe execution $(TARGET): @mkdir -p $(TARGET) +# figure out *_LISTS variables and print them out nicely debug: - @$(foreach V, \ + @echo -e $(foreach V, \ $(filter %_LISTS,$(sort $(.VARIABLES))), \ $(if $(filter environment% file,$(origin $V)),\ - $(warning $V=$(value $V)))) - @echo "** LISTS: -- see above" - @echo "** GROUPS: $(GROUPS)" + $(shell echo '\\n"**"' $V: $(value $V)))) '\n' diff --git a/profile.mk b/profile.mk index 83ef4c4a..4993b5b0 100644 --- a/profile.mk +++ b/profile.mk @@ -9,16 +9,16 @@ BUILDDIR := $(shell [ -s build ] \ || bin/mktmpdir mkimage-profiles.build) 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 NO_CACHE ?= 1 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) profile/init: distclean @echo -n "** initializing BUILDDIR: " @@ -34,7 +34,7 @@ profile/init: distclean cd $(BUILDDIR) && \ git init -q && \ git add . && \ - git commit -qam 'init' + git commit -qam 'distribution profile initialized' @rm -f build && \ if [ -w . ]; then \ ln -sf "$(BUILDDIR)" build && \ diff --git a/sub.in/Makefile b/sub.in/Makefile index 562677a3..286133a8 100644 --- a/sub.in/Makefile +++ b/sub.in/Makefile @@ -12,19 +12,20 @@ all: @for sub in $(SUBPROFILES); do \ src="$${sub%/*}" && \ dst="$${sub#*/}" && \ + neq="$${src#$$dst}" && \ rsync -a "$$src/" "$(BUILDDIR)/$$dst/" && \ type -t git >&/dev/null && \ cd "$(BUILDDIR)/$$dst/" && \ git add . && \ - git commit -qam "$$sub"; \ + git commit -qam "$$dst subprofile initialized$${neq:+ (using $$src)}"; \ cd - >&/dev/null; \ done clean: @for sub in $(SUBPROFILES); do \ dst="${sub#*/}" && \ - if [ -n "$$dst" ]; then \ - rm -rf "$(BUILDDIR)/$$dst" && \ + if [ -n "$$dst" -a -n "$(BUILDDIR)" ]; then \ + rm -r "$(BUILDDIR)/$$dst" && \ mkdir -p "$(BUILDDIR)/$$dst"; \ fi; \ done