All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1 V2] fetch2: Add get_mirrorname()
@ 2019-03-22  9:36 Robert Yang
  2019-03-22  9:36 ` [PATCH 1/1 " Robert Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Yang @ 2019-03-22  9:36 UTC (permalink / raw)
  To: bitbake-devel

* V2
  - Use mirrorname as 'MIRRORNAME' if it is defined in origud.

* V1
  - Initial version

// Robert

The following changes since commit 2187d06166ed6819a1d07c3f8a3be7a256fab18c:

  goarch: Add riscv64 (2019-03-21 16:19:23 +0000)

are available in the Git repository at:

  git://git.pokylinux.org/poky-contrib rbt/mirror
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/mirror

Robert Yang (1):
  fetch2: Add get_mirrorname()

 bitbake/lib/bb/fetch2/__init__.py | 8 +++++++-
 bitbake/lib/bb/fetch2/git.py      | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.21.0



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

* [PATCH 1/1 V2] fetch2: Add get_mirrorname()
  2019-03-22  9:36 [PATCH 0/1 V2] fetch2: Add get_mirrorname() Robert Yang
@ 2019-03-22  9:36 ` Robert Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Yang @ 2019-03-22  9:36 UTC (permalink / raw)
  To: bitbake-devel

Then it can be used by both __init__.py and git.py, and use mirrorname as
'MIRRORNAME' if it is defined in origud.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/lib/bb/fetch2/__init__.py | 8 +++++++-
 bitbake/lib/bb/fetch2/git.py      | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 5c2a1c76c4..eee9b8e35e 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -889,6 +889,9 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None):
 
     return output
 
+def get_mirrorname(ud):
+    return ud.host.replace(':','.') + ud.path.replace('/', '.').replace('*', '.')
+
 def check_network_access(d, info, url):
     """
     log remote network access, and error if BB_NO_NETWORK is set or the given
@@ -910,7 +913,10 @@ def build_mirroruris(origud, mirrors, ld):
     replacements["HOST"] = origud.host
     replacements["PATH"] = origud.path
     replacements["BASENAME"] = origud.path.split("/")[-1]
-    replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.')
+    if hasattr(origud, "mirrorname"):
+        replacements["MIRRORNAME"] = origud.mirrorname
+    else:
+        replacements["MIRRORNAME"] = get_mirrorname(origud)
 
     def adduri(ud, uris, uds, mirrors, tarballs):
         for line in mirrors:
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 1a8ebe3da8..48c12bb9c8 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -248,10 +248,12 @@ class Git(FetchMethod):
                     ud.unresolvedrev[name] = ud.revisions[name]
                 ud.revisions[name] = self.latest_revision(ud, d, name)
 
-        gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.'))
+        gitsrcname = bb.fetch2.get_mirrorname(ud)
         if gitsrcname.startswith('.'):
             gitsrcname = gitsrcname[1:]
 
+        ud.mirrorname = gitsrcname
+
         # for rebaseable git repo, it is necessary to keep mirror tar ball
         # per revision, so that even the revision disappears from the
         # upstream repo in the future, the mirror will remain intact and still
-- 
2.21.0



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

end of thread, other threads:[~2019-03-22  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22  9:36 [PATCH 0/1 V2] fetch2: Add get_mirrorname() Robert Yang
2019-03-22  9:36 ` [PATCH 1/1 " Robert Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.