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 ...@@ -9,45 +9,61 @@ 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);
# second, care for toplevel and tagged script dirs;
# then handle two more ways of implementing a feature # then handle two more ways of implementing a feature
#
# NB: some subprofiles will be specified as "src/dst" # 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: all:
@echo "** starting feature configuration" @echo "** starting feature configuration"
@if [ -n "$(GLOBAL_DEBUG)" ]; then \ @if [ -n "$(GLOBAL_DEBUG)" ]; then \
echo "** target subprofiles: $(SUBPROFILES)"; \ echo "** target subprofiles: $(SUBPROFILES)"; \
echo "** requested features: $(FEATURES)"; \ echo "** requested features: $(FEATURES)"; \
fi fi
@for dir in $(FEATURES); do \ @for feat in $(FEATURES); do \
pushd "$$dir" && \ pushd "$$feat" && \
for sub in $(SUBPROFILES); do \ for sub in / $(SUBPROFILES); do \
src="$${sub%/*}/"; \ src="$${sub%/*}"; \
dst="$${sub#*/}/"; \ dst="$${sub#*/}"; \
if [ -d "$$src/" ]; then rsync -qab "$$src" "$(BUILDDIR)/$$dst/"; fi; \ if [ -d "$$src" ]; then rsync -qab "$$src/" "$(BUILDDIR)/$$dst/"; fi; \
if [ -d "$$dst/" ]; then rsync -qab "$$dst" "$(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 && \ type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$dst/" && \ pushd "$(BUILDDIR)/$$dst/" && \
git add . && \ git add . && \
git commit -qam "$$dir feature ($$sub subprofile part)" ||:; \ if [ -n "$$dst" ]; then \
popd; \ the="$$sub subprofile"; \
done; \ else \
for scripts in scripts.d image-scripts.d; do \ the="toplevel"; \
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; \
fi; \ fi; \
git commit -qam "$$feat feature ($$the part)" ||:; \
popd; \
done; \ done; \
if [ -x "generate.sh" ]; then sh generate.sh; fi; \ if [ -x "generate.sh" ]; then sh generate.sh; fi; \
if [ -s "generate.mk" ]; then $(MAKE) -f generate.mk; fi; \ if [ -s "generate.mk" ]; then $(MAKE) -f generate.mk; fi; \
type -t git >&/dev/null && \ type -t git >&/dev/null && \
pushd "$(BUILDDIR)/" && \ pushd "$(BUILDDIR)/" && \
git add . && \ git add . && \
git commit -qam "$$dir feature generation complete" ||:; \ git commit -qam "$$feat feature generation complete" ||:; \
popd; \ popd; \
popd; \ popd; \
done done
......
...@@ -13,8 +13,12 @@ ...@@ -13,8 +13,12 @@
после инициализации профиля (см. ../image.in/) и копирования после инициализации профиля (см. ../image.in/) и копирования
субпрофилей (см. ../sub.in/). Для каждой фичи, указанной субпрофилей (см. ../sub.in/). Для каждой фичи, указанной
в $(FEATURES), копируются подкаталоги сообразно субпрофилям, в $(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