image: Add DISTRO_VERSION variable support

Use it in the image filename, so we'll know what version of a distro
it is.
This commit is contained in:
Mikhail Efremov 2017-03-27 18:32:09 +03:00 committed by Michael Shigorin
parent 20dfef8045
commit 2af6d0be75
2 changed files with 16 additions and 2 deletions

View File

@ -60,6 +60,11 @@
** значение: пусто (по умолчанию), 1 или 2
** см. lib/log.mk, lib/clean.mk
* DISTRO_VERSION
** задаёт версию дистрибутива, если применимо
** значение: пусто (по умолчанию) либо любая строка
** см. image.in/Makefile
* HOMEPAGE, HOMENAME, HOMEWAIT
** указывают адрес, название и таймаут перехода для домашней страницы
** значение: корректный URL, строка, целое неотрицательное число

View File

@ -35,9 +35,15 @@ IMAGEDIR := $(wildcard $(IMAGEDIR))
# additional means to reduce havoc in IMAGEDIR
IMAGE_SORTDIR := $(wildcard $(SORTDIR))
# reconstruct instead of passing yet another variable
# use distro version in image name if defined
ifdef DISTRO_VERSION
IMAGE_VERSION := -$(DISTRO_VERSION)
IMAGE_VER_LINK := $(IMAGE_NAME)$(IMAGE_VERSION)-latest-$(ARCH).$(IMAGE_TYPE)
endif
IMAGE_OUTFILE := \
$(IMAGE_NAME)$(IMAGE_VERSION)-$(STATUS)$(DATE)-$(ARCH).$(IMAGE_TYPE)
IMAGE_OUTDIR := $(IMAGEDIR)$(IMAGE_SORTDIR:%=/%)
IMAGE_OUTFILE := $(IMAGE_NAME)-$(STATUS)$(DATE)-$(ARCH).$(IMAGE_TYPE)
IMAGE_OUTPATH := $(IMAGE_OUTDIR)/$(IMAGE_OUTFILE)
IMAGE_RELPATH := $(IMAGE_SORTDIR:%=%/)$(IMAGE_OUTFILE)
IMAGE_RELDIR := $(IMAGE_OUTDIR:$(GLOBAL_BUILDDIR)/%=%)
@ -94,6 +100,9 @@ postprocess: | $(addprefix postprocess-,$(sort $(POSTPROCESS_TARGETS)))
ln -sf "$(IMAGE_RELPATH)" "$(IMAGE_LINKPATH)" && \
ln -sf "$(IMAGE_RELDIR)" "$(OUT_LINK)" && \
ln -sf "$(IMAGE_LINK)" "$(IMAGEDIR)/$(CURRENT_LINK).$(IMAGE_TYPE)"; \
if [ -n "$(IMAGE_VER_LINK)" ]; then \
ln -sf "$(IMAGE_RELPATH)" "$(IMAGEDIR)/$(IMAGE_VER_LINK)"; \
fi; \
if [ -n "$(GLOBAL_DEBUG)" ]; then \
mkdir -p "$(LOGDIR)"; \
cp -a build.log "$(LOGDIR)/$(IMAGE_OUTFILE).log"; \