Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Thomas Perale <thomas.perale@essensium.com>
Cc: Thomas Perale <thomas.perale@mind.be>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [RFC PATCH 2/5] package/pkg-utils.mk: urlencode/urldecode macros
Date: Sun, 7 Apr 2024 19:44:30 +0200	[thread overview]
Message-ID: <ZhLbfkgliWC2sR19@landeda> (raw)
In-Reply-To: <20240404124329.768546-3-thomas.perale@mind.be>

Thomas, All,

On 2024-04-04 14:43 +0200, Thomas Perale via buildroot spake thusly:
> This patch introduces two new macros:
> 
>   - urlencode
>   - urldecode
> 
> URL encoding consists of converting ASCII characters into
> a percent symbol followed by a two digit hexadecimal code.
> And the other way around for URL decoding.
> 
> The macros encode/decode a string passed as an argument by
> escaping the following characters:
> 
>   - '%' is replaced by %25
>   - 'space' is replaced by %20
> 
> The characters covered by this patch is non exhaustive.

Not sure what you meant with this sentence... Can you elaborate?
Or did you mean that we can add more chars in the future?

Regards,
Yann E. MORIN.

> Because the Make language treats spaces as different entry of a list,
> the aim of those macros is to provide a well known encoding method
> to escape text containing spaces into a string that won't be
> treated as a list by the Make language.
> 
> Signed-off-by: Thomas Perale <thomas.perale@mind.be>
> ---
>  package/pkg-utils.mk | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index 723bbe4e24..b8cfb85fca 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -329,3 +329,15 @@ define NXP_EXTRACT_HELPER
>  	find $(@D)/$(basename $(notdir $(1))) -mindepth 1 -maxdepth 1 -exec mv {} $(@D) \;
>  	rmdir $(@D)/$(basename $(notdir $(1)))
>  endef
> +
> +# urlencode -- returns an url encoded string.
> +#   - encode % into %25
> +#   - encode spaces into %20
> +#
> +# $(1): text
> +urlencode = $(subst $(space),%20,$(subst %,%25,$(1)))
> +
> +# urldecode -- decode an url encoded string.
> +#
> +# $(1): text
> +urldecode = $(subst %25,%,$(subst %20,$(space),$(1)))
> --
> 2.44.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-04-07 17:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 12:43 [Buildroot] [RFC PATCH 0/5] Support SBOM in CycloneDX format Thomas Perale via buildroot
2024-04-04 12:43 ` [Buildroot] [RFC PATCH 1/5] package/pkg-generic.mk: add PURL package variable Thomas Perale via buildroot
2024-04-04 12:43 ` [Buildroot] [RFC PATCH 2/5] package/pkg-utils.mk: urlencode/urldecode macros Thomas Perale via buildroot
2024-04-07 17:44   ` Yann E. MORIN [this message]
2024-04-07 19:21     ` Arnout Vandecappelle via buildroot
2024-04-04 12:43 ` [Buildroot] [RFC PATCH 3/5] support/misc/cyclonedx.mk: support CycloneDX format Thomas Perale via buildroot
2024-04-04 12:43 ` [Buildroot] [RFC PATCH 4/5] support/misc/cyclonedx.mk: support spdx license check Thomas Perale via buildroot
2024-04-04 12:43 ` [Buildroot] [RFC PATCH 5/5] Makefile: add command to generate SBOM in CycloneDX format Thomas Perale via buildroot
2024-04-05  9:21 ` [Buildroot] [RFC PATCH 0/5] Support " Michael Nosthoff via buildroot
2024-04-05 21:31   ` Thomas Perale via buildroot
2024-04-07 21:15 ` Thomas Petazzoni via buildroot
2024-04-08 19:15   ` Yann E. MORIN
2024-04-09 12:17     ` Arnout Vandecappelle via buildroot
2024-04-10 17:21       ` Yann E. MORIN
2024-04-10 19:26         ` Arnout Vandecappelle via buildroot
2024-04-10 20:10           ` Thomas Petazzoni via buildroot
2024-04-10 20:55             ` Yann E. MORIN

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=ZhLbfkgliWC2sR19@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=thomas.perale@essensium.com \
    --cc=thomas.perale@mind.be \
    --cc=thomas.petazzoni@bootlin.com \
    /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