pkg-generic: substitute colon and space out of PKG_VERSION
PATCH 1/1 pkg-generic: substitute colon and space out of PKG_VERSION
Using a colon or a space in a make target doesn't work, so they have to be filtered out of the PKG_VERSION variable just like the / currently already is.
This will be needed for date-based CVS versions.
--- package/pkg-generic.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
package/pkg-generic.mk +4 -2
@@ -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 := $$(subst $(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(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 := $$(subst $$(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(2)_VERSION))))) endif $(2)_BASE_NAME = $(1)-$$($(2)_VERSION)
Signature · 1 line
2.1.4
PATCH 1/1 pkg-generic: substitute colon and space out of PKG_VERSION
Dear Arnout Vandecappelle (Essensium/Mind),
Quoted 4 lines · Arnout Vandecappelle (Essensium/Mind)
ifndef $(2)_VERSION
ifdef $(3)_VERSION
$(2)_DL_VERSION := $$(strip $$($(3)_VERSION))package/pkg-generic.mk +0
-1- $(2)_VERSION := $$(subst /,_,$$(strip $$($(3)_VERSION)))
package/pkg-generic.mk $(2)_RAWNAME = $$(patsubst host-%,%,$(1)) · line 338
Quoted 10 lines
package/pkg-generic.mk +2
-1+ $(2)_VERSION := $$(subst $(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(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 := $$(subst $$(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(2)_VERSION))))) endif
Since this code is now a bit more complicated, maybe we should have a function in pkg-utils.mk for this?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 pkg-generic: substitute colon and space out of PKG_VERSION
In reply to Arnout Vandecappelle (Essensium/Mind)Gustavo, All,
On 2015-04-22 23:24 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
Quoted 26 lines
Using a colon or a space in a make target doesn't work, so they have to be filtered out of the
PKG_VERSIONvariable just like the / currently already is.This will be needed for date-based CVS versions.
Cc Fabio Porcedda <[email protected]>Cc Yann E. MORIN <[email protected]>--- package/pkg-generic.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)package/pkg-generic.mk +2
-0@@ -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))
package/pkg-generic.mk $(2)_RAWNAME = $$(patsubst host-%,%,$(1)) · line 337
Quoted 10 lines
package/pkg-generic.mk +2
-2- $(2)_VERSION := $$(subst /,_,$$(strip $$($(3)_VERSION))) + $(2)_VERSION := $$(subst $(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(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 := $$(subst $$(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(2)_VERSION)))))
Here, you'r ealso changing (for the better!) the order we call strip/subst. Note that the way you did is better *and* is aligned with the host variant, above. Previously, there was discrepancy betwee nthe hos and target variants.
That change may warrant at least a sentence in the commit log.
Regards,
Yann E. MORIN.
Quoted 6 lines
package/pkg-generic.mk +0
-0endif $(2)_BASE_NAME = $(1)-$$($(2)_VERSION)Signature · 1 line
2.1.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 pkg-generic: substitute colon and space out of PKG_VERSION
In reply to Arnout Vandecappelle (Essensium/Mind)Quoted 18 lines · Arnout Vandecappelle (Essensium/Mind)
Using a colon or a space in a make target doesn't work, so they have to be filtered out of the
PKG_VERSIONvariable just like the / currently already is.This will be needed for date-based CVS versions.
Cc Fabio Porcedda <[email protected]>Cc Yann E. MORIN <[email protected]>--- package/pkg-generic.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)package/pkg-generic.mk +0
-0
package/pkg-generic.mk $(2)_RAWNAME = $$(patsubst host-%,%,$(1)) · line 330
Quoted 10 lines
package/pkg-generic.mk +3
-1@@ -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 := $$(subst $(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(3)_VERSION)))))
Hold it, something is wrong here, because the host version gets an extra _
appended...
D'oh, $(space) should be $$(space) :-(
Regards,
Arnout
Quoted 12 lines
package/pkg-generic.mk +1
-1else $(2)_VERSION = undefined $(2)_DL_VERSION = undefined endif else $(2)_DL_VERSION := $$(strip $$($(2)_VERSION)) - $(2)_VERSION := $$(strip $$(subst /,_,$$($(2)_VERSION))) + $(2)_VERSION := $$(subst $$(space),_,$$(subst :,_,$$(subst /,_,$$(strip $$($(2)_VERSION))))) endif $(2)_BASE_NAME = $(1)-$$($(2)_VERSION)
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 1/1 pkg-generic: substitute colon and space out of PKG_VERSION
In reply to Arnout Vandecappelle (Essensium/Mind)Using a colon or a space in a make target doesn't work, so they have to be filtered out of the PKG_VERSION variable just like the / currently already is.
This will be needed for date-based CVS versions.
Add a helper macro 'sanitize' in pkg-utils.mk to implement this. This also moves the strip to the inner level for the target branch.
---
Changes v1 -> v2:
- Move to a helper macro (Thomas).
- Add moving of strip to commit message (Yann).
--- package/pkg-generic.mk | 6 ++++-- package/pkg-utils.mk | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-)
package/pkg-generic.mk +4 -2
@@ -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)
package/pkg-utils.mk +5 -0
@@ -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
Signature · 1 line
2.1.4
PATCH 1/1 pkg-generic: substitute colon and space out of PKG_VERSION
Arnout, All,
On 2015-04-23 01:08 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
Quoted 4 lines
Using a colon or a space in a make target doesn't work, so they have to be filtered out of the
PKG_VERSIONvariable just like the / currently already is.
Quoted 8 lines
This will be needed for date-based CVS versions.
Add a helper macro 'sanitize' in pkg-utils.mk to implement this. This also moves the strip to the inner level for the target branch.
Cc Fabio Porcedda <[email protected]>Cc Yann E. MORIN <[email protected]>
Regards,
Yann E. MORIN.
Quoted 56 lines
---
Changes v1 -> v2:
- Move to a helper macro (Thomas).
- Add moving of strip to commit message (Yann).--- package/pkg-generic.mk | 6 ++++-- package/pkg-utils.mk | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-)package/pkg-generic.mk +4
-2@@ -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)package/pkg-utils.mk +5
-0@@ -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 kernelSignature · 1 line
2.1.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'