Commit f32b8d4f authored by Michael Shigorin's avatar Michael Shigorin

features.in: tagged scripts support

From now on a feature can contain this tree: . +- scripts.d/ +- image-scripts.d/ `- tagged/ +- scripts.d/ `- image-scripts.d/ ...per subprofile part or in its root -- the latter one gets merged into toplevel directory responsible for the final image build. NB: autoselected tags include only subprofile names (or both parts, for complex subprofiles) -- this is highly prone to change yet!
parent 4801579c
......@@ -9,45 +9,61 @@ include $(BUILDDIR)/distcfg.mk
# first rsync what's static, and make backups (*~) --
# these might signal of file clashes (or plain dirt);
# second, care for toplevel and tagged script dirs;
# then handle two more ways of implementing a feature
#
# NB: some subprofiles will be specified as "src/dst"
# (then both src/ and dst/ can hold the addons)
# -- then both src/ and dst/ can hold the addons;
# still both pieces go into a single destination
### {image-,}scripts.d/ get rsynced twice :-/
### still we don't want the trimmed-down case
all:
@echo "** starting feature configuration"
@if [ -n "$(GLOBAL_DEBUG)" ]; then \
echo "** target subprofiles: $(SUBPROFILES)"; \
echo "** requested features: $(FEATURES)"; \
fi
@for dir in $(FEATURES); do \
pushd "$$dir" && \
for sub in $(SUBPROFILES); do \
src="$${sub%/*}/"; \
dst="$${sub#*/}/"; \
if [ -d "$$src/" ]; then rsync -qab "$$src" "$(BUILDDIR)/$$dst/"; fi; \
if [ -d "$$dst/" ]; then rsync -qab "$$dst" "$(BUILDDIR)/$$dst/"; fi; \
@for feat in $(FEATURES); do \
pushd "$$feat" && \
for sub in / $(SUBPROFILES); do \
src="$${sub%/*}"; \
dst="$${sub#*/}"; \
if [ -d "$$src" ]; then rsync -qab "$$src/" "$(BUILDDIR)/$$dst/"; fi; \
if [ -d "$$dst" ]; then rsync -qab "$$dst/" "$(BUILDDIR)/$$dst/"; fi; \
for scr in {image-,}scripts.d; do \
scriptdir="$(BUILDDIR)/$$dst/$$scr/"; \
if [ -d "$$scriptdir" ]; then \
if [ -d "$$scr" ]; then \
rsync -qab "$$scr/" "$$scriptdir/"; \
fi; \
if [ -d "tagged/$$scr" ]; then \
pushd "tagged/$$scr" && \
echo "($$src || $$dst)" \
| tags2lists . \
| xargs -r cp -v -pLt "$$scriptdir" --; \
popd; \
fi; \
fi; \
done; \
type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$dst/" && \
git add . && \
git commit -qam "$$dir feature ($$sub subprofile part)" ||:; \
popd; \
done; \
for scripts in scripts.d image-scripts.d; do \
if [ -d "$(BUILDDIR)/$$scripts" -a -d "$$scripts" ]; then \
if rsync -qab "$$scripts/" "$(BUILDDIR)/$$scripts/"; then \
type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$scripts/" && \
git add . && \
git commit -qam "$$dir feature (toplevel $$scripts)" ||:; \
popd; \
fi; \
if [ -n "$$dst" ]; then \
the="$$sub subprofile"; \
else \
the="toplevel"; \
fi; \
git commit -qam "$$feat feature ($$the part)" ||:; \
popd; \
done; \
if [ -x "generate.sh" ]; then sh generate.sh; fi; \
if [ -s "generate.mk" ]; then $(MAKE) -f generate.mk; fi; \
type -t git >&/dev/null && \
pushd "$(BUILDDIR)/" && \
git add . && \
git commit -qam "$$dir feature generation complete" ||:; \
git commit -qam "$$feat feature generation complete" ||:; \
popd; \
popd; \
done
......
......@@ -13,8 +13,12 @@
после инициализации профиля (см. ../image.in/) и копирования
субпрофилей (см. ../sub.in/). Для каждой фичи, указанной
в $(FEATURES), копируются подкаталоги сообразно субпрофилям,
а также выполняется скрипт generate.sh и задействуется generate.mk
(при их наличии).
а также производится обработка {tagged/,}{image-},scripts.d/
(см. cleanup/ в качестве примера); затем выполняется скрипт
generate.sh и задействуется generate.mk (при их наличии).
NB: тегированные скрипты являются экспериментальными,
возможны недоработки и существенные изменения!
Если фича дополняет хуками семейство целевых субпрофилей,
построенных на одном базовом, можно воспользоваться подкаталогом
......
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