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].
This commit is contained in:
Michael Shigorin 2013-02-04 19:18:06 +04:00
parent 692f8ec010
commit e46c259a90
4 changed files with 13 additions and 4 deletions

View File

@ -29,8 +29,11 @@ $(info warning: mkimage-$(MKI_VERSION) is suboptimal, consider upgrading)
$(warning consider upgrading mkimage to $(MKI_VER_OPTIMAL) or better) $(warning consider upgrading mkimage to $(MKI_VER_OPTIMAL) or better)
endif endif
# glob it just in case
IMAGEDIR := $(wildcard $(IMAGEDIR))
# additional means to reduce havoc in IMAGEDIR # additional means to reduce havoc in IMAGEDIR
IMAGE_SORTDIR := $(SORTDIR) IMAGE_SORTDIR := $(wildcard $(SORTDIR))
# reconstruct instead of passing yet another variable # reconstruct instead of passing yet another variable
IMAGE_OUTDIR := $(IMAGEDIR)$(IMAGE_SORTDIR:%=/%) IMAGE_OUTDIR := $(IMAGEDIR)$(IMAGE_SORTDIR:%=/%)

View File

@ -42,7 +42,7 @@ IMAGEDIR ?= $(shell \
fi; \ fi; \
) )
LOGDIR ?= $(IMAGEDIR) LOGDIR ?= $(wildcard $(IMAGEDIR))
# actual build starter # actual build starter
# NB: our output MUST go into stderr to escape POSTPROC # NB: our output MUST go into stderr to escape POSTPROC

View File

@ -82,8 +82,8 @@ profile/bare: profile/init
} >&2 } >&2
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage) @$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
@$(call try,GLOBAL_VERBOSE,) @$(call try,GLOBAL_VERBOSE,)
@$(call try,IMAGEDIR,$(IMAGEDIR)) @$(call try,IMAGEDIR,$(wildcard $(IMAGEDIR)))
@$(call try,LOGDIR,$(LOGDIR)) @$(call try,LOGDIR,$(wildcard $(LOGDIR)))
@$(call try,BRANDING,altlinux-sisyphus) @$(call try,BRANDING,altlinux-sisyphus)
ifeq (,$(REPO:altlinux%=)) ifeq (,$(REPO:altlinux%=))
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release) @$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)

View File

@ -34,6 +34,12 @@ include $(sort $(wildcard lib/*.mk))
include conf.d/*.mk include conf.d/*.mk
include features.in/*/config.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 # FIXME: this is buggy since *.mk can expose parts conditionally
# (e.g. test.mk does DEBUG-only bits) and these will fail # (e.g. test.mk does DEBUG-only bits) and these will fail
DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \ DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \