summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/pkg-generic.mk6
-rw-r--r--package/pkg-utils.mk5
2 files changed, 9 insertions, 2 deletions
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index d1a18117d0..455bdf17da 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -322,17 +322,19 @@ $(2)_RAWNAME = $$(patsubst host-%,%,$(1))
# sanitize the package version that is used in paths, directory and file names.
# Forward slashes may appear in the package's version when pointing to a
# version control system branch or tag, for example remotes/origin/1_10_stable.
+# Similar for spaces and colons (:) that may appear in date-based revisions for
+# CVS.
ifndef $(2)_VERSION
ifdef $(3)_VERSION
$(2)_DL_VERSION := $$(strip $$($(3)_VERSION))
- $(2)_VERSION := $$(subst /,_,$$(strip $$($(3)_VERSION)))
+ $(2)_VERSION := $$(call sanitize,$$($(3)_VERSION))
else
$(2)_VERSION = undefined
$(2)_DL_VERSION = undefined
endif
else
$(2)_DL_VERSION := $$(strip $$($(2)_VERSION))
- $(2)_VERSION := $$(strip $$(subst /,_,$$($(2)_VERSION)))
+ $(2)_VERSION := $$(call sanitize,$$($(2)_VERSION))
endif
$(2)_BASE_NAME = $(1)-$$($(2)_VERSION)
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 5a385f882f..99a3c1e525 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -37,6 +37,11 @@ endef
$(eval $(call caseconvert-helper,UPPERCASE,$(join $(addsuffix :,$([FROM])),$([TO]))))
$(eval $(call caseconvert-helper,LOWERCASE,$(join $(addsuffix :,$([TO])),$([FROM]))))
+# Sanitize macro cleans up generic strings so it can be used as a filename
+# and in rules. Particularly useful for VCS version strings, that can contain
+# slashes, colons (OK in filenames but not in rules), and spaces.
+sanitize = $(subst $(space),_,$(subst :,_,$(subst /,_,$(strip $(1)))))
+
#
# Manipulation of .config files based on the Kconfig
# infrastructure. Used by the BusyBox package, the Linux kernel
OpenPOWER on IntegriCloud