Commit e46c259a authored by Michael Shigorin's avatar Michael Shigorin

ensure that IMAGEDIR exists (thus globbable)

It appears that manually specified IMAGEDIR, e.g. by adding IMAGEDIR = ~/out/$(shell date +%Y%m%d) to ~/.mkimage/profiles.mk, might be problematic due to missing globbing. Let's make sure the paths are globbed and directories are created -- since make's wildcard() returns an empty string when there's nothing there [yet].
parent 692f8ec0
......@@ -29,8 +29,11 @@ $(info warning: mkimage-$(MKI_VERSION) is suboptimal, consider upgrading)
$(warning consider upgrading mkimage to $(MKI_VER_OPTIMAL) or better)
endif
# glob it just in case
IMAGEDIR := $(wildcard $(IMAGEDIR))
# additional means to reduce havoc in IMAGEDIR
IMAGE_SORTDIR := $(SORTDIR)
IMAGE_SORTDIR := $(wildcard $(SORTDIR))
# reconstruct instead of passing yet another variable
IMAGE_OUTDIR := $(IMAGEDIR)$(IMAGE_SORTDIR:%=/%)
......
......@@ -42,7 +42,7 @@ IMAGEDIR ?= $(shell \
fi; \
)
LOGDIR ?= $(IMAGEDIR)
LOGDIR ?= $(wildcard $(IMAGEDIR))
# actual build starter
# NB: our output MUST go into stderr to escape POSTPROC
......
......@@ -82,8 +82,8 @@ profile/bare: profile/init
} >&2
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
@$(call try,GLOBAL_VERBOSE,)
@$(call try,IMAGEDIR,$(IMAGEDIR))
@$(call try,LOGDIR,$(LOGDIR))
@$(call try,IMAGEDIR,$(wildcard $(IMAGEDIR)))
@$(call try,LOGDIR,$(wildcard $(LOGDIR)))
@$(call try,BRANDING,altlinux-sisyphus)
ifeq (,$(REPO:altlinux%=))
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
......
......@@ -34,6 +34,12 @@ include $(sort $(wildcard lib/*.mk))
include conf.d/*.mk
include features.in/*/config.mk
# ensure the outdir is created and globbable
ifdef IMAGEDIR
$(shell mkdir -p $(IMAGEDIR))
IMAGEDIR := $(wildcard $(IMAGEDIR))
endif
# FIXME: this is buggy since *.mk can expose parts conditionally
# (e.g. test.mk does DEBUG-only bits) and these will fail
DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \
......
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