[bitbake-devel] [PATCH 2/5] fetch2: Add get_mirrorname()
Robert Yang
liezhi.yang at windriver.com
Thu Mar 14 09:28:18 UTC 2019
It can be used by both __init__.py and git.py.
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
bitbake/lib/bb/fetch2/__init__.py | 5 ++++-
bitbake/lib/bb/fetch2/git.py | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index f112067..5062bb2 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,7 @@ 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('*', '.')
+ 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 cf8bee7..45d7303 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -248,7 +248,7 @@ 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:]
--
2.7.4
More information about the bitbake-devel
mailing list