public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [OE-core][PATCH] classes/own-mirror: Add hierarchical premirrors
Date: Mon,  1 Aug 2022 17:43:05 -0500	[thread overview]
Message-ID: <20220801224305.251616-1-JPEWhacker@gmail.com> (raw)

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))
+}
-- 
2.33.0



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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 22:43 Joshua Watt [this message]
2022-08-01 22:47 ` [OE-core][PATCH] classes/own-mirror: Add hierarchical premirrors Richard Purdie

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=20220801224305.251616-1-JPEWhacker@gmail.com \
    --to=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