public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Joshua Watt <JPEWhacker@gmail.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH] classes/own-mirror: Add hierarchical premirrors
Date: Mon, 01 Aug 2022 23:47:24 +0100	[thread overview]
Message-ID: <7080b3df677002145713e495cbed15f27cb36c3b.camel@linuxfoundation.org> (raw)
In-Reply-To: <20220801224305.251616-1-JPEWhacker@gmail.com>

On Mon, 2022-08-01 at 17:43 -0500, Joshua Watt wrote:
> Reworks own-mirrors.bbclass to allow multiple URLs to be listed in the
> SOURCE_MIRROR_URL variable. This allows a hierarchy of premirrors to be
> defined where URLs earlier in the list will be tried before the later
> ones.
> 
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
>  meta/classes/own-mirrors.bbclass | 31 +++++++++++++++++--------------
>  1 file changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/meta/classes/own-mirrors.bbclass b/meta/classes/own-mirrors.bbclass
> index ef972740ce..dcb4456222 100644
> --- a/meta/classes/own-mirrors.bbclass
> +++ b/meta/classes/own-mirrors.bbclass
> @@ -1,14 +1,17 @@
> -PREMIRRORS:prepend = " \
> -cvs://.*/.*     ${SOURCE_MIRROR_URL} \
> -svn://.*/.*     ${SOURCE_MIRROR_URL} \
> -git://.*/.*     ${SOURCE_MIRROR_URL} \
> -gitsm://.*/.*   ${SOURCE_MIRROR_URL} \
> -hg://.*/.*      ${SOURCE_MIRROR_URL} \
> -bzr://.*/.*     ${SOURCE_MIRROR_URL} \
> -p4://.*/.*      ${SOURCE_MIRROR_URL} \
> -osc://.*/.*     ${SOURCE_MIRROR_URL} \
> -https?://.*/.*  ${SOURCE_MIRROR_URL} \
> -ftp://.*/.*     ${SOURCE_MIRROR_URL} \
> -npm://.*/?.*    ${SOURCE_MIRROR_URL} \
> -s3://.*/.*      ${SOURCE_MIRROR_URL} \
> -"
> +python() {
> +    for m in reversed(d.getVar("SOURCE_MIRROR_URL").split()):
> +        d.prependVar("PREMIRRORS", " \
> +cvs://.*/.*     {m} \
> +svn://.*/.*     {m} \
> +git://.*/.*     {m} \
> +gitsm://.*/.*   {m} \
> +hg://.*/.*      {m} \
> +bzr://.*/.*     {m} \
> +p4://.*/.*      {m} \
> +osc://.*/.*     {m} \
> +https?://.*/.*  {m} \
> +ftp://.*/.*     {m} \
> +npm://.*/?.*    {m} \
> +s3://.*/.*      {m} \
> +".format(m=m))
> +}

It makes me a little sad every time I see us turning variables into
anonymous python :(

I can understand why here but it still makes me sad and it does come at
a performance price.

Cheers,

Richard


      reply	other threads:[~2022-08-01 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 22:43 [OE-core][PATCH] classes/own-mirror: Add hierarchical premirrors Joshua Watt
2022-08-01 22:47 ` Richard Purdie [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=7080b3df677002145713e495cbed15f27cb36c3b.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=JPEWhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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