public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [OE-core][PATCH] classes/own-mirror: Add hierarchical premirrors
@ 2022-08-01 22:43 Joshua Watt
  2022-08-01 22:47 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Joshua Watt @ 2022-08-01 22:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Joshua Watt

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-01 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-01 22:43 [OE-core][PATCH] classes/own-mirror: Add hierarchical premirrors Joshua Watt
2022-08-01 22:47 ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox