From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] pkg-generic: substitute colon and space out of PKG_VERSION
Date: Sat, 25 Apr 2015 10:27:51 +0200 [thread overview]
Message-ID: <20150425082750.GA4275@free.fr> (raw)
In-Reply-To: <1429744088-19590-1-git-send-email-arnout@mind.be>
Arnout, All,
On 2015-04-23 01:08 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> 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.
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Fabio Porcedda <fabio.porcedda@gmail.com>
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> Changes v1 -> v2:
> - Move to a helper macro (Thomas).
> - Add moving of strip to commit message (Yann).
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> package/pkg-generic.mk | 6 ++++--
> package/pkg-utils.mk | 5 +++++
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index d1a1811..455bdf1 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 5a385f8..99a3c1e 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
> --
> 2.1.4
>
--
.-----------------.--------------------.------------------.--------------------.
| 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. |
'------------------------------^-------^------------------^--------------------'
prev parent reply other threads:[~2015-04-25 8:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 21:24 [Buildroot] [PATCH] pkg-generic: substitute colon and space out of PKG_VERSION Arnout Vandecappelle
2015-04-22 21:28 ` Thomas Petazzoni
2015-04-22 21:39 ` Yann E. MORIN
2015-04-22 22:44 ` Arnout Vandecappelle
2015-04-22 23:08 ` Arnout Vandecappelle
2015-04-25 8:27 ` Yann E. MORIN [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150425082750.GA4275@free.fr \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox